[Bioc-devel] loading VariantAnnotation package breaks ggplot2::qplot when faceting, potential cbind problem?
Martin Morgan
mtmorgan at fhcrc.org
Thu Sep 13 00:48:53 CEST 2012
On 9/12/2012 3:42 PM, Tengfei Yin wrote:
>
>
> On Wed, Sep 12, 2012 at 5:09 PM, Martin Morgan <mtmorgan at fhcrc.org
> <mailto:mtmorgan at fhcrc.org>> wrote:
>
> On 9/12/2012 1:47 PM, Tengfei Yin wrote:
>> Dear developers,
>>
>> I hit some problem I am not able to fix or find what's really going on.
>> When I simply import VCF class in namespace, that will break ggplot2::qplot
>> function when faceting turns on, at first I thought it's ggbio's problem,
>> but when I dig into it, looks like, the cbind function used inside ggplot2
>> changed, looks like ggplot2 suppose to use base::cbind, but use
>> methods:::cbind after loading VariantAnnotation. But maybe I am digging in
>> the wrong direction.
>>
>> Following code demonstrate when loading VariantAnnotation, ggplot2 cannot
>> faceting, even though I import only VCF class in a minimal package, and
>> make the package depends on methods and ggplot2(0.9.2), the same issue
>> still exists, not sure if I am posting in the right place or not. Please
>> let me know if I should post this in somewhere else, thanks.
>>
>>> library(ggplot2)
>>> qplot(x = mpg, y = cyl, data = mtcars, facets = . ~ cyl)
>>> library(VariantAnnotation)
>> Loading required package: GenomicRanges
>> Loading required package: BiocGenerics
>>
>> Attaching package: ‘BiocGenerics’
>>
>> The following object(s) are masked from ‘package:stats’:
>>
>> xtabs
>>
>> The following object(s) are masked from ‘package:base’:
>>
>> anyDuplicated, cbind, colnames, duplicated, eval, Filter, Find,
>> get, intersect, lapply, Map, mapply, mget, order, paste, pmax,
>> pmax.int <http://pmax.int>, pmin,pmin.int <http://pmin.int>, Position, rbind, Reduce,rep.int <http://rep.int>,
>> rownames, sapply, setdiff, table, tapply, union, unique
>>
>> Loading required package: IRanges
>> Loading required package: Rsamtools
>> Loading required package: Biostrings
>>> qplot(x = mpg, y = cyl, data = mtcars, facets = . ~ cyl)
>> Error inrep.int <http://rep.int>("", ncol(r)) : incorrect type for second argument
>
> Wow this is baroque. A simplification of the problem is
>
> > base::cbind
> function (..., deparse.level = 1)
> .Internal(cbind(deparse.level, ...))
> <environment: namespace:base>
> > library(snpStats)
> > head(base::cbind)
>
> 1 function (..., deparse.level = 1)
> 2 {
> 3 na <- nargs() - (!missing(deparse.level))
> 4 deparse.level <- as.integer(deparse.level)
> 5 stopifnot(0 <= deparse.level, deparse.level <= 2)
> 6 argl <- list(...)
>
> snpStats (which VariantAnnotation Imports:) uses 'cbind2' and
> methods:::bind_activation. bind_activation changes the definition of
> cbind. I think this is a left-over from a time when methods could
> not be written on ... . I'll try and get some clarification from
> R-devel.
>
>
> Hi Martin,
>
> Thanks a lot for the quick reply and the clarification, by the way, is
> there any workaround for this release of Bioconductor, if I want to
> import VariantAnnotation and at the same time use ggplot2 as usual?
It will be fixed up-stream, probably in the next day or two. A dueling
packages approach is to methods:::bind_activation(FALSE) after your
dependencies are loaded (e.g., in .onLoad()) but there's really no need
for that.
Martin
>
> Thanks
>
> Tengfei
>
>
> Martin
>
>
>>> sessionInfo()
>> R version 2.15.1 (2012-06-22)
>> Platform: x86_64-pc-linux-gnu (64-bit)
>>
>> locale:
>> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
>> [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
>> [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
>> [7] LC_PAPER=C LC_NAME=C
>> [9] LC_ADDRESS=C LC_TELEPHONE=C
>> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>>
>> attached base packages:
>> [1] stats graphics grDevices utils datasets methods base
>>
>> other attached packages:
>> [1] ggplot2_0.9.2 VariantAnnotation_1.3.18 Rsamtools_1.9.26
>>
>> [4] Biostrings_2.25.10 GenomicRanges_1.9.47 IRanges_1.15.34
>>
>> [7] BiocGenerics_0.3.1
>>
>> loaded via a namespace (and not attached):
>> [1] AnnotationDbi_1.19.28 Biobase_2.17.6 biomaRt_2.13.2
>> [4] bitops_1.0-4.1 BSgenome_1.25.6 colorspace_1.1-1
>> [7] DBI_0.2-5 dichromat_1.2-4 digest_0.5.1
>> [10] GenomicFeatures_1.9.29 grid_2.15.1 gtable_0.1.1
>> [13] labeling_0.1 lattice_0.20-6 MASS_7.3-20
>> [16] Matrix_1.0-6 memoise_0.1 munsell_0.3
>> [19] plyr_1.7.1 proto_0.3-9.2 RColorBrewer_1.0-5
>> [22] RCurl_1.91-1 reshape2_1.2.1 RSQLite_0.11.1
>> [25] rtracklayer_1.17.17 scales_0.2.2 snpStats_1.7.3
>> [28] splines_2.15.1 stats4_2.15.1 stringr_0.6.1
>> [31] survival_2.36-14 tools_2.15.1 XML_3.9-4
>> [34] zlibbioc_1.3.0
>> Thanks a lot
>>
>> Tengfei
>>
>>
>> _______________________________________________
>> Bioc-devel at r-project.org <mailto:Bioc-devel at r-project.org> mailing list
>> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>
>
> --
> Dr. Martin Morgan, PhD
> Fred Hutchinson Cancer Research Center
> 1100 Fairview Ave. N.
> PO Box 19024 Seattle, WA 98109
>
>
>
>
> --
> Tengfei Yin
> MCDB PhD student
> 1620 Howe Hall, 2274,
> Iowa State University
> Ames, IA,50011-2274
>
>
>
--
Dr. Martin Morgan, PhD
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109
More information about the Bioc-devel
mailing list