Check for end bias using pileup output
samtools mpileup offers a way to summarize sequencing reads
at a locus. One form of artifact for variant-calling is end-bias
or variant-distance-bias where the position of the variant base in
the reads supporting the variant allele follows a different distribution
than the reference allele. Usually these bases are towards the beginning
or end of the read instead of being uniformly distributed along the
length of the read. One way to quantify this is by using a rank-sum
test between the positions supporting the reference-allele and the positions
supporting the variant-allele, samtools does this!
I wrote a simple script that will parse the output of samtools mpileup and
tell you what proportion of the mismatch sites are at the absolute ends of
the reads. The script is here.
A couple of example lines of output from the script are below,
chr pos total_depth n_total_mismatches n_end_mismatches n_end_mismatches/n_total_mismatches end_mismatch_pileup
17 17124895 97 4 3 0.75 ['^~T', '^~T', '^~T']
X 132834046 58 4 4 1.0 ['^~T', '^~T', '^~T', '^~T']
9 135786025 42 4 3 0.75 ['^~T', '^~T', '^~T']
11 5255575 3389 95 88 0.926315789474 ['$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A ', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A', '$A ', '$A', '$A', '$A', '$A', '$A', '$A', '$A']
The columns are pretty self-explanatory I hope.