Commit 5c006f81 authored by Gerald Salin's avatar Gerald Salin
Browse files

#73 call gzip with its absolute path

parent 58b2cef3
......@@ -38,7 +38,7 @@ class ConcatenateFiles (Component):
def process(self):
arg_pattern, next_number = get_argument_pattern(self.files_list, start_number=2)
if self.extension.endswith(".gz") :
self.add_shell_execution('zcat ' + arg_pattern + ' | gzip - > $1', cmd_format='{EXE} {OUT} {IN}',
self.add_shell_execution('zcat ' + arg_pattern + ' | '+self.get_exec_path("gzip")+' - > $1', cmd_format='{EXE} {OUT} {IN}',
map=False, outputs = self.output_file, inputs=self.files_list)
else :
self.add_shell_execution('cat ' + arg_pattern + ' > $1', cmd_format='{EXE} {OUT} {IN}',
......
......@@ -16,6 +16,7 @@
#
import os
import re
import logging
from jflow.utils import get_argument_pattern
from jflow.component import Component
......@@ -43,6 +44,8 @@ class ConcatenateFilesGroups (Component):
output_list.append( os.path.join(self.runobj.get_work_directory(),prefix+"."+".".join(extensions)))
logging.getLogger("ConcatenateFilesGroups").debug("define_parameters. extensions = " + ",".join(extensions))
self.add_output_file_list( "concat_files", "concat_files", pattern='{fullpath}', items= output_list)
self.add_output_file_pattern( "r1_files", "r1_files", pattern='*_R1.fastq.gz')
self.add_output_file_pattern( "r2_files", "r2_files", pattern='*_R2.fastq.gz')
#self.add_output_file_list( "concat_files", "concat_files", items= self.group_prefix)
def process(self):
......@@ -56,6 +59,16 @@ class ConcatenateFilesGroups (Component):
files_to_concatenate.append(os.path.join(self.runobj.get_work_directory(),os.path.basename(file_to_concatenate)+"."+".".join(os.path.basename(self.files_list[0]).split(".")[1:])))
logging.getLogger("ConcatenateFilesGroups").debug("process. files_to_concatenate = " + ", ".join(files_to_concatenate))
self.concat_files = self.get_outputs('{fullpath}', files_to_concatenate)
R1files = []
R2files = []
for file in self.concat_files:
if re.search("_R1.",file):
R1files.append(file)
if re.search("_R2.",file):
R2files.append(file)
logging.getLogger("ConcatenateFilesGroups").debug("process R1files = " + ",".join(R1files))
self.r1_files = sorted(R1files)
self.r2_files = sorted(R2files)
# self.concat_files = files_to_concatenate
logging.getLogger("ConcatenateFilesGroups").debug("process. self.concat_files bis = " + ", ".join(self.concat_files))
# Create dictionary : key = prefix and value = the output file
......@@ -77,10 +90,10 @@ class ConcatenateFilesGroups (Component):
inputs = concat_groups[prefix], outputs = outputs_path[prefix])
# If the file is zip
else:
logging.getLogger("ConcatenateFilesGroups").debug("process. command = " + 'zcat ' + cmd_inputs_pattern + ' | gzip - > ${' + str(next_arg_number) + '}' + ", ".join(concat_groups[prefix]) + ", and ouput = "+", ".join(outputs_path[prefix]))
logging.getLogger("ConcatenateFilesGroups").debug("process. command = " + 'zcat ' + cmd_inputs_pattern + ' | '+self.get_exec_path("gzip")+' - > ${' + str(next_arg_number) + '}' + ", ".join(concat_groups[prefix]) + ", and ouput = "+", ".join(outputs_path[prefix]))
output = os.path.join(self.runobj.get_work_directory(),prefix+"."+".".join(os.path.basename(self.files_list[0]).split(".")[1:]))
out_files.append(output)
self.add_shell_execution('zcat ' + cmd_inputs_pattern + ' | gzip - > ${' + str(next_arg_number) + '}',
self.add_shell_execution('zcat ' + cmd_inputs_pattern + ' | '+self.get_exec_path("gzip")+' - > ${' + str(next_arg_number) + '}',
cmd_format='{EXE} {IN} {OUT}', map=False,
inputs = concat_groups[prefix], outputs = outputs_path[prefix])
# self.concat_files = out_files
......@@ -108,6 +108,6 @@ class FastqIlluminaFilter (Analysis):
inputs = self.fastq_files, outputs = [self.fastq_files_filtered, self.stdout])
# If the file is zip
else:
self.add_shell_execution("zcat $3 | " + self.get_exec_path("fastq_illumina_filter") + " --keep " + self.keep_option + " -v 2> $2 | gzip > $1",
self.add_shell_execution("zcat $3 | " + self.get_exec_path("fastq_illumina_filter") + " --keep " + self.keep_option + " -v 2> $2 | "+self.get_exec_path("gzip")+" > $1",
cmd_format='{EXE} {OUT} {IN}', map=True,
inputs = self.fastq_files, outputs = [self.fastq_files_filtered, self.stdout])
......@@ -146,7 +146,7 @@ class SubsetSeqFiles (Analysis):
self.add_python_execution(extract_random_seq,cmd_format="{EXE} {IN} {OUT}",
inputs = [i,self.output_file], outputs = o, map=False)
gzip = ShellFunction( 'gzip $1', cmd_format='{EXE} {IN} {OUT}')
gzip = ShellFunction( self.get_exec_path("gzip")+' $1', cmd_format='{EXE} {IN} {OUT}')
MultiMap(gzip, inputs=[subset_read1], outputs=[subset_read1_gz])
self.read1 = subset_read1_gz
......
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