IdeogramTrack from Gviz with chromosome name "4" rather "chr4"
1
0
Entering edit mode
tangming2005 ▴ 190
@tangming2005-6754
Last seen 5 months ago
United States

I have to make the chromosome name to "4" rather "chr4" because my dataTrack 's chromosome names are numbers without "chr". I read the tutorial, and did the following, but it did not work.  Thank you for your help. 

Ming 

options(ucscChromosomeNames=FALSE)

 itrack<- IdeogramTrack(genome = "hg19", chromosome = 4)
Error in .local(.Object, ...) : 
  Chromosome '4' does not exist on UCSC genome 'hg19'
Gviz • 2.8k views
ADD COMMENT
1
Entering edit mode
Robert Ivanek ▴ 730
@robert-ivanek-5892
Last seen 5 months ago
Switzerland

I guess it is a bit counter-intuitive however the IdeogramTrack function is building the ideogram based on UCSC and they use "chr" as a part of the chromosome names. However if you set the option ucscChromosomeNames to FALSE before calling the IdeogramTrack function, then the plot will show "Chromosome 4" as name for the IdeogramTrack.

 

options(ucscChromosomeNames=FALSE)
itrack <- IdeogramTrack(genome = "hg19", chromosome = "chr4")
plotTracks(itrack, from=45e6, to=46e6)

 

ADD COMMENT
0
Entering edit mode

Thanks for your answer. I know that it is build on UCSC. The problem is that my data track's chromosome name is only numbers,

when I plot my dataTrack and the IdeogramTrack together, it complains that the chromosomes are different....

 

 

ADD REPLY
1
Entering edit mode

I see, in that case the fastest fix can be something like this: 

levels(itrack@bandTable$chrom) <- sub("^chr", "", levels(itrack@bandTable$chrom), ignore.case=T)

This would remove the "chr" from the original chromosome names in the IdeogramTrack.

However I noticed that you are using current version of the biomart which is for human genome using the GRCh38.p3 but you built IdeogramTrack from older genome version from UCSC (hg19). Maybe it is safer to use the same one?

Here is example code which shows also dummy data track on chromosome 4.

library(Gviz)
options(ucscChromosomeNames=FALSE)
itrack <- IdeogramTrack(genome = "hg38", chromosome = "chr4")
levels(itrack@bandTable$chrom) <- sub("^chr", "", levels(itrack@bandTable$chrom), ignore.case=T)
dtrack <- DataTrack(range=GRanges("4", IRanges(45.5e6, width=1), e=100))
plotTracks(list(itrack,dtrack), from=45e6, to=46e6, chromosome="4")
ADD REPLY
0
Entering edit mode

Thank you for the answer! I am aware that biomart is using the newest genome build, and I will have to use an older version of biomart database when I put the IdeogramTrack from hg19 together.

 

ADD REPLY
0
Entering edit mode

it worked for your example. But when i feed into a bam file. it still complains. any ideas why?

options(ucscChromosomeNames=FALSE)
bam_track <- DataTrack(range = RNAseq_bam,
                                genome = "hg19",
                                type = "polygon",
                                name = "Coverage",
                                window = -1,
                                chromosome = "4")
itrack <- IdeogramTrack(genome = "hg19", chromosome = "chr4")
levels(itrack@bandTable$chrom) <- sub("^chr", "", levels(itrack@bandTable$chrom), ignore.case=T)
plotTracks(list(itrack, bam_track), from =48833082, to = 48863265)
Updating chromosome band information
Warning message:
In plotTracks(list(itrack, bam_track), from = 48833082, to = 48863265) :
  The track chromosomes in 'trackList' differ. Setting all tracks to chromosome 'chr4'
ADD REPLY
0
Entering edit mode

I figured it out that I have to do this also to make it work:

itrack@chromosome<-"4"

 

ADD REPLY

Login before adding your answer.

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