Skip to content
Snippets Groups Projects
Commit 97e72a8b authored by Gervaise Henry's avatar Gervaise Henry :cowboy:
Browse files

Nextflow-ify bash command to extract median read length

parent 172d3212
Branches
Tags
2 merge requests!37v0.0.1,!36Metadata output update
Pipeline #7779 failed with stages
in 2 minutes and 21 seconds
......@@ -299,14 +299,14 @@ process trimData {
if [ "${ends}" == "se" ]
then
trim_galore --gzip -q 25 --illumina --length 35 --basename ${repRID} -j `nproc` ${fastq[0]}
readLength=\$(zcat *_trimmed.fq.gz | awk '\{if(NR%4==2) print length(\${1})}' | sort -n | awk '\{a[NR]=$0}END\{print(NR%2==1)?a[int(NR/2)+1]:(a[NR/2]+a[NR/2+1])/2}')
readLength=\$(zcat *_trimmed.fq.gz | awk '{if(NR%4==2) print length(\${1})}' | sort -n | awk '{a[NR]=$0}END{print(NR%2==1)?a[int(NR/2)+1]:(a[NR/2]+a[NR/2+1])/2}')
elif [ "${ends}" == "pe" ]
then
trim_galore --gzip -q 25 --illumina --length 35 --paired --basename ${repRID} -j `nproc` ${fastq[0]} ${fastq[1]}
readLength=\$(zcat *_1.fq.gz | awk '\{if(NR%4==2) print length(\${1})}' | sort -n | awk '\{a[NR]=$0}END\{print(NR%2==1)?a[int(NR/2)+1]:(a[NR/2]+a[NR/2+1])/2}')
readLength=\$(zcat *_1.fq.gz | awk '{if(NR%4==2) print length(\${1})}' | sort -n | awk '{a[NR]=$0}END{print(NR%2==1)?a[int(NR/2)+1]:(a[NR/2]+a[NR/2+1])/2}')
fi
echo -e "LOG: trimmed" >> ${repRID}.trimData.log
echo -e "LOG: average trimmed read length: /${readLength}" >> ${repRID}.trimData.log
echo -e "LOG: average trimmed read length: \${readLength}" >> ${repRID}.trimData.log
# save read length file
echo -e "\${readLength}" > readLength.csv
......
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