Gviz AlignmentsTrack: how to prevent reads from overlapping each other
1
0
Entering edit mode
@ariloytynoja-7517
Last seen 4.5 years ago
Finland

Hi,

I'd like to show bam reads with mismatches. I use the following code:

plottracks <- function(bpath,spath,chr,from,to) {
    options(ucscChromosomeNames=FALSE)
    seqs <- readDNAStringSet(spath)
    seqTrack <- SequenceTrack(seqs, from=from, to=to, chrom = chr)
    bamTrack<-AlignmentsTrack(bpath, fill.reads="pink", from=from, to=to, chrom = chr)
    plotTracks(c(bamTrack,seqTrack), from=from, to=to, chrom = chr) 
}

plottracks("lg17.bam","lg17.fa","LG17",1693000,1693120)

The resulting plot is here: Gviz plot with clashing reads

How could I prevent reads from overlapping each other? Should I prepare the bam file somehow or is there something wrong in my R code?

Thanks for any help!

Regards, Ari

Gviz • 1.2k views
ADD COMMENT
0
Entering edit mode

You need to read the part of the FAQ that shows how to add images to your posts.

ADD REPLY
0
Entering edit mode
Robert Ivanek ▴ 750
@robert-ivanek-5892
Last seen 11 months ago
Switzerland

This is a cross-post, there is also an issue on the Github.

The reason for overlap are too short fragments (shorter than 2*readLength). In case of paired-end sequencing, the mates are always plotted on the same y-coordinate.

You can plot it as a single end data, with this modification:

...
bamTrack <- AlignmentsTrack(bpath, from=from, to=to, chrom = chr, isPaired=FALSE)
...
ADD COMMENT

Login before adding your answer.

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