Question: Nucletotide distribution, at each position, in a .sam/.bam file ?
gravatar for remi.maglione
4.9 years ago by
remi.maglione10 wrote:


i'm trying to extract the nucleotide distribution, for each position, from a .sam/.bam file ?!

I don't look for the total depth of coverage (that can be done with GATK or samtools), but the depth of coverage for each nucleotide, at each position in my alignment file (bam/sam/...)

How can i do that ?

Do you know a tools that can do that ?

Thanks in advance for any answer/suggestion,


ADD COMMENTlink modified 3.2 years ago by Zaag720 • written 4.9 years ago by remi.maglione10

duplicate of Coverage In Bam File - Bases And Overall Count

ADD REPLYlink written 4.9 years ago by Pierre Lindenbaum120k
gravatar for dariober
4.9 years ago by
WCIP | Glasgow | UK
dariober10k wrote:

Have a look at pysamstat executed as:

pysamstats -f ref.fa --type variation_strand aln.bam > aln.var.txt

It will give the count of A, C, G, T, insertions and deletions at each position in the reference (is this what you are after?).

If you want to parse the 5th column of samtools mpileup yourself take care that it contains also the mapping qualities and the sequence of insertions and deletions. So just counting the occurrences of ACTG will give slightly incorrect results (I think the answer Pierre links to has this problem).

ADD COMMENTlink written 4.9 years ago by dariober10k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 836 users visited in the last hour