Dear Robert,

Thanks a lot for your reply. I implemented your suggestions and with one
additional step it works perfectly now.

Apart from setting the chromosome identifier in the ranges from 2 to chr2,
the active chromosome for the bmTrack also needs to be set to chr2 after
retrieving the data from e! using

chromosome(bmTrack)=sprintf("chr%s", chro)

Thanks again.

Kind regards,
Martin


--
M.A. (Martin) Rijlaarsdam MSc. MD
Erasmus MC - University Medical Center Rotterdam
Department of Pathology
Room Be-432b
Shipping adress: P.O. Box 2040, 3000 CA Rotterdam, The Netherlands
Visiting adress: Dr. Molewaterplein 50, 3015 GE Rotterdam, The Netherlands

Email: m.a.rijlaarsdam@gmail.com
Mobile: +31 6 45408508
Telephone (work): +31 10 7033409
Fax +31 10 7044365
Website: http://www.martinrijlaarsdam.nl


On Wed, Jul 17, 2013 at 12:29 PM, Robert Ivanek <robert.ivanek@unibas.ch>wrote:

> Dear Martin,
>
> You are trying to visualize data from two different sources which are
> using different chromosome names:
> * BiomartGeneRegionTrack based on e! which is using 1, 2, 3, ... X
> * IdeogramTrack based on UCSC which is using chr1, chr2, chr3, ... chrX
>
> You can combine both tracks together in the following way:
>
> library(Gviz)
> ## suppport non-UCSC chromosome names
> options(ucscChromosomeNames=FALSE)
> ##regions with genes
> st=17740000
> ed=17750000
> bmTrack <- BiomartGeneRegionTrack(start=st, end=ed,
>                                   chromosome="chrX",
>                                   genome="hg19",showId =
> TRUE,background.title = "white",
>                                   name="",fontsize=20,col="black")
> ## fix the seqlevels (e! is using 1,2, 3 ... X; UCSC is using chr1,
> chr2... chrX)
> library(GenomicRanges) ## we need function  "seqlevels<-"
> seqlevels(ranges(bmTrack)) <- sprintf("chr%s", seqlevels(ranges(bmTrack)))
> ##empty area
> st=20000
> ed=30000
> bmTrack <- BiomartGeneRegionTrack(start=st, end=ed,
>                                   chromosome="chrX",
>                                   genome="hg19",showId =
> TRUE,background.title = "white",
>                                   name="",fontsize=20,col="black")
> ## fix the seqlevels (e! is using 1,2, 3 ... X; UCSC is using chr1,
> chr2... chrX)
> seqlevels(ranges(bmTrack)) <- sprintf("chr%s", seqlevels(ranges(bmTrack)))
> ## IdeogramTrack based on UCSC
> itrack <- IdeogramTrack(genome = "hg19", chromosome = "chrX",fontsize=20)
> gtrack <- GenomeAxisTrack(fontsize=20)
> st <- c(st)
> ed <- c(ed)
> strand <- c("*")
> gr <- c("ROI")
> annTrack <- AnnotationTrack(start=st, end=ed, strand=strand,
>                             chromosome="chrX", genome="hg19",
> feature="ROI",
>                             group=gr, id=paste("test"), name="generic
> annotation", stacking="squish",
>                             background.title =
>
> "white",col="black",fill="red",showFeatureId=TRUE,fontcolor="black")
> plotTracks(list(itrack,annTrack,gtrack,bmTrack),from=st, to=ed)
>
>
> Best
> Robert
>
>
> On 16/07/13 14:06, Martin Rijlaarsdam wrote:
> > Hi,
> >
> > I am trying to use Gviz to retrieve info from specific regions on the
> > genome using the BiomartGeneRegionTrack function. This goes fine with
> > all chromosomes except X (and possibly Y, have not been able to test
> > that). When I retrieve data for an empty region (20000-30000) all goes
> > fine, but in a region with genes (17740000-17750000) the following
> > error occurs:
> >
> > Error in FUN("X"[[1L]], ...) : Invalid chromosome identifier 'x'
> > Please consider setting options(ucscChromosomeNames=FALSE) to allow
> > for arbitrary chromosome identifiers.
> >
> > Setting options(ucscChromosomeNames=FALSE) as also described at
> > https://stat.ethz.ch/pipermail/bioconductor/2013-April/052153.html
> > completely breaks the code (nothing retrieved for any chromosome
> > anymore). Moreover, I think I am using the correct identifier: "chrX"
> > . Of interest, the ideogram and annotation track are generated fine
> > with ' chromosome = "chrX" '
> >
> > Thanks a lot for any help!
> >
> > Best,
> > Martin
> >
> > Sample code:
> >
> > library(Gviz)
> > #regions with genes
> > st=17740000
> > ed=17750000
> > bmTrack <- BiomartGeneRegionTrack(start=st, end=ed,
> >                                   chromosome="chrX",
> > genome="hg19",showId = TRUE,background.title = "white",
> >                                   name="",fontsize=20,col="black")
> > #empty area
> > st=20000
> > ed=30000
> > bmTrack <- BiomartGeneRegionTrack(start=st, end=ed,
> >                                   chromosome="chrX",
> > genome="hg19",showId = TRUE,background.title = "white",
> >                                   name="",fontsize=20,col="black")
> > itrack <- IdeogramTrack(genome = "hg19", chromosome = "chrX",fontsize=20)
> > gtrack <- GenomeAxisTrack(fontsize=20)
> > st <- c(st)
> > ed <- c(ed)
> > strand <- c("*")
> > gr <- c("ROI")
> > annTrack <- AnnotationTrack(start=st, end=ed, strand=strand,
> > chromosome="chrX", genome="hg19", feature="ROI",
> >   group=gr, id=paste("test"), name="generic annotation",
> stacking="squish",
> >   background.title =
> > "white",col="black",fill="red",showFeatureId=TRUE,fontcolor="black")
> > plotTracks(list(itrack,annTrack,gtrack,bmTrack),from=st, to=ed)
> >
> > ----
> >
> > output of sessionInfo()
> > R version 3.0.1 (2013-05-16)
> > Platform: x86_64-w64-mingw32/x64 (64-bit)
> >
> > locale:
> > [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
> States.1252
> > [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
> > [5] LC_TIME=English_United States.1252
> >
> > attached base packages:
> > [1] grid      parallel  stats     graphics  grDevices utils
> > datasets  methods   base
> >
> > other attached packages:
> > [1] Gviz_1.4.4         lumi_2.12.0        Biobase_2.20.0
> BiocGenerics_0.6.0
> >
> > loaded via a namespace (and not attached):
> >  [1] affy_1.38.1            affyio_1.28.0          annotate_1.38.0
> >    AnnotationDbi_1.22.6
> >  [5] beanplot_1.1           BiocInstaller_1.10.2   biomaRt_2.16.0
> >    Biostrings_2.28.0
> >  [9] biovizBase_1.8.1       bitops_1.0-5           BSgenome_1.28.0
> >    cluster_1.14.4
> > [13] colorspace_1.2-2       DBI_0.2-7              dichromat_2.0-0
> >    GenomicFeatures_1.12.2
> > [17] GenomicRanges_1.12.4   Hmisc_3.12-2           illuminaio_0.2.0
> >    IRanges_1.18.2
> > [21] KernSmooth_2.23-10     labeling_0.2           lattice_0.20-15
> >    limma_3.16.6
> > [25] MASS_7.3-27            Matrix_1.0-12          matrixStats_0.8.1
> >    mclust_4.1
> > [29] methylumi_2.6.1        mgcv_1.7-24            minfi_1.6.0
> >    multtest_2.16.0
> > [33] munsell_0.4.2          nleqslv_2.0            nlme_3.1-110
> >    nor1mix_1.1-4
> > [37] plyr_1.8               preprocessCore_1.22.0  R.methodsS3_1.4.4
> >    RColorBrewer_1.0-5
> > [41] RCurl_1.95-4.1         reshape_0.8.4          rpart_4.1-1
> >    Rsamtools_1.12.3
> > [45] RSQLite_0.11.4         rtracklayer_1.20.4     scales_0.2.3
> >    siggenes_1.34.0
> > [49] splines_3.0.1          stats4_3.0.1           stringr_0.6.2
> >    survival_2.37-4
> > [53] tools_3.0.1            XML_3.98-1.1           xtable_1.7-1
> >    zlibbioc_1.6.0
> >
> > _______________________________________________
> > Bioconductor mailing list
> > Bioconductor@r-project.org
> > https://stat.ethz.ch/mailman/listinfo/bioconductor
> > Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor
> >
>
>

	[[alternative HTML version deleted]]

