comparison wrapper.sh @ 7:18ede27dc6b0 draft

Uploaded
author davidvanzessen
date Tue, 04 Nov 2014 08:59:34 -0500
parents 35b55f1c0c59
children cd56ce86c4bf
comparison
equal deleted inserted replaced
6:6b348d07da49 7:18ede27dc6b0
36 echo "trim_end = ${trim_end[@]}" 36 echo "trim_end = ${trim_end[@]}"
37 37
38 workdir=$PWD 38 workdir=$PWD
39 cd $outDir 39 cd $outDir
40 echo "$3" 40 echo "$3"
41 result=`$dir/sff2fastq $input | $dir/fastx_barcode_splitter.pl --bcfile $outDir/barcodes.txt --prefix "$prefix" --suffix ".fastq" --$EOL --mismatches $mismatches --partial $partial` 41 filetype=`file $input`
42 result=""
43 if [[ $filetype == *ASCII* ]]
44 then
45 result=`cat $input | $dir/fastx_barcode_splitter.pl --bcfile $outDir/barcodes.txt --prefix "$prefix" --suffix ".fastq" --$EOL --mismatches $mismatches --partial $partial`
46 else
47 result=`$dir/sff2fastq $input | $dir/fastx_barcode_splitter.pl --bcfile $outDir/barcodes.txt --prefix "$prefix" --suffix ".fastq" --$EOL --mismatches $mismatches --partial $partial`
48 fi
49
42 echo "$result" | tail -n +2 | sed 's/\t/,/g' > output.txt 50 echo "$result" | tail -n +2 | sed 's/\t/,/g' > output.txt
43 echo "<html><head><title>$name demultiplex</title></head><body><table border='1'><thead><tr><th>ID</th><th>Count</th><th>FASTQ</th><th>FASTA</th><th>Trimmed FASTA</th><th>FASTQC</th></tr></thead><tbody>" >> $output 51 echo "<html><head><title>$name demultiplex</title></head><body><table border='1'><thead><tr><th>ID</th><th>Count</th><th>FASTQ</th><th>FASTA</th><th>Trimmed FASTA</th><th>FASTQC</th></tr></thead><tbody>" >> $output
44 while IFS=, read barcode count location 52 while IFS=, read barcode count location
45 do 53 do
46 if [ "total" == "$barcode" ] 54 if [ "total" == "$barcode" ]
54 cat $file.fastq | awk 'NR%4==1{printf ">%s\n", substr($0,2)}NR%4==2{print}' > $file.fasta 62 cat $file.fastq | awk 'NR%4==1{printf ">%s\n", substr($0,2)}NR%4==2{print}' > $file.fasta
55 python $dir/trim.py --input $file.fasta --output ${file}_trimmed.fasta --start ${trim_start[$barcode]} --end ${trim_end[$barcode]} 63 python $dir/trim.py --input $file.fasta --output ${file}_trimmed.fasta --start ${trim_start[$barcode]} --end ${trim_end[$barcode]}
56 echo "<tr><td>$barcode</td><td>$count</td><td><a href='$file.fastq'>$file.fastq</a></td><td><a href='$file.fasta'>$file.fasta</a></td><td><a href='${file}_trimmed.fasta'>${file}_trimmed.fasta</a></td><td><a href='${name}_${barcode}_fastqc.html'>Report</a></td></tr>" >> $output 64 echo "<tr><td>$barcode</td><td>$count</td><td><a href='$file.fastq'>$file.fastq</a></td><td><a href='$file.fasta'>$file.fasta</a></td><td><a href='${file}_trimmed.fasta'>${file}_trimmed.fasta</a></td><td><a href='${name}_${barcode}_fastqc.html'>Report</a></td></tr>" >> $output
57 done < output.txt 65 done < output.txt
58 echo "</tbody></body></html>" >> $output 66 echo "</tbody></body></html>" >> $output
67
68 :'
69 mids = "mid\tforward\treverse"
70 fal = "file with sequenses on single line (no multiline)"
71 for mid in mids:
72 forwardmids = len([x for x in fal if re.match("^" + mid[1], x)])
73 reversemids = len([x for x in fal if re.match(mid[2] + "$", x)])
74 both = len([x for x in fal if re.match("^" + mid[1] + ".*" + mid[2] + "$", x)])
75 if (forwardmids + reversemids + both) > 0:
76 print "%s: %d - %d - %d" % (mid[0], forwardmids, reversemids, both)
77 '