Biology Stack Exchange is a question and answer site for biology researchers, academics, and students. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I display a single nucleotide position from reads in a BAM file? I have been looking at variation using samtools mpileup, but I want to actually just display the nucleotide at the position I am interested in. This seems like you should be able to do it but I can't figure out how.

To be clear I have a BAM file of a bunch of reads. I'm looking to do something like samtools magic reads.bam chr3:10000 where I get back something like:

T T T T T T T T T T T T T T T T T T T A A A A A A A A A A A A A.

I just want to sanity check the output of bcftools by actually looking at the base calls.

share|improve this question
up vote 3 down vote accepted

Your best option is to create a tab delimited position list file:

chr3    1000

You can then use the samtools mpileup -l pos.txt option

-l FILE      list of positions (chr pos) or regions (BED)

This file can also be in bed format if you are interested in specific regions

share|improve this answer
Thanks! This worked great, just what I was looking for. – rory Feb 27 '12 at 22:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.