diff --git a/bin/concatenateVCFs.sh b/bin/concatenateVCFs.sh index b9672abf17..7751d02719 100755 --- a/bin/concatenateVCFs.sh +++ b/bin/concatenateVCFs.sh @@ -84,15 +84,16 @@ then tail -n +$((L+1)) ${vcf} done done - ) | bgzip -@${cpus} > rawcalls.vcf.gz - tabix rawcalls.vcf.gz + ) | bgzip -@${cpus} > rawcalls.unsorted.vcf.gz else VCF=$(ls no_intervals*.vcf) - cp $VCF rawcalls.vcf - bgzip -@${cpus} rawcalls.vcf - tabix rawcalls.vcf.gz + cp $VCF rawcalls.unsorted.vcf + bgzip -@${cpus} rawcalls.unsorted.vcf fi +bcftools sort rawcalls.unsorted.vcf.gz | bgzip > rawcalls.vcf.gz +tabix -p vcf rawcalls.vcf.gz + set +u # Now we have the concatenated VCF file, check for WES/panel targets, and generate a subset if there is a BED provided @@ -102,5 +103,5 @@ if [ ! -z ${targetBED+x} ]; then tabix ${outputFile}.gz else # Rename the raw calls as WGS results - for f in rawcalls*; do mv -v $f ${outputFile}${f#rawcalls.vcf}; done + for f in rawcalls.vcf*; do mv -v $f ${outputFile}${f#rawcalls.vcf}; done fi