Skip to content

Commit

Permalink
remove spurious snps and indels by adding minimum read depth filter
Browse files Browse the repository at this point in the history
  • Loading branch information
dpark01 committed Jun 21, 2020
1 parent 56751cf commit 68e8900
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions pipes/WDL/tasks/tasks_assembly.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -679,17 +679,21 @@ task run_discordance {
# bcftools call snps while treating each RG as a separate sample
bcftools mpileup \
-G readgroups.txt -d 10000 -a "FORMAT/AD" -q 1 -m 2 -Ou \
-G readgroups.txt -d 10000 -a "FORMAT/DP,FORMAT/AD" \
-q 1 -m 2 -Ou \
-f "${reference_fasta}" "${reads_aligned_bam}" \
| bcftools call \
-m --ploidy 1 \
--threads `nproc` \
-P 0 -m --ploidy 1 \
--threads $(nproc) \
-Ov -o everything.vcf
# mask all GT calls when less than 3 reads
cat everything.vcf | bcftools filter -e 'FMT/DP<3' -S . > filtered.vcf
cat filtered.vcf | bcftools filter -i 'MAC>0' > "${out_basename}.discordant.vcf"
# tally outputs
set +o pipefail # to handle empty grep
cat everything.vcf | bcftools filter -i 'MAC=0' | grep -v '^#' | wc -l | tee num_concordant
cat everything.vcf | bcftools filter -i 'MAC>0' > "${out_basename}.discordant.vcf"
cat filtered.vcf | bcftools filter -i 'MAC=0' | grep -v '^#' | wc -l | tee num_concordant
cat "${out_basename}.discordant.vcf" | bcftools filter -i 'TYPE="snp"' | grep -v '^#' | wc -l | tee num_discordant_snps
cat "${out_basename}.discordant.vcf" | bcftools filter -i 'TYPE!="snp"' | grep -v '^#' | wc -l | tee num_discordant_indels
}
Expand Down
2 changes: 1 addition & 1 deletion test/input/WDL/test_outputs-assemble_refbased-local.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"assemble_refbased.assembly_length_unambiguous": 18889,
"assemble_refbased.assembly_length": 18889,
"assemble_refbased.replicate_discordant_indels": 0,
"assemble_refbased.replicate_discordant_snps": 7
"assemble_refbased.replicate_discordant_snps": 0
}

0 comments on commit 68e8900

Please sign in to comment.