Gviz gives wrong ID with more than 10 genomic intervals
0
1
Entering edit mode
10.2 years ago

I am getting the wrong id to each interval that I try to put in AnnotationTrack objects. Follow my df genes:

     chr    start     end           id
    chr12 72065147 72204484 ENSBTAG00000045751
    chr12 72529373 72690449 ENSBTAG00000047181
    chr12 73574461 73704802 ENSBTAG00000046041
    chr12 73890111 73977633 ENSBTAG00000047764
    chr12 74198711 74199129 ENSBTAG00000047360
    chr12 74816044 74978179 ENSBTAG00000023309
    chr12 75457896 75536848 ENSBTAG00000026070
    chr12 75664651 75870596 ENSBTAG00000039714
    chr12 76758753 76864805 ENSBTAG00000003568
    chr12 76867833 76922959 ENSBTAG00000003569
    chr12 76958977 77024110 ENSBTAG00000012065
    chr12 77032585 77176916 ENSBTAG00000004401

genes <- makeGRangesFromDataFrame(genes, TRUE)
Tgenes1 <- AnnotationTrack(genes, name = "Genes", genome ="bosTau6",
chromosome ="chr12", stacking ="squish", id =as.matrix(genes$id), showId=TRUE, featureAnnotation =    "id")

res <- plotTracks(aTgenes1)

Using the resobject I tried to export the coordinates of each genomic interval inside the Tgenes1 object:

c2 <- coords(res$Genes)
c2x <- c2[,1] + (c2[,3] - c2[,1])/2
c2y <- c2[,2] + (c2[,4] - c2[,2])/2

However I got a different order, and consequently exchanged id:

                           x1       y1        x2       y2
    ENSBTAG00000045751  279.1995 1400.694  368.1064 1484.861
    ENSBTAG00000003569 3343.6561 1512.917 3378.8305 1597.083
    ENSBTAG00000012065 3401.8125 1625.139 3443.3720 1709.306
    ENSBTAG00000004401 3448.7797 1400.694 3540.8732 1484.861
    ENSBTAG00000047181  575.4088 1400.694  678.1868 1484.861
    ENSBTAG00000046041 1242.2496 1400.694 1325.4165 1484.861
    ENSBTAG00000047764 1443.6568 1400.694 1499.5021 1484.861
    ENSBTAG00000047360 1640.1988 1400.694 1641.1987 1484.861
    ENSBTAG00000023309 2034.4682 1400.694 2137.9219 1484.861
    ENSBTAG00000026070 2444.0156 1400.694 2494.3927 1484.861
    ENSBTAG00000039714 2575.9401 1400.694 2707.3477 1484.861
    ENSBTAG00000003568 3274.0553 1400.694 3341.7241 1484.861

Seems that this wrong order followed something pattern like: 1, 10, 11, 12, 2, 3, 4, 5, 6, 7, 8, 9, which exchanged all my ids!!

Some ideas to solve it? Thank you very much.

R bioconductor order • 1.8k views
ADD COMMENT
0
Entering edit mode

I can't reproduce this with your example. Also, it would make more sense to use id=as.character(genes$id). Your problem may in fact be due to this.

ADD REPLY

Login before adding your answer.

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