Commit e1810c58 authored by Gerald Salin's avatar Gerald Salin
Browse files

ADD usage of add_python_execution and add_shell_execution

parent b6048c96
......@@ -87,7 +87,6 @@ class Cstacks (Component):
for tag in self.tags_files:
tmp_file.write(tag+"\n")
cstacks = PythonFunction(wrap_cstacks, cmd_format='{EXE} {ARG} {IN} {OUT}')
cstacks(inputs = [tmp_list_file], outputs = [self.catalog_tags, self.catalog_alleles, self.catalog_snps, self.stderr], \
self.add_python_execution(wrap_cstacks, cmd_format="{EXE} {ARG} {IN} {OUT}",inputs = [tmp_list_file], outputs = [self.catalog_tags, self.catalog_alleles, self.catalog_snps, self.stderr], \
arguments = [self.get_exec_path("cstacks"), self.mismatch, self.batch_id,self.output_directory], \
includes = [self.tags_files, self.alleles_files, self.snps_files])
includes = [self.tags_files, self.alleles_files, self.snps_files], map=False )
\ No newline at end of file
......@@ -342,26 +342,23 @@ class ProcessRadtag (Analysis):
# Process radtags read1 files
for i in range(0, len(self.prefixes)):
print(self.parameters)
process_radtag = ShellFunction(self.get_exec_path("process_radtags") + " -f $1 " + self.parameters + " -o " + self.output_directory + " 2> $2 ", cmd_format='{EXE} {IN} {OUT}')
process_radtag(inputs = [self.read1_files[i]], outputs = [self.stderr_process_files[i], tmp_output_read_1[i], tmp_discard_read_1[i]])
self.add_shell_execution(self.get_exec_path("process_radtags") + " -f $1 " + self.parameters + " -o " + self.output_directory + " 2> $2 ", cmd_format = "{EXE} {IN} {OUT}", inputs = [self.read1_files[i]], outputs = [self.stderr_process_files[i], tmp_output_read_1[i], tmp_discard_read_1[i]], map=False)
#print "apres boucle"
if(self.read2_files):
print("Recover")
# Recover_mate and recover_discard
recover_mate = PythonFunction(recover_mate_ok, cmd_format="{EXE} {IN} {OUT}")
MultiMap(recover_mate, inputs = [tmp_output_read_1, self.read2_files], outputs=[tmp_output_read_2])
recover_discard = PythonFunction(recover_mate_discards, cmd_format="{EXE} {IN} {OUT}")
MultiMap(recover_discard, inputs = [tmp_discard_read_1, self.read2_files], outputs=[tmp_discard_read_2])
self.add_python_execution(recover_mate_ok, cmd_format="{EXE} {IN} {OUT}", inputs = [tmp_output_read_1, self.read2_files], outputs=[tmp_output_read_2], map=True)
self.add_python_execution(recover_mate_discards, cmd_format="{EXE} {IN} {OUT}", inputs = [tmp_discard_read_1, self.read2_files], outputs=[tmp_discard_read_2], map=True)
# Compress
compress = ShellFunction("gzip -c $1 > $2 ", cmd_format='{EXE} {IN} {OUT}')
MultiMap(compress, inputs = tmp_output_read_1, outputs = self.out_process_read1_files )
MultiMap(compress, inputs = tmp_discard_read_1, outputs = self.discard_process_read1_files )
self.add_shell_execution("gzip -c $1 > $2 ", cmd_format="{EXE} {IN} {OUT}",inputs = tmp_output_read_1, outputs = self.out_process_read1_files, map=True )
self.add_shell_execution("gzip -c $1 > $2 ", cmd_format="{EXE} {IN} {OUT}", inputs = tmp_discard_read_1, outputs = self.discard_process_read1_files, map=True )
if (self.read2_files):
MultiMap(compress, inputs = tmp_output_read_2, outputs = self.out_process_read2_files )
MultiMap(compress, inputs = tmp_discard_read_2, outputs = self.discard_process_read2_files )
self.add_shell_execution("gzip -c $1 > $2 ", cmd_format="{EXE} {IN} {OUT}",inputs = tmp_output_read_2, outputs = self.out_process_read2_files, map=True )
self.add_shell_execution("gzip -c $1 > $2 ", cmd_format="{EXE} {IN} {OUT}",inputs = tmp_discard_read_2, outputs = self.discard_process_read2_files, map=True )
# clone_filter
......@@ -372,8 +369,7 @@ class ProcessRadtag (Analysis):
if(self.read2_files and not self.enzyme_name2):
self.add_output_file_list("out_clone_read2_files", "uniq read2 files", pattern='{basename_woext}_cloneFil.fq.gz', items=self.read2_files)
for idx, read1 in enumerate(self.read1_files):
clonefilter = PythonFunction(wrap_clonefilter_PE, cmd_format="{EXE} {ARG} {IN} {OUT}")
clonefilter(arguments=[self.get_exec_path("clone_filter"), self.output_directory], inputs=[self.out_process_read1_files[idx], self.out_process_read2_files[idx]], outputs=[self.out_clone_read1_files[idx], self.out_clone_read2_files[idx], self.hist_clone_files[idx], self.stderr_clone_files[idx]])
self.add_python_execution(wrap_clonefilter_PE, cmd_format="{EXE} {ARG} {IN} {OUT}",arguments=[self.get_exec_path("clone_filter"), self.output_directory], inputs=[self.out_process_read1_files[idx], self.out_process_read2_files[idx]], outputs=[self.out_clone_read1_files[idx], self.out_clone_read2_files[idx], self.hist_clone_files[idx], self.stderr_clone_files[idx]],map=False)
else :
raise Exception("Error : no clone filter for single read, or double RAD")
......@@ -172,11 +172,8 @@ class Splitbc (Analysis):
outputs_read2 = self.matrix_read2[id]
command.extend(["--prefix-r2", os.path.join(pool_outdir, "%_2.fq") , "$1", "$2", '2>&1 >> $3'])
command = ' '.join(command)
splitbc = ShellFunction(command, cmd_format='{EXE} {IN} {OUT}')
splitbc(includes = [barcode] , inputs=[fastq1, fastq2], outputs=[stdout, outputs_read1, outputs_read2])
self.add_shell_execution(command, cmd_format='{EXE} {IN} {OUT}',includes = [barcode] , inputs=[fastq1, fastq2], outputs=[stdout, outputs_read1, outputs_read2],map=False)
else :
command.extend([ "$1", '2>&1 >> $2' ])
command = ' '.join(command)
splitbc = ShellFunction(command, cmd_format='{EXE} {IN} {OUT}')
splitbc(includes = [barcode] , inputs=[fastq1], outputs=[stdout, outputs_read1])
self.add_shell_execution(command, cmd_format='{EXE} {IN} {OUT}',includes = [barcode] , inputs=[fastq1], outputs=[stdout, outputs_read1],map=False)
\ No newline at end of file
......@@ -107,9 +107,5 @@ class Ustacks (Component):
id=self.samples_id[idx]
format="gzfastq" if read1.endswith(".gz") else "fastq"
ustacks = ShellFunction(self.get_exec_path("ustacks") + " -t " + format + " -f $1 -o " + self.output_directory + " -i " + str(id)
+ self.options + " 2> $2", cmd_format='{EXE} {IN} {OUT}')
ustacks(inputs = [read1], outputs = [self.stderrs[idx], self.tags[idx], self.alleles[idx], self.snps[idx]])
\ No newline at end of file
self.add_shell_execution(self.get_exec_path("ustacks") + " -t " + format + " -f $1 -o " + self.output_directory + " -i " + str(id)
+ self.options + " 2> $2", cmd_format='{EXE} {IN} {OUT}',inputs = [read1], outputs = [self.stderrs[idx], self.tags[idx], self.alleles[idx], self.snps[idx]], map=False )
\ No newline at end of file
Supports Markdown
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