Create a picture from a Bam file at specific position
2
0
Entering edit mode
7.4 years ago
sacha ★ 2.4k

I would like to make a picture of a bam file aligned at a specific region. Something similar than samtools tview but as a picture not as a text output :

enter image description here

Do you know any tools for doing this ?

bam alignment picture • 2.9k views
ADD COMMENT
1
Entering edit mode

Automated or interactive? Most genome browsers (IGV etc) will export images in various formats.

ADD REPLY
6
Entering edit mode
7.4 years ago
John 13k

ImageMagick is always the answer to anything image-automation related :)

samtools tview your.bam -p chr1:5477604 -d text | convert -background black -fill white label:@- out.png

if you don't have 'convert' then just install ImageMagick.On OSX that's brew install imagemagick

ADD COMMENT
3
Entering edit mode
7.4 years ago

IGV can be driven by a batch script, and therefore command line. It's a little bit of work to get the script written where you need it, but then you get very nice diagrams how you like them. Should be doable in Bash.

Their scripting interface looks like a series of commands, open this bam, sort the reads that way, go to this location, then take a "screenshot". It can all happen behind the scenes, and result in just the picture you are looking for.

http://software.broadinstitute.org/software/igv/batch

ADD COMMENT
0
Entering edit mode

I think this is probably a better solution in the long-run :)

ADD REPLY

Login before adding your answer.

Traffic: 2399 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6