Commit 429e38d1 authored by Penom Nom's avatar Penom Nom
Browse files

maj symlink remove to classifyseqs and add to krona

parent 535bce52
......@@ -19,24 +19,43 @@ from jflow.component import Component
from jflow.iotypes import OutputFile, OutputFileList, InputFile, InputFileList, Formats
from jflow.abstraction import MultiMap
from weaver.function import ShellFunction
from weaver.function import PythonFunction, ShellFunction
def classifyseqs_with_sample(exec_path, output_directory, taxonomy_files, names_files, groups_files, krona_files):
import os
dst_names_files = os.path.splitext(taxonomy_files)[0]+'.names'
dst_groups_files = os.path.splitext(taxonomy_files)[0]+'.groups'
if not os.path.islink(dst_names_files):
os.symlink(names_files,dst_names_files)
if not os.path.islink(dst_groups_files):
os.symlink(groups_files,dst_groups_files)
cmd = str(exec_path)+ " " +str(taxonomy_files) + ' -o ' + str(krona_files)
p = os.popen(cmd)
class MothurKrona(Component):
"""
"""
def define_parameters(self, taxonomy_files):
def define_parameters(self, taxonomy_files, names_files=None, groups_files=None):
"""
"""
#define input files
self.taxonomy_files = InputFileList(taxonomy_files, Formats.MOTHUR_TAXONOMY)
if names_files : self.names_files = InputFileList(names_files, Formats.MOTHUR_NAMES)
else : self.names_files = None
if groups_files : self.groups_files = InputFileList(groups_files, Formats.MOTHUR_GROUPS)
else : self.groups_files = None
#define output files
self.krona_files = OutputFileList(self.get_outputs('{basename_woext}.html', self.taxonomy_files), Formats.MOTHUR_KRONA)
self.stdout = OutputFileList(self.get_outputs('{basename_woext}.stdout', self.taxonomy_files))
def process(self):
print ">>>Process Krona"
precluster = ShellFunction(self.get_exec_path("krona") + ' $1 -o $3 > $2', cmd_format='{EXE} {IN} {OUT}')
precluster = MultiMap(precluster, inputs=[self.taxonomy_files], outputs=[self.stdout,self.krona_files])
if self.names_files and self.groups_files:
krona = PythonFunction(classifyseqs_with_sample, cmd_format="{EXE} {ARG} {IN} {OUT}")
krona(arguments=[self.get_exec_path("krona"),self.output_directory],inputs=[self.taxonomy_files,self.names_files,self.groups_files],\
outputs=[self.krona_files])
else:
krona = ShellFunction(self.get_exec_path("krona") + ' $1 -o $3 > $2', cmd_format='{EXE} {IN} {OUT}')
krona = MultiMap(krona, inputs=[self.taxonomy_files], outputs=[self.stdout,self.krona_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