[Tutor] R: Tutor Digest, Vol 138, Issue 26 Re: Problem on select esecution of object in a class (Alan Gauld)

jarod_v6 at libero.it jarod_v6 at libero.it
Wed Aug 5 22:33:01 CEST 2015

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,
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 ...

At the moment the only way I found is this:
 for cmd in cmdset: 
		 	step = cmd()
		 	for i in step:
		 		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 

>However, building function names as strings and then calling
>them is usually a bad design pattern. Especially for large
>numbers of objects. So maybe if you explain what/why you are
>doing this we can suggest a better alternative.
>Alan G
>Author of the Learn to Program web site
>Follow my photo-blog on Flickr at:
>Subject: Digest Footer
>Tutor maillist  -  Tutor at python.org
>End of Tutor Digest, Vol 138, Issue 26

More information about the Tutor mailing list