Hello,
I'm trying to use rtracklayer to view my data in UCSC genome browser, but have no idea how to set track attributes such as color or description. Manually setting up color and description in UCSC browser is rather tedious, so I would best avoid it but do it in the program.
Here is an example.
> library(rtracklayer)
> gr1 <- GRanges("chr1", IRanges(100001, 102000))
> gr2 <- gr1 + 3000
> session <- browserSession("UCSC")
> track(session, name = "gr1") <- gr1
> track(session, name = "gr2") <- gr2
> browserView(session, track = c("gr1", "gr2")) # This works but no track color or description set in the script
When I tried to set arguments color
and description
in track
, the tracks were not uploaded at all.
> library(rtracklayer)
> gr1 <- GRanges("chr1", IRanges(100001, 102000))
> gr2 <- gr1 + 3000
> session <- browserSession("UCSC")
> track(session, name = "gr1", color = col2rgb("red")[, 1], description = "gr1") <- gr1
> track(session, name = "gr2", color = col2rgb("green")[, 1], description = "gr2") <- gr2
> browserView(session, track = c("gr1", "gr2"))
Error in resolveTrackIndex(object, value) : Unknown track(s): gr1, gr2
> "gr1" %in% trackNames(session)
[1] FALSE
> "gr2" %in% trackNames(session)
[1] FALSE
Probably I didn't use the package the correct way. Anyway, does anybody know how to do it? Thanks,
Indeed, my current rtracklayer is version 1.42.1. I will try 1.42.2, thanks.
Note that 1.42.2 will become available after a couple of days.
This is the result from the latest version. It appears something is still wrong.... Any idea? Thanks again.
The version is 1.42.2, not 1.43.2. If you're using devel, then you'll need 1.43.3.
Very clear, thanks! Also, it seems bit tricky of bioconductor's versioning, as I would think 1.43.2 should naturally contain the bug fix from 1.42.2...
v1.42.2 works now.