I produced a bam file by aligning reads to a small set of synthetic sequences using bwa-mem.
I am heavily filtering reads that are not paired and of a certain orientation. Applying the filtering, I get a few thousands of reads:
samtools view -h $myfilebam | \
samtools view -h -F4 - | \
samtools view -h -F8 - | \
samtools view -h -F256 - | \
samtools view -h -F512 - | \
samtools view -h -F1024 - | \
samtools view -h -F2048 - | \
samtools view -h -f16 - | \
samtools view -h -f32 - | wc -l
Gives me 89502
reads.
If I then pipe this into samtools mpileup
, I get no results:
samtools view -h $myfilebam | \
samtools view -h -F4 - | \
samtools view -h -F8 - | \
samtools view -h -F256 - | \
samtools view -h -F512 - | \
samtools view -h -F1024 - | \
samtools view -h -F2048 - | \
samtools view -h -f16 - | \
samtools view -h -f32 - | \
samtools mpileup --excl-flags 0 -Q0 -B -d 999999 - | wc -l
Returns 0.
I tried different combinations of filtering, and when I do both -f 16
and -f 32
returns empty, but if I do either of those, then it works:
samtools view -h $myfilebam | \
samtools view -h -F4 - | \
samtools view -h -F8 - | \
samtools view -h -F256 - | \
samtools view -h -F512 - | \
samtools view -h -F1024 - | \
samtools view -h -F2048 - | \
samtools view -h -f16 - | \
samtools mpileup --excl-flags 0 -Q0 -B -d 999999 - | wc -l
Returns 1056
.
Any ideas why? My thinking was that it would work with --excl-flags 0
.
EDIT: substituting mpileup
for depth
does work, and prints out each position and the depth as expected.
EDIT2: adding -q 0
to mpileup
gives the same empty result.
Thanks in advance
-f 16
combined with-f 32
(btw, you can just-f 48
and skip the piping) are filtering for discordant reads? What happens if you add-q 0
to mpileup? $\endgroup$depth
andmpileup
share a fair bit of code, I have to wonder if you simply have no variants there. What happens if you specify-a
and filter out the positions with no coverage? $\endgroup$printf()
s in the samtools code that could probably be used to track down what's actually happening here. $\endgroup$