Ggbio Issues: How To Align Tracks & Where Are Figure Legends?
Entering edit mode
11.4 years ago
sndrtj ▴ 180

Dear Biostar users,

I am using ggbio to add a chromosome ideogram over data along the length of a chromosome. See the code beneath here for some sample code:

data(hg19IdeogramCyto, package = "biovizBase")
x <- seq(from=1,to=8e+07,by=100)
x <- sample(x,7000)
x <- append(x,x)
y_ <- seq(from=-1,to=1,by=0.00001)
y <- sample(y_,7000)
y2 <- sample(y,7000)
y <- append(y,y2)
z <- NULL
z[1:7000] <- 'one'
z[7001:14000] <- 'two'
df <- data.frame(x,y,z)
p <- plotSingleChrom(hg19IdeogramCyto, "chr17",xlabel=TRUE,zoom.region=c(min(df$x),max(df$x)))
p2 <- qplot(x,y,data=df,colour=z,geom='line')
tracks(p, p2 = p2, heights = c(1.2, 5))

Which results in:

enter image description here

Issue one: the ideogram x axis seems out of place with the data x axis. How do I align these two, in such a way that the cytobands actually corresprond to x axis below?

Issue two: Where have my legends gone? In normal ggplot/qplot I would nicely get a legend with "one" and "two" on the right. Somehow this vanished?

Thanks a lot for any suggestions!

r • 4.1k views
Entering edit mode
8.4 years ago

I just tried this code using BioC 3.2

> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.3 LTS


other attached packages:

[1] ggbio_1.18.3         ggplot2_2.0.0        GenomicRanges_1.22.4
[4] GenomeInfoDb_1.6.3   IRanges_2.4.6        S4Vectors_0.8.11
[7] BiocGenerics_0.16.1

I had to change

p <- plotSingleChrom(hg19IdeogramCyto, "chr17",xlabel=TRUE,zoom.region=c(min(df$x),max(df$x)))


p <- Ideogram(hg19IdeogramCyto, "chr17",xlabel=TRUE,zoom.region=c(min(df$x),max(df$x)))

It did give the error

`axis.ticks.margin` is deprecated. Please set `margin` property  of `axis.text` instead

but produced the graph as expected (?)


Login before adding your answer.

Traffic: 2580 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6