lawremi / ggbio

Grid and ggplot2 based visualization for biological data
111 stars 24 forks source link

using geom_bar in layout_circle #22

Closed malnirav closed 12 years ago

malnirav commented 12 years ago

Thanks for the wonderful package to ease biological data visualization!

I been playing around with layout_circle to visualize various genomic features on a different track/layer. What I essentially want is to display GRanges object as bar graph as you find on USCS genome browser. I tried using geom_bar with layout_circle, but I am getting an error object '.circle.yend' not found.

Here is the code:

gr <- GRanges(seqnames = sample(c("chr1", "chr2", "chr3"), size = N, 
    replace = TRUE), IRanges(start = sample(1:300, size = N, replace = TRUE), 
    width = sample(70:75, size = N, replace = TRUE)), strand = sample(c("+", 
    "-", "*"), size = N, replace = TRUE), value = rnorm(N, 10, 3), score = rnorm(N, 
    100, 30), sample = sample(c("Normal", "Tumor"), size = N, replace = TRUE), 
    pair = sample(letters, size = N, replace = TRUE))

ggplot() + layout_circle(gr,geom='bar')
Error in eval(expr, envir, enclos) : object '.circle.yend' not found

Am I doing something wrong?

tengfei commented 12 years ago

Hi Nirav,

This has actually been fixed in my repos, I am going to submit a patch of fixes today or tomorrow morning, you are suppose to use geom:"bar" in layout_circle soon after bioconductor rebuild my package may be one day later.

I will leave a comment for this issue when it's available in bioc, and please feel free to let me know if that works for you or not by then~

Thanks again

Tengfei

On Wed, Apr 18, 2012 at 4:06 PM, Nirav Malani < reply@reply.github.com

wrote:

Thanks for the wonderful package to ease biological data visualization!

I been playing around with layout_circle to visualize various genomic features on a different track/layer. What I essentially want is to display GRanges object as bar graph as you find on USCS genome browser. I tried using geom_bar with layout_circle, but I am getting an error object '.circle.yend' not found.

Here is the code:

gr <- GRanges(seqnames = sample(c("chr1", "chr2", "chr3"), size = N,
   replace = TRUE), IRanges(start = sample(1:300, size = N, replace =
TRUE),
   width = sample(70:75, size = N, replace = TRUE)), strand = sample(c("+",
   "-", "*"), size = N, replace = TRUE), value = rnorm(N, 10, 3), score =
rnorm(N,
   100, 30), sample = sample(c("Normal", "Tumor"), size = N, replace =
TRUE),
   pair = sample(letters, size = N, replace = TRUE))

ggplot() + layout_circle(gr,geom='bar')
Error in eval(expr, envir, enclos) : object '.circle.yend' not found

Am I doing something wrong?


Reply to this email directly or view it on GitHub: https://github.com/tengfei/ggbio/issues/22

Tengfei Yin MCDB PhD student 1620 Howe Hall, 2274, Iowa State University Ames, IA,50011-2274 Homepage: www.tengfei.name

malnirav commented 12 years ago

Thanks Tengfei!

tengfei commented 12 years ago

this is fixed in ggbio 1.4.6 + biovizBase 1.4.2 for R 2.15, dev version might need one more day to update. in R 2.15, please update ggbio/biovizBase try example like

library(ggbio)
library(GenomicRanges)
example(GRanges)
ggplot() + layout_circle(gr, geom = "bar", aes(fill = GC))

compare with linear

ggplot() + geom_bar(gr, aes(fill = GC))

all bar geom is using specified y or 'score' as y and width equals to interval width, so if your ranges are overlapped, the bar will be overlapped too.

malnirav commented 12 years ago

Sweet Dude...this is awesome!