Gviz AlignmentTrack problem
1
0
Entering edit mode
yuyaxuan0 • 0
@yuyaxuan0-10596
Last seen 8.0 years ago
Hi, I just started to use Gviz. I got some problem when I tried to plot the sequence coverage of my own Bam file. So I used those lines:

afrom <- 142299011
ato <-142813287

alTrack <- AlignmentsTrack(range='/Users/yuyaxuan/Desktop/lymDB/trb_real.bam')
plotTracks(alTrack, from = afrom, to = ato,chromosome = "7")


And this gives me an empty plot. Here I attached some lines of the bam file:

HWI-BRUNOP16X_0001:2:7:16511:51313#0    16      7       142299129       37      75M     *       0       0       TGGGCTGAAGTCTCCACTGTGGTGTGGTCCATTGTCTCAGGCTCCATGGATACTGGAATTACCCAGACACCAAAA     gdcc`gg]gedggfgaggeg`YdebgRgggggggddggbggddgegggfgfgggggfgfggfgggeecca\\Y]]     RG:Z:lymph_75_fcb       XT:A:U  NM:i:28 X0:i:1  X1:i:0  XM:i:28 XO:i:0  XG:i:0  MD:Z:0G0T0C0C0T0A1G0C0T1A0G0T1T0G0A0A1T0T0G1C0T0T0C0T0T3T2A0T37

Gviz • 2.1k views
ADD COMMENT
1
Entering edit mode
Robert Ivanek ▴ 730
@robert-ivanek-5892
Last seen 5 months ago
Switzerland

Hi,

This is because by default Gviz requires chromosome names in UCSC format, i.e. chr7.

However you can force the Gviz to accept also other chromosome names by setting ucscChromosomeNames to FALSE:

options(ucscChromosomeNames=FALSE)

You need to run this before creating the AlignmentTrack object.

ADD COMMENT
0
Entering edit mode

Thanks! it does the trick!

ADD REPLY
0
Entering edit mode

A follow up question about this, so I want to add more tracks along with the alignment track. For example this track,

itrack <- IdeogramTrack(genome = "hg38", chromosome = "chr7")

plotTracks(c(alTrack, itrack), chromosome = "7", from = afrom, to = ato, cex = 0.5, min.height = 8)

 

However, this will give me error:

Error in .local(.Object, ...) : 
  Chromosome '7' does not exist on UCSC genome 'hg38'

I think it's a problem with my BAM file using "7" as the chromosome name, How can I plot them together them?

Thanks!

ADD REPLY
0
Entering edit mode

I believe this might do the trick:

levels(itrack@bandTable$chrom) <- sub("^chr", "", levels(itrack@bandTable$chrom))
ADD REPLY
0
Entering edit mode

This will work, but I'd recommend to stick to a standard chromosome notation already when creating you BAM files. If you have aligned your reads against a UCSC reference genome then you should get the chrXYZ notation. The ideograms are also based on USCS data, so if you want to combine your BAM file with that you better be sure that the two are pointing to the same reference genome. Otherwise you are comparing apples to pears a bit...

ADD REPLY

Login before adding your answer.

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