Commit bc3d51ce authored by Claire Kuchly's avatar Claire Kuchly

Merge branch 'test-mmanno' into 'master'

Test mmanno barcode visu

See merge request !2
parents fe6e352f 9bfb3a76
......@@ -73,14 +73,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{assign var='barcode_name_count' value=$barcode_name_sample|@count}
{*debug*}
<div>
<legend>Analyse results report - Sample name : {$descriptions.sample_1}</legend>
{assign var='data_col' value=2}
<div class="row">
{if $metrics['basic']}
<div class="col-md-4 col-lg-4">
<table id="ont_table_basic" class="table table-striped table-bordered dataTable analysis-result-table">
<table id="ont_table_basic" class="table table-striped table-bordered dataTable">
<thead><tr><th colspan="2"><h4>Basic matrics report</h4></thead></tr></th>
<tbody>
{foreach from=$basic_headers key=k item=head}
......@@ -101,7 +101,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{/if}
{if $metrics['quality']}
<div class="col-md-4 col-lg-4">
<table id="ont_table_quality" class="table table-striped table-bordered dataTable analysis-result-table">
<table id="ont_table_quality" class="table table-striped table-bordered dataTable">
<thead><tr><th colspan="2"><h4>Quality report</h4></thead></tr></th>
<tbody>
{foreach from=$quality_headers key=k item=head}
......@@ -125,7 +125,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{/if}
{if $metrics['plots']}
<div class="col-md-3 col-lg-3">
<table id="ont_table_plot" class="table table-striped table-bordered dataTable analysis-result-table">
<table id="ont_table_plot" class="table table-striped table-bordered dataTable">
<thead><tr><th colspan="2"><h4>Plots report</h4></h4></thead></tr></th>
<tbody>
{foreach from=$plots_headers key=k item=head}
......@@ -149,19 +149,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</div>
{/if}
</div>
</div>
<br><br>
{*If there are barcodes file in the run*}
{if $barcode_name_count > 1 }
<table id="ont_stats_datatable" class="table table-striped table-bordered dataTable analysis-result-table">
<thead>
<tr>
<th rowspan="2"><center><input type="checkbox" id="chk_all_sample"/></center></th>
{assign var="nb_samples" value=$barcode_name_count}
<th class="string-sort" rowspan="2" id="th_id_1"><center>Sample {if $nb_samples > 1 }({$nb_samples}){/if}</center></th>
<th colspan="{$barcode_headers_count}"><center>Barcode ONT results</center></th>
......@@ -170,27 +169,27 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{assign var="th_id" value=2}
{foreach from=$barcode_headers key=k item=head}
{if $head == 'total_bases'}
<th class = "numeric-sort" id="th_id_{$th_id}">Total bases</th>
<th class = "numeric-sort" id="th_id_{$th_id}">Total_bases</th>
{elseif $head == 'nb_reads'}
<th class = "numeric-sort" id="th_id_{$th_id}">Nb reads</th>
<th class = "numeric-sort" id="th_id_{$th_id}">Nb_reads</th>
{elseif $head == 'median_read_length'}
<th class = "numeric-sort" id="th_id_{$th_id}">Median read length</th>
<th class = "numeric-sort" id="th_id_{$th_id}">Median read_length</th>
{elseif $head == 'median_read_quality'}
<th class = "numeric-sort" id="th_id_{$th_id}">Median read quality</th>
<th class = "numeric-sort" id="th_id_{$th_id}">Median read_quality</th>
{elseif $head == 'N50_read_length'}
<th class = "numeric-sort" id="th_id_{$th_id}">N50 read length</th>
<th class = "numeric-sort" id="th_id_{$th_id}">N50 read_length</th>
{elseif $head == 'L50_read_length'}
<th class = "numeric-sort" id="th_id_{$th_id}">L50 read length</th>
<th class = "numeric-sort" id="th_id_{$th_id}">L50 read_length</th>
{elseif $head == 'barcode_score'}
<th class = "numeric-sort" id="th_id_{$th_id}">Barcode score</th>
<th class = "numeric-sort" id="th_id_{$th_id}">Barcode_score</th>
{elseif $head == 'nb_read_Q>10'}
<th class = "numeric-sort" id="th_id_{$th_id}">Nb reads Q>10</th>
<th class = "numeric-sort" id="th_id_{$th_id}">Nb_reads Q>10</th>
{elseif $head == 'total_bases_Q>10'}
<th class = "numeric-sort" id="th_id_{$th_id}">Total bases Q>10</th>
<th class = "numeric-sort" id="th_id_{$th_id}">Total_bases Q>10</th>
{elseif $head == 'median_yield_per_sec'}
<th class = "numeric-sort" id="th_id_{$th_id}">Median yield per sec</th>
<th class = "numeric-sort" id="th_id_{$th_id}">Median yield_per_sec</th>
{elseif $head == 'nb_actif_channel'}
<th class = "numeric-sort" id="th_id_{$th_id}">Nb actif channel</th>
<th class = "numeric-sort" id="th_id_{$th_id}">Nb actif_channel</th>
{/if}
{$th_id = $th_id +1}
{/foreach}
......@@ -204,42 +203,32 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{foreach from=$analyse_results_sorted key=sample item=sample_results}
{if $sample|in_array:$barcode_name_sample}
<tr>
<td><center><input type="checkbox" id="chk_sample_{$i}" value="sample"/></center></td>
<td id='sample_{$i}_col_1' class="sample_name">{$sample}</td>
{$col_id = 2}
{foreach from=$barcode_headers key=k item=head}
{if $head == 'total_bases'}
<th class = "numeric-sort" id="th_id_{$th_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
{elseif $head == 'nb_reads'}
<th class = "numeric-sort" id="th_id_{$th_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
{elseif $head == 'median_read_length'}
<th class = "numeric-sort" id="th_id_{$th_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
{elseif $head == 'median_read_quality'}
<th class = "numeric-sort" id="th_id_{$th_id}">{($sample_results.$head)|number_format:1:',':' '}</th>
<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:1:',':' '}</th>
{elseif $head == 'N50_read_length'}
<th class = "numeric-sort" id="th_id_{$th_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
{elseif $head == 'L50_read_length'}
<th class = "numeric-sort" id="th_id_{$th_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
{elseif $head == 'barcode_score'}
<th class = "numeric-sort" id="th_id_{$th_id}">{($sample_results.$head)|number_format:1:',':' '}</th>
<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:1:',':' '}</th>
{elseif $head == 'nb_read_Q>10'}
<th class = "numeric-sort" id="th_id_{$th_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
{elseif $head == 'total_bases_Q>10'}
<th class = "numeric-sort" id="th_id_{$th_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
{elseif $head == 'median_yield_per_sec'}
<th class = "numeric-sort" id="th_id_{$th_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
{elseif $head == 'nb_actif_channel'}
<th class = "numeric-sort" id="th_id_{$th_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
{/if}
{$th_id = $th_id +1}
{if $head == 'Reads'}
<td id="sample_{$i}_col_{$col_id}">{$sample_results[$sample].$head|number_format:0:',':' '}</td>
{$totalReads = $totalReads + $sample_results[$sample].$head}
{elseif $head == 'Bases'}
<td id="sample_{$i}_col_{$col_id}">{$sample_results[$sample].$head|number_format:0:',':' '}</td>
{$totalBases = $totalBases + $sample_results[$sample].$head}
<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
{/if}
{$col_id = $col_id + 1}
......@@ -250,7 +239,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{/foreach}
</tbody>
{*
<tfoot>
<tr>
<th>Total : </th>
......@@ -290,8 +279,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</th>
</tr>
</tfoot>
*}
</table>
<br><br>
{/if}
......@@ -369,12 +359,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<li><strong>qscorepertimeintervalsboxplot</strong> :
Boxplots for each barcode of the mean qscore of reads per interval of time for this Flow Cell.
</li>
<li><strong>qscorevariation</strong> :
Variation per time for each barcode of the mean qscore of reads for this Flow Cell.
</li>
{/if}
</ul>
</span>
</div>
{if $barcode_name_count > 1 }
<div class="tx-nG6-pi1-help">
<img src="" alt="" class="img" />
<p>Help for Barcode ONT results :</p>
<span class="meta">
<ul>
<li><strong>Barcode score</strong> :
The quality score of the barcode alignment.
</li>
</ul>
</span>
</div>
{/if}
{/block}
{*
Copyright (C) 2009 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/>.
*}
{extends file='AnalysisTemplate.tpl'}
{block name=params}
{assign var="params" value=" "|explode:$analyse.params}
{foreach from=$analyse_results key=sample item=sample_results}
{assign var="sample" value=$sample}
{/foreach}
<ul>
<li class="parameter"> {$analyse.params} : Reads that contain adapters in the middle will be removed.</li>
</ul>
{/block}
{block name=results_title} Reports {/block}
{block name=results}
{assign var="analyse_results_sorted" value=$analyse_results["ont_sample"]|@ksort}
{assign var="metrics" value=$analyse_results["metrics"]}
{assign var='barcode_headers' value=','|explode:$metrics['barcode'].headers|@ksort}
{assign var='barcode_headers_count' value=$barcode_headers|@count}
{assign var='barcode_name_sample' value=','|explode:$metrics['barcode'].names|@ksort}
{assign var='barcode_name_count' value=$barcode_name_sample|@count}
{assign var='ont_sample_count' value=$analyse_results_sorted|@count}
{assign var='ont_metrics_names' value=','|explode:$metrics['statsporechop'].headers|@ksort}
{assign var='ont_metrics_count' value=$ont_metrics_names|@count}
{*debug*}
<legend>Analyse results report - Sample name : {$descriptions.sample_1}</legend>
<br>
<table id="ont_stats_datatable" class="table table-striped table-bordered dataTable analysis-result-table">
<thead>
<tr>
{assign var="nb_samples" value=$ont_sample_count}
<th class="string-sort" rowspan="2" id="th_id_1"><center>Sample {if $nb_samples > 1 }({$nb_samples}){/if}</center></th>
<th colspan="{$ont_metrics_count}"><center>Trimmed ONT files results</center></th>
</tr>
<tr>
{assign var="th_id" value=2}
{foreach from=$ont_metrics_names key=k item=head}
{if $head == 'read_trim_start'}
<th class = "numeric-sort" id="th_id_{$th_id}">Read_trim_start</th>
{elseif $head == 'read_total_start'}
<th class = "numeric-sort" id="th_id_{$th_id}">Read_total_start</th>
{elseif $head == 'bp_removed_start'}
<th class = "numeric-sort" id="th_id_{$th_id}">Bp_removed_start</th>
{elseif $head == 'read_trim_end'}
<th class = "numeric-sort" id="th_id_{$th_id}">Read_trim_end</th>
{elseif $head == 'read_total_end'}
<th class = "numeric-sort" id="th_id_{$th_id}">Read_total_end</th>
{elseif $head == 'bp_removed_end'}
<th class = "numeric-sort" id="th_id_{$th_id}">Bp_removed_end</th>
{/if}
{$th_id = $th_id +1}
{/foreach}
</tr>
</thead>
<body>
{foreach from=$analyse_results_sorted key=sample item=sample_results}
<tr>
<td id='sample_{$i}_col_1' class="sample_name">{$sample}</td>
{$col_id = 2}
{foreach from=$ont_metrics_names key=k item=head}
{if $head == 'read_trim_start'}
<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
{elseif $head == 'read_total_start'}
<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
{elseif $head == 'bp_removed_start'}
<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
{elseif $head == 'read_trim_end'}
<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
{elseif $head == 'read_total_end'}
<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
{elseif $head == 'bp_removed_end'}
<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
{/if}
{$col_id = $col_id + 1}
{/foreach}
</tr>
{$i = $i + 1}
{/foreach}
</body>
</table>
<div class="tx-nG6-pi1-help">
<img src="" alt="" class="img" />
<p>Help for Trimmed ONT files results :</p>
<span class="meta">
<ul>
<li><strong>read_trim</strong> :
The number of reads trimmed for this sample.
</li>
<li><strong>read_total</strong> :
The total number of reads for this sample.
</li>
<li><strong>bp_removed</strong> :
The number of bases removed for this sample.
</li>
<li><strong>_start</strong> :
Previous metrics from the start of the read.
</li>
<li><strong>_end</strong> :
Previous metrics to the end of the read.
</li>
</ul>
</span>
</div>
{/block}
......@@ -15,6 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import logging
import os
from ng6.ng6workflow import NG6Workflow
from ng6.utils import Utils
......@@ -29,10 +30,10 @@ class OntQualityCheck (NG6Workflow):
def define_parameters(self, function="process"):
logging.getLogger("jflow").debug("Begin OntQualityCheck.define_parameters! ont_qc")
self.add_parameter("compression", "How should the data be compressed once archived", choices= [ "none", "gz", "bz2"], default = "gz")
#self.add_parameter("nb_threads", "Number of threads to use for fastqc. Each thread will be allocated 250MB of memory.", default=6)
#self.add_parameter("nanoplot_color", "Color of nanoplot")
self.add_parameter("nb_threads", "Number of threads to use for porechop (default=16).", default=16)
self.add_parameter("fileformat", "The file format for porechop (default=fastq).", choices= [ "fastq", "fasta"], default = "fastq")
self.add_input_file( "summary_file", "Input summary basecalling file", default=None)
self.add_parameter("barcoded", "", choices= [ "yes", "no"], default = "no")
self.add_parameter("barcoded", "Barcoded run or not", choices= [ "yes", "no"], default = "no")
def process(self):
logging.getLogger("jflow").debug("Begin OntQualityCheck.process! test ont_qc")
......@@ -50,4 +51,5 @@ class OntQualityCheck (NG6Workflow):
addrawfiles = self.add_component("AddRawFiles", [self.runobj, self.get_all_reads(), self.compression])
#nanoplot = self.add_component("Nanoplot", [sample.name,self.get_all_reads(), self.nb_threads, True, "png", self.nanoplot_color,"nanoplot.tar.gz"])
ontstat = self.add_component("Run_stats", [self.summary_file, self.barcoded])
trim_porechop = self.add_component("Trim_porechop", [self.get_all_reads(), self.nb_threads, self.fileformat , "discard_middle"])
......@@ -205,7 +205,7 @@ class Run_stats (Analysis):
group = 'plots_barcode'
metrics.append(group)
self._add_result_element("metrics", "headers", ','.join(["qscoreboxplot", "qscorepertimeintervalsboxplot", "qscorevariation"]), group)
self._add_result_element("metrics", "headers", ','.join(["qscoreboxplot", "qscorepertimeintervalsboxplot"]), group)
if os.path.isfile(os.path.join(self.output_directory, "plot_barcoded_qscoreboxplot.png")):
self._add_result_element(sample, "qscoreboxplot", self._save_file(os.path.join(self.output_directory, "plot_barcoded_qscoreboxplot.png"),
......@@ -217,11 +217,6 @@ class Run_stats (Analysis):
sample + ".barcoded_qscorepertimeintervalsboxplot.png"), group)
results_files.append(os.path.join(self.output_directory, "plot_barcoded_qscorepertimeintervalsboxplot.png"))
if os.path.isfile(os.path.join(self.output_directory, "plot_barcoded_qscorevariation.png")):
self._add_result_element(sample, "qscorevariation", self._save_file(os.path.join(self.output_directory, "plot_barcoded_qscorevariation.png"),
sample + ".barcoded_qscorevariation.png"), group)
results_files.append(os.path.join(self.output_directory, "plot_barcoded_qscorevariation.png"))
# Finaly create and add the archive to the analysis
self._create_and_archive(results_files,self.archive_name)
......
#
# 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, os
from subprocess import Popen, PIPE
import logging
import time
from ng6.analysis import Analysis
from ng6.utils import Utils
from jflow.utils import get_argument_pattern
class Trim_porechop (Analysis):
"""
This module trim the reads from ONT data
"""
def define_parameters(self, fastq_files, nbthreads, formatfile, discard_middle, archivename="porechop_archive"):
self.add_input_file_list( "fastq_files", "fastq_files", default=fastq_files, required=True, file_format = 'fastq')
self.add_parameter("nbthreads", "number of threads to use (default=16)", default=16, type='int')
self.add_parameter("formatfile", "format of the input files", default="fastq", type='str')
self.add_parameter("discard_middle", "discard_middle", default="discard_middle", choices=[ "discard_middle", "do_not_discard_middle"])
self.add_parameter("archive_name", "Name of the archive", default=archivename, type='str')
output_ext = '_trim.'+self.formatfile
self.add_output_file_list( "files_trimmed", "files_trimmed", pattern='{basename_woext}' + output_ext, items=self.fastq_files, file_format = self.formatfile)
self.add_output_file_list("stdouts", "stdouts", pattern='{basename_woext}.stdout', items=self.fastq_files)
def define_analysis(self):
self.name = "TrimPorechop"
self.description = "Trim the reads generated by Albacore and remove ONT adapters"
self.software = "porechop"
if self.discard_middle == "discard_middle":
self.options = "--discard_middle"
def __parse_stat_file (self, stat_file):
logging.getLogger("jflow").debug("Begin Trimporechop.__parse_stat_file! file =",stat_file)
"""
Parse the stat file
@param stat_file : the stdout porechop
@return : {"read_trim_start" : read_trim_start, ...}
"""
read_trim_start = 0
read_total_start = 0
bp_removed_start = 0
read_trim_end = 0
read_total_end = 0
bp_removed_end = 0
while os.stat(stat_file).st_size == 0:
logging.getLogger("jflow").debug("Trimporechop.__parse_stat_file! file empty : "+stat_file)
logging.getLogger("jflow").debug("Trimporechop.__parse_stat_file! spleep 10...")
for line in open(stat_file, "r").readlines():
line = line.strip()
if re.search("(.*) reads had adapters trimmed from their start (.*)", line)!=None:
logging.getLogger("jflow").debug("Trimporechop.__parse_stat_file : line start "+str(line))
read_trim_start = line.split(" ")[0]
read_total_start = line.split(" ")[2]
bp_removed_start = line.split(" ")[10].replace("(","")
if re.search("(.*) reads had adapters trimmed from their end (.*)", line)!=None:
read_trim_end = line.split(" ")[0]
read_total_end = line.split(" ")[2]
bp_removed_end = line.split(" ")[10].replace("(","")
logging.getLogger("jflow").debug("Trimporechop.__parse_stat_file : read_trim_start "+str(read_trim_start))
logging.getLogger("jflow").debug("Trimporechop.__parse_stat_file : read_trim_end "+str(read_trim_end))
logging.getLogger("jflow").debug("End Trimporechop.__parse_stat_file! ")
return [read_trim_start,read_total_start,bp_removed_start,read_trim_end,read_total_end,bp_removed_end]
def post_process(self):
logging.getLogger("jflow").debug("Begin Trimporechop.post_process! ont_qc")
# Create dictionary : key = file name or prefix, value = files path
results_files = []
# add header of stats
group = "statsporechop"
self._add_result_element("metrics", "headers", ','.join(["read_trim_start", "read_total_start", "bp_removed_start", "read_trim_end", "read_total_end", "bp_removed_end"]), group)
print(os.listdir(self.output_directory))
for file in os.listdir(self.output_directory):
full_file_path = os.path.join(self.output_directory, file)
logging.getLogger("jflow").debug("Trimporechop.post_process : full_file_path "+full_file_path)
if file.endswith(".fastq"):
logging.getLogger("jflow").debug("Trimporechop.post_process match .fastq : full_file_path "+full_file_path)
results_files.append(full_file_path)
elif file.endswith(".stdout"):
logging.getLogger("jflow").debug("Trimporechop.post_process match .stdout: full_file_path "+full_file_path)
results_files.append(full_file_path)
filename = os.path.basename(file).split(".stdout")[0]
resultlist = self.__parse_stat_file(full_file_path)
read_trim_start = resultlist[0]
read_total_start = resultlist[1]
bp_removed_start = resultlist[2]
read_trim_end = resultlist[3]
read_total_end = resultlist[4]
bp_removed_end = resultlist[5]
#add stats for each fastq file
self._add_result_element("ont_sample", "read_trim_start", read_trim_start,filename)
self._add_result_element("ont_sample", "read_total_start", read_total_start,filename)
self._add_result_element("ont_sample", "bp_removed_start", bp_removed_start,filename)
self._add_result_element("ont_sample", "read_trim_end", read_trim_end,filename)
self._add_result_element("ont_sample", "read_total_end", read_total_end,filename)
self._add_result_element("ont_sample", "bp_removed_end", bp_removed_end,filename)
#Finaly create and add the archive to the analysis
self._create_and_archive(results_files,self.archive_name)
logging.getLogger("jflow").debug("End Trimporechop.post_process! ")
def get_version(self):
#os.system("module load bioinfo/Porechop-0.2.1")
cmd = [self.get_exec_path("porechop"), "--version"]
p = Popen(cmd, stdout=PIPE, stderr=PIPE)
stdout, stderr = p.communicate()
return stdout
def process(self):
logging.getLogger("jflow").debug("Begin Trimporechop.process! ont_qc")
for output_pos,output in enumerate(self.stdouts):
file_group = []
# Set prefix
reg = re.search("(.+).stdout$", output)
basename = os.path.basename(reg.group(1))
# Build fastq list for sample read
for file in self.fastq_files:
if (os.path.basename(file)) == basename+"."+self.formatfile :
file_group.append(file)
# Create cmd
[cmd_inputs_pattern, next_arg_number] = get_argument_pattern(file_group, 0)
self.add_shell_execution(self.get_exec_path("porechop") +" " + self.options + " --input ${" + str(next_arg_number) + "} --output ${" + str(next_arg_number+1) + "} --format " + self.formatfile + " --threads " + str(self.nbthreads) + " > " +" ${" + str(next_arg_number+2) + "}",
cmd_format='{EXE} {IN} {OUT}' ,
map=False,
inputs = file_group,
outputs = [self.files_trimmed[output_pos],self.stdouts[output_pos]])
#archive = self.output_directory + '/' + self.archive_name + '.tar.gz'
#self.add_shell_execution('tar -czf $1 ' + self.output_directory + '/' + '*_trim.fastq ', cmd_format='{EXE} {OUT}', map=False, outputs = archive)
logging.getLogger("jflow").debug("End Trimporechop.process! ")
Markdown is supported
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