Commit f254bdb7 authored by Celine Noirot's avatar Celine Noirot
Browse files

Handle trimgalore with cutadapt 1.7 and cutadapt 1.8

parent 6b93c98c
......@@ -64,7 +64,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<th class="numeric-sort" >Nb bases</th>
<th class="numeric-sort" >Nb trimmed bases by qual</th>
<th class="numeric-sort" >Nb trimmed bases</th>
<th class="numeric-sort" >Nb reads too short</th>
{if 'too_short_reads'|array_key_exists:$analyse_results[key($analyse_results)]["default"] }
<th class="numeric-sort" >Nb reads too short</th>
{/if}
{if $is_paired }
<th >Nb pairs removed</th>
{/if}
......@@ -100,13 +105,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<td>{$sample_results["default"].total_reads|number_format:0:' ':' '}</td>
<td>{$sample_results["default"].trimmed_reads|number_format:0:' ':' '}</td>
<td>{$sample_results["default"].total_bases|number_format:0:' ':' '}</td>
{if 'qual_trimmed_bases'|array_key_exists:$sample_results["default"] }
{if $sample_results["default"].qual_trimmed_bases }
<td >{$sample_results["default"].qual_trimmed_bases|number_format:0:' ':' '}</td>
{else}
<td >-</td>
{/if}
<td>{$sample_results["default"].trimmed_bases|number_format:0:' ':' '}</td>
<td>{$sample_results["default"].too_short_reads|number_format:0:' ':' '}</td>
{if 'too_short_reads'|array_key_exists:$sample_results["default"] }
<td >{$sample_results["default"].too_short_reads|number_format:0:' ':' '}</td>
{/if}
{if $is_paired }
{if 'pairs_removed'|array_key_exists:$sample_results["default"] }
<td >{$sample_results["default"].pairs_removed|number_format:0:' ':' '}</td>
......@@ -132,27 +140,31 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<th>{$total_reads|number_format:0:' ':' '}</th>
<th>{($total_reads - $trimmed_reads)|number_format:0:' ':' '}</th>
{if ! $is_old_version}
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
{/if}
{if 'too_short_reads'|array_key_exists:$analyse_results[key($analyse_results)]["default"] }
<th></th>
{/if}
{if $is_paired }
<th></th>
{/if}
</tr>
<tr>
<th>Mean</th>
<th>{($total_reads/($analyse_results|@count))|number_format:0:' ':' '}</th>
<th>{(($total_reads - $trimmed_reads)/($analyse_results|@count))|number_format:0:' ':' '}</th>
{if ! $is_old_version}
<th></th>
<th></th>
<th></th>
<th></th>
{/if}
<th></th>
<th></th>
<th></th>
{/if}
{if 'too_short_reads'|array_key_exists:$analyse_results[key($analyse_results)]["default"] }
<th></th>
{/if}
{if $is_paired }
<th></th>
{/if}
......
......@@ -115,10 +115,12 @@ class TrimGalore (Analysis):
Parse the data file
@param data_file : the trim_galore report file
@return : {"nbseq" : x, ...}
"""
stats = {}
#Trimgalore can use cutadapt 1.7 or 1.8
for line in open(report_file, 'r').readlines():
#cutadapt 1.7
if line.startswith(" Processed reads:"):
stats["total_reads"] = line.strip().split()[-1]
if line.startswith(" Processed bases:"):
......@@ -131,6 +133,20 @@ class TrimGalore (Analysis):
stats["trimmed_bases"] = line.strip().split()[-7]
if line.startswith(" Too short reads"):
stats["too_short_reads"] = line.strip().split()[-5]
#cutadapt 1.8
if line.startswith("Total reads processed:"):
stats["total_reads"] = line.strip().split()[-1].replace(",","")
if line.startswith("Total basepairs processed:"):
stats["total_bases"] = int(line.strip().split()[-2].replace(",",""))
if line.startswith("Reads with adapters:"):
stats["trimmed_reads"] = line.strip().split()[-2].replace(",","")
if line.startswith("Quality-trimmed:"):
stats["qual_trimmed_bases"] = line.strip().split()[-3].replace(",","")
if line.startswith("Total written (filtered):"):
stats["trimmed_bases"] = stats["total_bases"]-int(line.strip().split()[-3].replace(",",""))
#trimgalore values
if line.startswith("Number of sequence pairs removed because at least"):
stats["pairs_removed"] = line.strip().split()[-2]
if line.startswith("RRBS reads trimmed by additional 2 bp when adapter contamination was detected:"):
......
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