7.7 years ago by
Depending on your variant caller, you may have this information available with your SNP calls. For samtools' mpileup + bcftools view commands, for instance, values close to what you want are reported in the I16 tag of the VCF output (http://samtools.sourceforge.net/mpileup.shtml) with some minor calculations. Specifically, the sum of the tail distances is reported and dividing by the number of reads would give you the average distance. The number of non-reference reads on each strand is also reported (I realize this is not exactly what you are looking for).
That said, we use the bam-readcount program (fair disclosure, I am one of the authors) to calculate these values for lists of SNPs and use the downstream results for filtering. For each position you request, it will report various summary metrics for each base as a colon delimited list. If you know your SNP base then you can grab the appropriate values. It is not well documented on the web yet, but if you clone and compile it (from https://github.com/genome/bam-readcount) you can get usage by running it with no options.
The output format is as so:
An example of some output (at a homozygous variant position):
$ bam-readcount -q 30 -b 7 -f reference.fa some.bam 19:301238-301238