[BioC] rtracklayer: Problems running vignette

Simon Anders anders at ebi.ac.uk
Wed Jun 3 12:22:55 CEST 2009

Hi Michael,

I've just tried to use rtracklayer, following your vignette, and ran 
into two problems.

1. I cannot add any tracks to a session.

I entered the code in the vignette to produce the "targets" track and 
exported it as "targets.bed". To make things easier to follow, let's 
say, I start from there with a fresh R session:


   # Import the data
   targets <- import("targets.bed")
   # targets is now a RangedData object with 3052 ranges and
   # sequence names chr1 chr10 chr11 chr12 ...

   # Create a session
   session <- browserSession("UCSC")

   # Add the 'targets' track to the session:
   track(session, "MYTRACK") <- targets

Is this last command correct? It does not produce an error, but it does 
not seem to do anything, either. If I list all the tracks in the session 
I get a list of 196 UCSC standard tracks, but "MYTRACK" is not mentioned.

How do I correctly add a track?

2. There is some mangling happening with the chromosome names.

The man page for 'browserView' suggests to try:

    browserView(session, GenomicRanges(20000, 50000, "chr2"))

Doing this asks my web browser to open the following URL:


Note that it says "chrchr2", i.e., a superfluous "chr" got prefixed to 
the sequence name. Obviously, the UCSC page cannot deal with this and 
one gets an error message displayed by JavaScript that "chrchr2" is not 

I run into the same problem if I follow the vignette's code to 
demonstrate 'browserView'.

If I try
    browserView(session, GenomicRanges(20000, 50000, "2"))
I get the range chr2:20000-50000 correctly displayed in my web browser. 
There is, however, still now sight of "MYTRACK".

What's going wrong here?

 > sessionInfo()
R version 2.9.0 (2009-04-17)


attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] rtracklayer_1.4.0 RCurl_0.94-1

loaded via a namespace (and not attached):
[1] Biobase_2.4.0     Biostrings_2.12.0 BSgenome_1.12.0   IRanges_1.2.0
[5] XML_2.3-0


| Dr. Simon Anders, Dipl. Phys.
| European Bioinformatics Institute, Hinxton, Cambridgeshire, UK
| office phone +44-1223-492680, mobile phone +44-7505-841692
| preferred (permanent) e-mail: sanders at fs.tum.de

More information about the Bioconductor mailing list