Question: Gviz : sort reads in AlignmentsTracks and display reads containing indels
gravatar for Aurélie GABRIEL
9 months ago by
Aurélie GABRIEL 0 wrote:

I used Gviz to realise alignments plots using BAM files. Here is the code that I used to generate them :


sTrack <- SequenceTrack(g,cex = 0.6)
chr="chr1"; pos=874816; w=50;

gtrack <- GenomeAxisTrack()
sTrack@chromosome <- chr
ideoTrack <- IdeogramTrack(genome = "hg19", chromosome = chr)
grtrack <- GeneRegionTrack(txdb,chromosome = chr,start = pos-w, end = pos-w,exonAnnotation = "exon",collapseTranscripts = "longest",shape = "arrow",showTitle=FALSE,alpha=0.95)
displayPars(grtrack) <- list(background.title = "white")

alTrack=AlignmentsTrack("BAM_name.bam", isPaired = FALSE,stacking = "squish",alpha=0.95,chromosome=chr,cex.mismatch=0.5,name="Reads",cex.title=1.5)
ht <- HighlightTrack(trackList = c(alTrack,sTrack, grtrack), start = c(pos), width =0,chromosome = chr)

plotTracks(c(ideoTrack,gtrack,ht),sizes=s,from = pos-w, to = pos+w,add53=TRUE,min.height=4, main=paste0(chr,":",pos),title.width=0.7,littleTicks = TRUE,cex.main=1.5)

The plot resulting from that code :

The alignment at the same position using IGV :

First, I would like to choose the reads that are displayed on the AlignmentsTrack for the given position : is it possible to fix the number of reads displayed  ? By doing this I would like to display as much reads as possible and avoid the blank space between the reads like IGV does.

Besides, is it possible to sort the reads from top to bottom depending on the nucleotide located at the position of the alignment (hilighted here in red) ? This would allow me to display in priority the reads with a specific variant.

Also the position highlighted in the example should be an insertion, but the insertions are not visible and I have the same problem with deletions. Is there a way to display indels using a bam file as argument for the AlignmentTracks function or do I have to use the individual function arguments (like id, cigar ...) ?

Thank you for your help.
Aurélie Gabriel.

ADD COMMENTlink modified 8 months ago by florian.hahne@novartis.com1.5k • written 9 months ago by Aurélie GABRIEL 0

I just came across your post and have the same question, did you ever find an answer to this?


ADD REPLYlink written 8 months ago by searthur0

Unfortunately I did not found an answer. I will let you know if I do.


ADD REPLYlink written 8 months ago by Aurélie GABRIEL 0
gravatar for
8 months ago by

You can't really sort reads in these visualisations. Gviz tries to arrange the reads in a way to minimize the vertical space that is needed for display. Also, indels are currently not supported. I am happy to add functionality to the package if somebody else in the developer realm want's to take a first stab at this. I won't have the bandwidth to look at this myself, though.


ADD COMMENTlink written 8 months ago by florian.hahne@novartis.com1.5k


Thank you for your answer.


ADD REPLYlink written 8 months ago by Aurélie GABRIEL 0
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 159 users visited in the last hour