Commit c21f3072 authored by Penom Nom's avatar Penom Nom
Browse files

add new components

parent a797cabf
......@@ -27,7 +27,7 @@ class RNAdiversity (Workflow):
oligos_fullpath = self.get_temporary_file(suffix=".oligos")
f = open(oligos_fullpath,"w")
if self.args["forward_primer"]:
f.write('forward\t%s\tGroup1\n' % self.args["forward_primer"])
f.write('forward\t%s\n' % self.args["forward_primer"])
if self.args["reverse_primer"]:
f.write('reverse\t%s\n' % self.args["reverse_primer"])
if self.args["sample_barcodes"]:
......@@ -42,21 +42,25 @@ class RNAdiversity (Workflow):
trimseqs = self.add_component("MothurTrimSeqs", [shhhflows.fasta_files, oligos_fullpath, shhhflows.names_files])
uniqueseqs = self.add_component("MothurUniqueSeqs", [trimseqs.trim_fasta_files, trimseqs.trim_names_files])
alignseqs = self.add_component("MothurAlignSeqs", [uniqueseqs.unique_fasta_files,self.args["reference_alignment"]])
# TODO: check screen.seqs -> do not iterate, might have a probleme with none
screenseqs = self.add_component("MothurScreenSeqs",[alignseqs.align_files, uniqueseqs.unique_names_files, trimseqs.groups_files])
filterseqs = self.add_component("MothurFilterSeqs",[screenseqs.good_align_files])
uniqueseqs_filter = self.add_component("MothurUniqueSeqs",[filterseqs.filtered_fasta_files,screenseqs.good_names_files],component_prefix="filter")
precluster = self.add_component("MothurPreCluster",[uniqueseqs_filter.unique_fasta_files,uniqueseqs_filter.unique_names_files,screenseqs.good_groups_files])
# TODO: names file required but is not
chimerauchime = self.add_component("MothurChimeraUchime",[precluster.precluster_fasta_files,precluster.precluster_names_files,screenseqs.good_groups_files])
#removeseqs = self.add_component("MothurRemoveSeqs",[chimerauchime.uchime_accnos_files,precluster.precluster_fasta_files,precluster.precluster_names_files,\
# screenseqs.good_groups_files])
#classifyseqs = self.add_component("MothurClassifySeqs",[removeseqs.pick_fasta_files,self.args["template"],self.args["taxonomy"],removeseqs.pick_names_files,\
# removeseqs.pick_groups_files,])
#krona_classifyseqs = self.add_component("MothurKrona", [classifyseqs.taxonomy_files],{},"classifyseqs")
#removegroups = self.add_component("MothurRemoveGroups", [removeseqs.pick_fasta_files,removeseqs.pick_names_files,removeseqs.pick_groups_files,chimerauchime.uchime_accnos_files])
#distseqs = self.add_component("MothurDistSeqs", [removeseqs.pick_fasta_files])
#cluster = self.add_component("MothurCluster", [distseqs.dist_files,removeseqs.pick_names_files])
#makeshared = self.add_component("MothurMakeShared", [cluster.an_list_files,removeseqs.pick_groups_files])
#classifyotu = self.add_component("MothurClassifyOtu", [cluster.an_list_files,classifyseqs.taxonomy_files,removeseqs.pick_names_files,removeseqs.pick_groups_files])
if self.args["reference_chimera"]:
chimerauchime = self.add_component("MothurChimeraUchime",kwargs={'fasta_files':precluster.precluster_fasta_files,'reference_files':self.args["reference_chimera"]})
else:
chimerauchime = self.add_component("MothurChimeraUchime",kwargs={'fasta_files':precluster.precluster_fasta_files,'names_files':precluster.precluster_names_files,\
'groups_files':screenseqs.good_groups_files})
removeseqs = self.add_component("MothurRemoveSeqs",[chimerauchime.uchime_accnos_files,precluster.precluster_fasta_files,precluster.precluster_names_files,\
screenseqs.good_groups_files])
#Analysis MothurClassify
classifyseqs = self.add_component("MothurClassifySeqs",[removeseqs.pick_fasta_files,self.args["template"],self.args["taxonomy"],removeseqs.pick_names_files,\
removeseqs.pick_groups_files])
krona_classifyseqs = self.add_component("MothurKrona", [classifyseqs.taxonomy_files,removeseqs.pick_names_files,removeseqs.pick_groups_files],{},"classifyseqs")
# removegroups = self.add_component("MothurRemoveGroups", [removeseqs.pick_fasta_files,removeseqs.pick_names_files,removeseqs.pick_groups_files,chimerauchime.uchime_accnos_files])
distseqs = self.add_component("MothurDistSeqs", [removeseqs.pick_fasta_files])
cluster = self.add_component("MothurCluster", [distseqs.dist_files,removeseqs.pick_names_files])
makeshared = self.add_component("MothurMakeShared", [cluster.an_list_files,removeseqs.pick_groups_files])
venn = self.add_component("MothurVenn", [makeshared.an_shared_files])
#classifyotu = self.add_component("MothurClassifyOtu", [cluster.an_list_files,classifyseqs.taxonomy_files,removeseqs.pick_names_files,removeseqs.pick_groups_files])
#krona_classifyotu = self.add_component("MothurKrona", [classifyotu.cons_taxonomy_files],{},"classifyotu")
from jflow.component import Component
from jflow.iotypes import OutputFile, OutputFileList, InputFile, InputFileList, Formats
from jflow.abstraction import MultiMap
from weaver.function import ShellFunction
class MothurMakeShared(Component):
"""
Create a table that indicates the number of times an OTU shows up in each sample
"""
def define_parameters(self, an_list_files, groups_files):
"""
:param an_list_files: an list files to process
:type an_list_files: str
:param groups_files: groups files to process
:type groups_files: str
"""
#define input files
self.an_list_files = InputFileList(an_list_files)
self.groups_files = InputFileList(groups_files, Formats.MOTHUR_GROUPS)
#define output files
self.an_shared_files = OutputFileList(self.get_outputs('{basename_woext}.shared', self.an_list_files))
self.stdout = OutputFileList(self.get_outputs('{basename_woext}.stdout', self.an_list_files))
def process(self):
print ">>>Process make.shared"
makeshared = ShellFunction(self.get_exec_path("mothur") + ' "#make.shared(list=$1,group=$2,outputdir='+self.output_directory+'/)" > $3',cmd_format='{EXE} {IN} {OUT}')
makeshared = MultiMap(makeshared, inputs=[self.an_list_files,self.groups_files], outputs=[self.stdout,self.an_shared_files])
\ No newline at end of file
from jflow.component import Component
from jflow.iotypes import OutputFile, OutputFileList, InputFile, InputFileList, Formats
from jflow.abstraction import MultiMap
from weaver.function import ShellFunction
class MothurVenn(Component):
"""
"""
def define_parameters(self, shared_files, label=0.01):
"""
:param shared_files: an shared files to process
:type shared_files: str
"""
#define parameters
self.label = label
#define input files
self.shared_files = InputFileList(shared_files)
#define output files
self.stdout = OutputFileList(self.get_outputs('{basename_woext}.stdout', self.shared_files))
def process(self):
print ">>>Process Venn"
makeshared = ShellFunction(self.get_exec_path("mothur") + ' "#venn(shared=$1,label='+str(self.label)+',outputdir='+self.output_directory+'/)" > $2',cmd_format='{EXE} {IN} {OUT}')
makeshared = MultiMap(makeshared, inputs=[self.shared_files], outputs=[self.stdout])
\ No newline at end of file
......@@ -63,4 +63,8 @@ template.required = True
taxonomy.name = taxonomy
taxonomy.flag = --taxonomy
taxonomy.help = taxonomy
taxonomy.required = True
\ No newline at end of file
taxonomy.required = True
reference_chimera.name = reference_chimera
reference_chimera.flag = --reference-chimera
reference_chimera.help = Where is stored the reference chimera
\ 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