Quick Visual Inspection Of Mapping Images For A List Of Regions
4
8
Entering edit mode
13.9 years ago

Hi,

I would like to quickly have a look to a few hundred images of reads mapped to a reference, for a list of a few hundred regions.

What I've got so far is a file with a list of regions "chrname:start-end", and I am simply using samtools tview for them like this:

cat peaks.txt | while read i; do echo -e "g$i\n." | samtools tview my.bam my.ref.fa.gz; done

The "." at the end is to switch of the dots in the tview configuration. I use Ctrl+C to go to the next region.

Is there a better way to do this? Maybe something that generates image files?

Cheers

visualization mapping • 4.5k views
ADD COMMENT
10
Entering edit mode
13.9 years ago

Take a look at the IGV browser. In particular, it has some nice scripting functionality:

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

and

http://www.broadinstitute.org/software/igv/PortCommands

ADD COMMENT
1
Entering edit mode

bedtools has a script called bedToIgv that will create an IGV batch script for generating images for each interval in a BED/GFF/VCF file.

ADD REPLY
0
Entering edit mode

+1 for the batch query

ADD REPLY
5
Entering edit mode
13.9 years ago
Scott Cain ▴ 770

Since you already have BAM files, you can use Bio::DB::Sam with GBrowse and gbrowse_img to generate images. It could easily be scripted using wget or curl and shell scripting and gbrowse_img will return graphics like GBrowse would use. Alternatively, you could skip the webserver and do the image generation with Bio::Graphics and perl. For more information, you can take a look at:

GBrowse2 Install Doc

Bio::DB::Sam

Bio::Graphics

BioPerl

ADD COMMENT
4
Entering edit mode
13.5 years ago
Ido Tamir 5.2k

same answer as for other thread

most genome browsers have scripting capability IGB and IGV.[?] GBrowse2 also allows linking and by this scripting.

If you want something really small:[?]

  1. download the two files from lookseq lookseq
  2. and compile them: g++ render_image.cpp -O3 -o render_image -lpng -L . -lbam
  3. create image with: ./render_image --bam=mybam.bam --options=snps,pairs,arrows,single,faceaway,inversions,linkpairs,colordepth --ref=myref.fa --region="2L:1-200000" --png=2L.a.png

This way you can quickly create small images with the reads from your bam file with many viewing options. like this example (click on one button on the right).

ADD COMMENT
0
Entering edit mode

IIRC now I copied the lookseq files into the folder of the samtools and compile there for correct linkage with libbam YMMV.

ADD REPLY
3
Entering edit mode
13.4 years ago

For different level of zoomed-out views as bitmaps, Lookseq's render_image is great. In combination with ImageMagick's montage tool, it does pretty much all I want:

montage -tile 1 -geometry +0+0 $i/*.png $i.png

For nucleotide-level textual views, I've just been made aware about Pierre's bamttview, which is a modification of samtools tview:

http://plindenbaum.blogspot.com/2011/07/text-alignment-viewer-using-samtools.html

ADD COMMENT
0
Entering edit mode

many thanks to the LookSeq people and @Pierre Lindenbaum for both solutions.

ADD REPLY

Login before adding your answer.

Traffic: 1965 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