From 626fded75d60c008c86210ae726fd7b8cdbca3d7 Mon Sep 17 00:00:00 2001 From: Nick Semenkovich Date: Wed, 1 Feb 2023 10:34:01 -0600 Subject: [PATCH] Set LC_ALL=C for entire QC script Improves performance a bit for awk/sort, etc. --- scripts/QC.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/QC.sh b/scripts/QC.sh index 070e874..f5263f8 100644 --- a/scripts/QC.sh +++ b/scripts/QC.sh @@ -45,6 +45,8 @@ ################################################################################ set -euo pipefail +# Improves sort/awk performance +export LC_ALL=C # Check for biscuit, samtools, bedtools, awk in PATH function check_path { @@ -134,10 +136,10 @@ function biscuitQC { if [[ "${run_cov_qc}" == true ]]; then # Create genomecov_all, genomecov_q40, genomecov_all_dup, genomecov_q40_dup # Spawn these to the background - bedtools genomecov -bga -split -ibam ${in_bam} | LC_ALL=C sort -k1,1 -k2,2n -T ${outdir} > ${outdir}/${sample}_genomecov_all.tmp.bed & - samtools view -q 40 -b ${in_bam} | bedtools genomecov -bga -split -ibam stdin | LC_ALL=C sort -k1,1 -k2,2n -T ${outdir} > ${outdir}/${sample}_genomecov_q40.tmp.bed & - samtools view -f 0x400 -b ${in_bam} | bedtools genomecov -bga -split -ibam stdin | LC_ALL=C sort -k1,1 -k2,2n -T ${outdir} > ${outdir}/${sample}_genomecov_all_dup.tmp.bed & - samtools view -f 0x400 -q 40 -b ${in_bam} | bedtools genomecov -bga -split -ibam stdin | LC_ALL=C sort -k1,1 -k2,2n -T ${outdir} > ${outdir}/${sample}_genomecov_q40_dup.tmp.bed & + bedtools genomecov -bga -split -ibam ${in_bam} | sort -k1,1 -k2,2n -T ${outdir} > ${outdir}/${sample}_genomecov_all.tmp.bed & + samtools view -q 40 -b ${in_bam} | bedtools genomecov -bga -split -ibam stdin | sort -k1,1 -k2,2n -T ${outdir} > ${outdir}/${sample}_genomecov_q40.tmp.bed & + samtools view -f 0x400 -b ${in_bam} | bedtools genomecov -bga -split -ibam stdin | sort -k1,1 -k2,2n -T ${outdir} > ${outdir}/${sample}_genomecov_all_dup.tmp.bed & + samtools view -f 0x400 -q 40 -b ${in_bam} | bedtools genomecov -bga -split -ibam stdin | sort -k1,1 -k2,2n -T ${outdir} > ${outdir}/${sample}_genomecov_q40_dup.tmp.bed & wait_for_jobs