This is a test version of Biostars. For the public version, visit https://www.biostars.org.
SNPs coordinates for each read

Hi all. I need to find the coordinates for every point mutation for EACH READ in a bam file. The coordinates should be expressed as both (1) the position of the mutation in relation to the read length and (2) the position of the mutation in relation to the chromosome coordinates.

Also, for each point mutation I need to output the reference base pair and the mutated base pair.

Samtools mpileup outputs interesting info, but I would need them for EACH READ rather than piling up reads at a single genomic position.

Would you suggest to write my own script or are there already functions I can use?

Thank you.

snps mutation coordinate bam read

2 answers

I wrote sam2tsv http://lindenb.github.io/jvarkit/Sam2Tsv.html

Thank you for for quick reply! Very nice software you made. Could you please explain me why you used the CIGAR the rater than the MD tag? Thanks!

I don't know why you would want to do this, but it should be easy once you have the BAM and the list of variant positions

1) call variants to get a list of a variant positions 2) Filter the bam to keep all reads that overlap any variant 3) write a little script to parse each read to find the mutation position relative to that read, given that you already know the genomic position and the alternate allele

Log in to answer this question.