Gviz : sort reads in AlignmentsTracks and display reads containing indels
1
0
Entering edit mode
@aurelie-gabriel-12548
Last seen 7.3 years ago
France

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

library(Gviz)
library(BSgenome.Hsapiens.UCSC.hg19)
library(TxDb.Hsapiens.UCSC.hg19.knownGene)
library(org.Hs.eg.db)

g=BSgenome.Hsapiens.UCSC.hg19
txdb=TxDb.Hsapiens.UCSC.hg19.knownGene
annotation=org.Hs.eg.db
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)
s=c(0.05,0.1,0.72,0.05,0.08)

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.

gviz • 2.5k views
ADD COMMENT
0
Entering edit mode

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

Sarah

ADD REPLY
0
Entering edit mode

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

Aurélie.

ADD REPLY
0
Entering edit mode
@florianhahnenovartiscom-3784
Last seen 6.3 years ago
Switzerland

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.

Florian

ADD COMMENT
0
Entering edit mode

Hi,

Thank you for your answer.

Aurélie.
 

ADD REPLY

Login before adding your answer.

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