Difference between revisions of "GBrowse Volvox SAM Tutorial"

From GMOD
Jump to: navigation, search
m (Add a coverage track)
m (Add individual reads)
Line 65: Line 65:
 
</pre>
 
</pre>
  
The "draw_target" option tells the glyph to put the sequence of the read in the glyph when zoomed in far enough to see it and the "show_mismatch" option highlights the base in red when it doesn't match the contig sequence.
+
The <tt>draw_target</tt> option tells the glyph to put the sequence of the read in the glyph when zoomed in far enough to see it and the <tt>show_mismatch</tt> option highlights the base in red when it doesn't match the contig sequence.
  
 
Now, the problem with this track is that if you are at a zoom level higher than a few kb, rendering the track will take a long time (my laptop can't manage 4kb), so we need a way to turn this track on and off according to the zoom level.  Fortunately, GBrowse has semantic zooming built in, and so what we'd like is to turn on the coverage glyph when zoomed out and individual reads when zoomed in.
 
Now, the problem with this track is that if you are at a zoom level higher than a few kb, rendering the track will take a long time (my laptop can't manage 4kb), so we need a way to turn this track on and off according to the zoom level.  Fortunately, GBrowse has semantic zooming built in, and so what we'd like is to turn on the coverage glyph when zoomed out and individual reads when zoomed in.

Revision as of 14:59, 24 October 2011

This page or section needs to be edited. Please help by editing this page to add your revisions or additions.

This is a short tutorial intended to add on to the GBrowse tutorial that ships with it using the "volvox" data set. The SAM file that is linked to here was created by running wgsim, a read simulator to create FASTQ files and then using Galaxy to run Bowtie and produce a SAM file. In order to use this tutorial, SAMtools and Bio::DB::Sam must be installed. This is based on the NGS tutorial that Dave Clements wrote.

Create the BAM file

Start with a SAM file and save in the GBrowse database directory for the volvox tutorial. Also make sure that the volvox fasta file, volvox.fa, is in the directory as well. Now convert the SAM file to a BAM file and index it:

 samtools faidx volvox.fa
 samtools import volvox.fa.fai volvox.sam volvox.bam
 samtools sort volvox.bam volvox.sort
 samtools index volvox.sort.bam

Add a database stanza to the volvox config

The database stanza goes just above the "TRACK DEFAULTS" stanza:

[samdb:database]
db_adaptor     = Bio::DB::Sam
db_args        = -fasta /Library/WebServer/Documents/gbrowse2/databases/volvox/volvox.fa
                 -bam  /Library/WebServer/Documents/gbrowse2/databases/volvox/volvox.sort.bam
search options = none

Add a coverage track

Now add a stanza that will create a coverage density track.

[CoverageDensity]
feature        = coverage
glyph          = wiggle_density
database       = samdb
height         = 20
bicolor_pivot  = 90
pos_color      = blue
neg_color      = red
key            = Coverage (density)
category       = Reads
label          = 0

Note that the value of the database is samdb, which is the name it was given in the database stanza above. The bicolor_pivot value is the coverage value below which the density plot will turn red (the neg_color).

Add individual reads

This stanza will show the individual reads as glyphs, though there will be a lot of them:

[Reads]
feature        = match
glyph          = segments
draw_target    = 1
show_mismatch  = 1
mismatch_color = red
database       = samdb
bgcolor        = blue
fgcolor        = white
height         = 5
label density  = 50
bump           = fast
key            = Reads
category       = Reads

The draw_target option tells the glyph to put the sequence of the read in the glyph when zoomed in far enough to see it and the show_mismatch option highlights the base in red when it doesn't match the contig sequence.

Now, the problem with this track is that if you are at a zoom level higher than a few kb, rendering the track will take a long time (my laptop can't manage 4kb), so we need a way to turn this track on and off according to the zoom level. Fortunately, GBrowse has semantic zooming built in, and so what we'd like is to turn on the coverage glyph when zoomed out and individual reads when zoomed in.

Semantic zooming

To use semantic zooming, we give the coverage and read tracks the same name, and then we add to the coverage track name (the one we want to appear as we zoom out) the base pair level at which we want it to "turn on", like this: