lawremi / ggbio

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

stat_coverage facets error #52

Open fcg-bio opened 10 years ago

fcg-bio commented 10 years ago

Hi,

I'm trying to use stat_coverage function with a GRanges object with multiple seqnames. When I plot the data, the facets are not created and just the first sequence is plotted. Following your example at http://www.tengfei.name/ggbio/docs/man/stat_coverage-method.html , this is my result: rplot I'm using version latest version available (1.10.14) I had a look to the code (stat_coverage-method.R) , and seems that only the first sequence of the GRange element is selected at line 33:

32: lst <- lapply(grl, function(dt){ 33: dt <- grl[[1]] ...

Thanks a lot

tengfei commented 10 years ago

Hi Francesc,

Thanks for your patience, I will check in the change this afternoon, I am working on something else and hope to bump the version together today.

cheers

Tengfei

On Fri, Apr 4, 2014 at 6:37 AM, Francesc Castro notifications@github.comwrote:

Hi,

I'm trying to use stat_coverage function with a GRanges object with multiple seqnames. When I plot the data, the facets are not created and just the first sequence is plotted. Following your example at http://www.tengfei.name/ggbio/docs/man/stat_coverage-method.html , this is my result: [image: rplot]https://cloud.githubusercontent.com/assets/1126319/2614252/d220aa24-bbe3-11e3-8921-bc8dcf40de3b.png I'm using version latest version available (1.10.14) I had a look to the code (stat_coverage-method.R) , and seems that only the first sequence of the GRange element is selected at line 33:

32: lst <- lapply(grl, function(dt){ 33: dt <- grl[[1]] ...

Thanks a lot

Reply to this email directly or view it on GitHubhttps://github.com/tengfei/ggbio/issues/52 .

tengfei commented 10 years ago

man thanks a lot, I just checked in the fix into 1.10.16, you are right, I accidently left that test code dt <- grl[[1]] and checked it in, sorry about that. It should be fixed...

On Fri, Apr 4, 2014 at 10:46 AM, Tengfei Yin yintengfei@gmail.com wrote:

Hi Francesc,

Thanks for your patience, I will check in the change this afternoon, I am working on something else and hope to bump the version together today.

cheers

Tengfei

On Fri, Apr 4, 2014 at 6:37 AM, Francesc Castro notifications@github.comwrote:

Hi,

I'm trying to use stat_coverage function with a GRanges object with multiple seqnames. When I plot the data, the facets are not created and just the first sequence is plotted. Following your example at http://www.tengfei.name/ggbio/docs/man/stat_coverage-method.html , this is my result: [image: rplot]https://cloud.githubusercontent.com/assets/1126319/2614252/d220aa24-bbe3-11e3-8921-bc8dcf40de3b.png I'm using version latest version available (1.10.14) I had a look to the code (stat_coverage-method.R) , and seems that only the first sequence of the GRange element is selected at line 33:

32: lst <- lapply(grl, function(dt){ 33: dt <- grl[[1]] ...

Thanks a lot

Reply to this email directly or view it on GitHubhttps://github.com/tengfei/ggbio/issues/52 .

fcg-bio commented 10 years ago

Hi Tengfei,

Thanks for solving that and sorry for disturbing you again. I realized that there could be another potential bug. When I try to perform the plot using a GRanges object with seqlengths not missing, I obtain an error in line 43. Let me paste you the original code:

41: }else{ 42: seqs <- xlim[1]:xlim[2] 43: vals <- vals[[1]][seqs] 44: vals <- as.numeric(vals) 45: }

Because seqs are created using the xlim (defined as the maximum and minimum points for the total set of sequences), it fails in line 43 if the xlim[2] is > than the seqlength for the specific sequence. I did that simple change and it worked perfectly:

43: seqs <- xlim[1]:max(end(ranges(dt)))

Best,

Francesc