Commit f36598d1 authored by Jerome Mariette's avatar Jerome Mariette
Browse files

add processors options to pre.cluster

parent 0c53ced2
......@@ -24,7 +24,7 @@ from weaver.function import ShellFunction
class MothurPreCluster(Component):
def define_parameters(self, fasta_files, names_files=None, groups_files=None, count_table_files=None, diffs=2):
def define_parameters(self, fasta_files, names_files=None, groups_files=None, count_table_files=None, diffs=2, processors=1):
"""
Define pre.cluster component parameters.
:param fasta_files: fasta files to process
......@@ -38,6 +38,7 @@ class MothurPreCluster(Component):
"""
# define parameters
self.diffs = diffs
self.processors = processors
# define input files
self.fasta_files = InputFileList(fasta_files, Formats.FASTA)
if names_files : self.names_files = InputFileList(names_files, Formats.MOTHUR_NAMES)
......@@ -56,18 +57,19 @@ class MothurPreCluster(Component):
def process(self):
if self.names_files and self.groups_files:
precluster = ShellFunction(self.get_exec_path("mothur") + ' "#pre.cluster(fasta=$1,name=$2,group=$3,outputdir='+self.output_directory+'/,diffs='+str(self.diffs)+\
')" > $4',cmd_format='{EXE} {IN} {OUT}')
',processors='+str(self.processors)+')" > $4',cmd_format='{EXE} {IN} {OUT}')
precluster = MultiMap(precluster, inputs=[self.fasta_files,self.names_files,self.groups_files],outputs=[self.stdout,self.precluster_fasta_files,\
self.precluster_names_files])
elif self.names_files and not self.groups_files :
precluster = ShellFunction(self.get_exec_path("mothur") + ' "#pre.cluster(fasta=$1,name=$2,outputdir='+self.output_directory+'/,diffs='+str(self.diffs)+\
')" > $3',cmd_format='{EXE} {IN} {OUT}')
',processors='+str(self.processors)+')" > $3',cmd_format='{EXE} {IN} {OUT}')
precluster = MultiMap(precluster, inputs=[self.fasta_files,self.names_files],outputs=[self.stdout,self.precluster_fasta_files,self.precluster_names_files])
elif self.count_table_files:
precluster = ShellFunction(self.get_exec_path("mothur") + ' "#pre.cluster(fasta=$1,count=$2,outputdir='+self.output_directory+'/,diffs='+str(self.diffs)+\
')" > $3',cmd_format='{EXE} {IN} {OUT}')
',processors='+str(self.processors)+')" > $3',cmd_format='{EXE} {IN} {OUT}')
precluster = MultiMap(precluster, inputs=[self.fasta_files,self.count_table_files],outputs=[self.stdout,self.precluster_fasta_files,self.precluster_count_table_files])
else:
precluster = ShellFunction(self.get_exec_path("mothur") + ' "#pre.cluster(fasta=$1,outputdir='+self.output_directory+'/,diffs='+str(self.diffs)+\
')" > $2',cmd_format='{EXE} {IN} {OUT}')
precluster = MultiMap(precluster, inputs=[self.fasta_files],outputs=[self.stdout,self.precluster_fasta_files,self.precluster_names_files])
\ No newline at end of file
',processors='+str(self.processors)+')" > $2',cmd_format='{EXE} {IN} {OUT}')
precluster = MultiMap(precluster, inputs=[self.fasta_files],outputs=[self.stdout,self.precluster_fasta_files,self.precluster_names_files])
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment