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

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.

ADD COMMENTlink modified 5 months ago by florian.hahne@novartis.com1.5k • written 6 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?

Sarah

ADD REPLYlink written 5 months ago by searthur0

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

Aurélie.

ADD REPLYlink written 5 months ago by Aurélie GABRIEL 0
0
gravatar for florian.hahne@novartis.com
5 months ago by
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 COMMENTlink written 5 months ago by florian.hahne@novartis.com1.5k

Hi,

Thank you for your answer.

Aurélie.
 

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

Help
Access

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