Skip to content

Commit 68e8900

Browse files
committed
remove spurious snps and indels by adding minimum read depth filter
1 parent 56751cf commit 68e8900

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

pipes/WDL/tasks/tasks_assembly.wdl

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -679,17 +679,21 @@ task run_discordance {
679679
680680
# bcftools call snps while treating each RG as a separate sample
681681
bcftools mpileup \
682-
-G readgroups.txt -d 10000 -a "FORMAT/AD" -q 1 -m 2 -Ou \
682+
-G readgroups.txt -d 10000 -a "FORMAT/DP,FORMAT/AD" \
683+
-q 1 -m 2 -Ou \
683684
-f "${reference_fasta}" "${reads_aligned_bam}" \
684685
| bcftools call \
685-
-m --ploidy 1 \
686-
--threads `nproc` \
686+
-P 0 -m --ploidy 1 \
687+
--threads $(nproc) \
687688
-Ov -o everything.vcf
688689
690+
# mask all GT calls when less than 3 reads
691+
cat everything.vcf | bcftools filter -e 'FMT/DP<3' -S . > filtered.vcf
692+
cat filtered.vcf | bcftools filter -i 'MAC>0' > "${out_basename}.discordant.vcf"
693+
689694
# tally outputs
690695
set +o pipefail # to handle empty grep
691-
cat everything.vcf | bcftools filter -i 'MAC=0' | grep -v '^#' | wc -l | tee num_concordant
692-
cat everything.vcf | bcftools filter -i 'MAC>0' > "${out_basename}.discordant.vcf"
696+
cat filtered.vcf | bcftools filter -i 'MAC=0' | grep -v '^#' | wc -l | tee num_concordant
693697
cat "${out_basename}.discordant.vcf" | bcftools filter -i 'TYPE="snp"' | grep -v '^#' | wc -l | tee num_discordant_snps
694698
cat "${out_basename}.discordant.vcf" | bcftools filter -i 'TYPE!="snp"' | grep -v '^#' | wc -l | tee num_discordant_indels
695699
}

test/input/WDL/test_outputs-assemble_refbased-local.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
"assemble_refbased.assembly_length_unambiguous": 18889,
1010
"assemble_refbased.assembly_length": 18889,
1111
"assemble_refbased.replicate_discordant_indels": 0,
12-
"assemble_refbased.replicate_discordant_snps": 7
12+
"assemble_refbased.replicate_discordant_snps": 0
1313
}

0 commit comments

Comments
 (0)