Skip to content
Snippets Groups Projects
Commit 484d48ed authored by Gervaise Henry's avatar Gervaise Henry 🤠
Browse files

Nextflow-ify bash command to extract median read length

parent 97e72a8b
2 merge requests!37v0.0.1,!36Metadata output update
Pipeline #7780 failed with stages
in 14 minutes and 23 seconds
This commit is part of merge request !36. Comments created here will be created in the context of that merge request.
......@@ -299,11 +299,11 @@ 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
......@@ -317,7 +317,7 @@ process trimData {
readLengthInfer = Channel.create()
inferMetadata_readLength.splitCsv(sep: ",", header: false).separate(
readLengthInfer
}
)
// Replicate trimmed fastq's
......
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