Steven D'Aprano
2015-08-10 03:15:15 UTC
Hi Jarod,
I'm not sure if you have received an answer to your question.
It might help if you use a subject line that describes your question.
but I think I can guess. Something similar to this should work:
cmdset = ena.cmdset
options = "1,3" # for example
options = options.replace(",", " ").split()
# options now has ["1", "3"]
options = [int(s) for s in options]
# options now has [1, 3], integers, not strings
for opt in options:
cmd = cmdset[i-1] # remember Python starts counting at 0, not 1
print cmd()
Does that help?
I'm not sure if you have received an answer to your question.
It might help if you use a subject line that describes your question.
Thanks so much fro the help. What I want to do is to obtain a selection of the
function I want to run.
ena = Rnaseq(options.configura, options.rst, options.outdir)
cmdset = [ ena.trimmomatic,
ena.star,
ena.merge_trimmomatic_stats
]
ena.show()
1 ena.trimmomatic
2 ena.star
3 ena.merge_trimmomatic_stats
The class RNaseq have multiple function. I want a way to run or from 1 to 3 or
from 2 to 3 or only the 2 o 3 step.
...
parser.add_option("-s", "--step",action="store", dest="steps",type="string",
help=" write input file: %prg -o : directory of results ")
python myscript -s 1,3 ...
step = cmd()
print i.command
but is not elegant so I want to know more what is the right way to generate a
execution f the function of the class by select which is the step we want to
start.
This is hard to answer since you don't tell us directly what cmdset is,function I want to run.
ena = Rnaseq(options.configura, options.rst, options.outdir)
cmdset = [ ena.trimmomatic,
ena.star,
ena.merge_trimmomatic_stats
]
ena.show()
1 ena.trimmomatic
2 ena.star
3 ena.merge_trimmomatic_stats
The class RNaseq have multiple function. I want a way to run or from 1 to 3 or
from 2 to 3 or only the 2 o 3 step.
...
parser.add_option("-s", "--step",action="store", dest="steps",type="string",
help=" write input file: %prg -o : directory of results ")
python myscript -s 1,3 ...
step = cmd()
print i.command
but is not elegant so I want to know more what is the right way to generate a
execution f the function of the class by select which is the step we want to
start.
but I think I can guess. Something similar to this should work:
cmdset = ena.cmdset
options = "1,3" # for example
options = options.replace(",", " ").split()
# options now has ["1", "3"]
options = [int(s) for s in options]
# options now has [1, 3], integers, not strings
for opt in options:
cmd = cmdset[i-1] # remember Python starts counting at 0, not 1
print cmd()
Does that help?
--
Steve
_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Steve
_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor