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

No commit message

No commit message
parent 57b83cc0
#
# Copyright (C) 2012 INRA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import re
from jflow.component import Component
......@@ -23,15 +6,7 @@ from jflow.abstraction import MultiMap
from weaver.function import PythonFunction, ShellFunction
def classifyseqs_with_sample(exec_path, output_directory, processors, cutoff, fasta_files, template_files, database_taxonomy_files, names_files, groups_files, taxonomy_files, \
tax_summary_files):
import os
os.symlink(names_files,os.path.splitext(taxonomy_files)[0]+'.names')
os.symlink(groups_files,os.path.splitext(taxonomy_files)[0]+'.groups')
cmd = str(exec_path)+' "#classify.seqs(fasta='+str(fasta_files)+',template='+str(template_files)+',taxonomy='+str(database_taxonomy_files)+',name='+str(names_files)\
+',group='+str(groups_files)+',outputdir='+str(output_directory)+'/,cutoff='+str(cutoff)+',processors='+str(processors)+')"'
p = os.popen(cmd)
class MothurClassifySeqs(Component):
"""
......@@ -52,6 +27,7 @@ class MothurClassifySeqs(Component):
:param processors: the number of processors to use
:type processors: int
"""
#define parameters
self.cutoff = cutoff
self.processors = processors
......@@ -78,11 +54,15 @@ class MothurClassifySeqs(Component):
classifyseqs = MultiMap(classifyseqs, inputs=[self.fasta_files,self.template_files,self.database_taxonomy_files,self.names_files],\
outputs=[self.stdout,self.taxonomy_files,self.tax_summary_files])
elif self.names_files and self.groups_files:
classifyseqs = PythonFunction(classifyseqs_with_sample, cmd_format="{EXE} {ARG} {IN} {OUT}")
classifyseqs(arguments=[self.get_exec_path("mothur"),self.output_directory,self.processors,self.cutoff],inputs=[self.fasta_files,self.template_files,\
self.database_taxonomy_files,self.names_files,self.groups_files],outputs=[self.taxonomy_files,self.tax_summary_files])
classifyseqs = ShellFunction(self.get_exec_path("mothur") + ' "#classify.seqs(fasta=$1,template=$2,taxonomy=$3,name=$4,group=$5,cutoff='+str(self.cutoff)+\
',outputdir='+self.output_directory+'/,processors='+str(self.processors)+')" > $6', cmd_format='{EXE} {IN} {OUT}')
classifyseqs = MultiMap(classifyseqs, inputs=[self.fasta_files,self.template_files,self.database_taxonomy_files,self.names_files,self.groups_files],\
outputs=[self.stdout,self.taxonomy_files,self.tax_summary_files])
else:
classifyseqs = ShellFunction(self.get_exec_path("mothur") + ' "#classify.seqs(fasta=$1,template=$2,taxonomy=$3,cutoff='+str(self.cutoff)+\
',outputdir='+self.output_directory+'/,processors='+str(self.processors)+')" > $4', cmd_format='{EXE} {IN} {OUT}')
classifyseqs = MultiMap(classifyseqs, inputs=[self.fasta_files,self.template_files,self.database_taxonomy_files],\
outputs=[self.stdout,self.taxonomy_files,self.tax_summary_files])
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