This is a test version of Biostars. For the public version, visit https://www.biostars.org.
samtools : print single columns at position

How can I print only 1 column from a BAM file at specific coordinate.

For example:

ACGTGACGGACGGGGCCA
   TGACGGACGGGGCCA
       GGACGGGGCCA
         ^

For example print the column at coord 'x' will return AAA (see example above)

print position samtools

1 answer

Maybe something like this?

/package/samtools/samtools mpileup ./your.bam | cut -f 1,2,5

That will give you a chromosome, base position (1-based) and a string similar to what you're looking for, but is case sensitive (strand) and has some other symbols for mismatches, etc.

Check out: http://samtools.sourceforge.net/pileup.shtml

Thanks! But the problem is that mpileup filter data. I just want to see raw data from BAM , like samtools tview.

Sorry.. I just see that mpilup do for each base and do not filter ! Thanks! You were right and solve my problem

Log in to answer this question.