diff qiime2/qiime_dada2_denoise-paired.xml @ 6:de4c22a52df4 draft

Fixes
author florianbegusch
date Tue, 13 Aug 2019 07:46:48 -0400
parents 370e0b6e9826
children f190567fe3f6
line wrap: on
line diff
--- a/qiime2/qiime_dada2_denoise-paired.xml	Mon Aug 05 01:29:30 2019 -0400
+++ b/qiime2/qiime_dada2_denoise-paired.xml	Tue Aug 13 07:46:48 2019 -0400
@@ -5,24 +5,88 @@
 		<requirement type="package" version="2019.4">qiime2</requirement>
 	</requirements>
 	<command><![CDATA[
+
+#def parse_file(file):
+	#import csv
+	#set $read = csv.reader(open($file, "r"))
+	#set $qc = 0
+	#for l in $read:
+	#if "50%" in l:
+	#set $num = 0.0
+	#for i in l[1:]:
+	#if float(i) <= 25.0
+	#set $num = i
+	#set $qc = l.index($num) - 1
+	#break
+	#end if
+	#end for
+	#end if
+#end for
+#return $qc
+#end def
+
+#def find_QC(file):
+	#set $f_file_path=str(file).split(".dat")[0] + '_files/forward-seven-number-summaries.csv'
+	#set $r_file_path=str(file).split(".dat")[0] + '_files/reverse-seven-number-summaries.csv'
+	#set $qc_f = $parse_file($f_file_path)
+	#set $qc_r = $parse_file($r_file_path)
+	#return $qc_f, $qc_r
+#end def
+
+#def find_adapters(mapping_fp):
+	#import csv
+	#set $forward = 0
+	#set $reversed = 0
+	#set $reader = csv.reader(open(str(mapping_fp)), delimiter='\t')
+	#for row in $reader:
+	#if "#" not in str(row[0]):
+	#set $forward = len(row[2])
+	#set $reversed = len(row[3])
+	#break
+	#end if
+	#end for
+#return int($forward), int($reversed)
+#end def
+
+#if str($mapping_fp) != 'None' and (int($ptrimleftf) == -1 or int($ptrimleftr) == -1):
+	#set $both_adapters = $find_adapters($mapping_fp)
+	#set $ptrimleftf=$both_adapters[0]
+	#set $ptrimleftr=$both_adapters[1]
+#end if
+
+#if str($sum_fp) != 'None' and (int($ptrunclenf) == -1 or int($ptrunclenr) == -1):
+	#set $both_qc = $find_QC($sum_fp)
+	#set $ptrunclenf=$both_qc[0]
+	#set $ptrunclenr=$both_qc[1]
+#end if
+
+
 qiime dada2 denoise-paired
 
 --i-demultiplexed-seqs=$idemultiplexedseqs
---p-trunc-len-f="$ptrunclenf"
---p-trunc-len-r="$ptrunclenr"
-#if $ptrimleftf:
+
+
+#if str($ptrunclenf):
+ --p-trunc-len-f="$ptrunclenf"
+#end if
+
+#if str($ptrunclenf):
+ --p-trunc-len-r="$ptrunclenr"
+#end if
+
+#if str($ptrimleftf):
  --p-trim-left-f=$ptrimleftf
 #end if
 
-#if $ptrimleftr:
+#if str($ptrimleftr):
  --p-trim-left-r=$ptrimleftr
 #end if
 
-#if $pmaxee:
+#if str($pmaxee):
  --p-max-ee=$pmaxee
 #end if
 
-#if $ptruncq:
+#if str($ptruncq):
  --p-trunc-q=$ptruncq
 #end if
 
@@ -30,7 +94,7 @@
  --p-chimera-method=$pchimeramethod
 #end if
 
-#if $pminfoldparentoverabundance:
+#if str($pminfoldparentoverabundance):
  --p-min-fold-parent-over-abundance=$pminfoldparentoverabundance
 #end if
 
@@ -41,7 +105,7 @@
 #end if
 
 
-#if $pnreadslearn:
+#if str($pnreadslearn):
  --p-n-reads-learn=$pnreadslearn
 #end if
 
@@ -58,6 +122,9 @@
 cp odenoisingstats.qza $odenoisingstats
 	]]></command>
 	<inputs>
+		<param format="tabular" label="Mapping file where 3rd and 4th columns must be forward and reverse primers respectively" name="mapping_fp" optional="True" type="data"/>
+		<param format="html" label="Summary file" name="sum_fp" optional="True" type="data"/>
+
 		<param format="qza,no_unzip.zip" label="--i-demultiplexed-seqs: ARTIFACT SampleData[PairedEndSequencesWithQuality] The paired-end demultiplexed sequences to be denoised.                                  [required]" name="idemultiplexedseqs" optional="False" type="data"/>
 		<param label="--p-trunc-len-f: INTEGER Position at which forward read sequences should be truncated due to decrease in quality. This truncates the 3' end of the of the input sequences, which will be the bases that were sequenced in the last cycles. Reads that are shorter than this value will be discarded. After this parameter is applied there must still be at least a 20 nucleotide overlap between the forward and reverse reads. If 0 is provided, no truncation or length filtering will be performed [required]" name="ptrunclenf" optional="False" value="" type="integer"/>
 		<param label="--p-trunc-len-r: INTEGER Position at which reverse read sequences should be truncated due to decrease in quality. This truncates the 3' end of the of the input sequences, which will be the bases that were sequenced in the last cycles. Reads that are shorter than this value will be discarded. After this parameter is applied there must still be at least a 20 nucleotide overlap between the forward and reverse reads. If 0 is provided, no truncation or length filtering will be performed [required]" name="ptrunclenr" optional="False" value="" type="integer"/>