[Bioc-devel] Struggles with correct import .....

Martin Maechler maechler at stat.math.ethz.ch
Wed Dec 4 11:09:12 CET 2013


>>>>> Kasper Daniel Hansen <kasperdanielhansen at gmail.com>
>>>>>     on Tue, 3 Dec 2013 18:57:51 -0500 writes:

    > It is super super super useful for NAMESPACE issues.  I
    > don't really use the other stuff.

    > Kasper

Thank you, both, Dan and Kasper.

As the package is not so large, and it really is not related in
any way to Bioconductor apart from its authorship,
I wonder if "one" should not rather consider donating most of the
functions to the 'codetools' package (whose maintainer is Luke
Tierney). The 'Author' entry in all the (new) help pages could
still remain there...

BTW: If you "fix" it:  Consider rewriting many usages of
ulapply() with the more efficient and "robust" vapply().

And just in case my 'suggestion's above don't sound enough
grateful:

Thank you very much, once more!
Martin

    > On Tue, Dec 3, 2013 at 11:34 AM, Dan Tenenbaum
    > <dtenenba at fhcrc.org> wrote:

    >> 
    >> 
    >> ----- Original Message ----- > From: "Martin Maechler"
    >> <maechler at stat.math.ethz.ch> > To: "Kasper Daniel Hansen"
    >> <kasperdanielhansen at gmail.com> > Cc:
    >> bioc-devel at r-project.org > Sent: Tuesday, December 3,
    >> 2013 8:13:55 AM > Subject: Re: [Bioc-devel] Struggles
    >> with correct import .....
    >> >
    >> > >>>>> Kasper Daniel Hansen
    >> <kasperdanielhansen at gmail.com> > >>>>> on Wed, 20 Nov
    >> 2013 15:37:00 -0500 writes:
    >> >
    >> > > Ok, I analyzed the package using codetoolsBioC and
    >> there > > were a number of missing imports, including
    >> what Leonardo > > has described.  I have fixed those in
    >> bumphunter 1.3.3
    >> >
    >> > > Kasper
    >> >
    >> > Impressing and interesting.  I don't see
    >> 'codetoolsBioC' to be > available via biocLite().
    >> >
    >> > What's the recommended way to have it among the
    >> bioconductor > packages ?
    >> >
    >> 
    >> 
    >> Check it out from svn:
    >> 
    >> https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/codetoolsBioC/
    >> 
    >> (username/password: readonly)
    >> 
    >> The package has some issues and needs some attention;
    >> this is why it has not been released.  It's still useful
    >> though.
    >> 
    >> Dan
    >> 
    >> 
    >> > Martin
    >> >
    >> > > On Wed, Nov 20, 2013 at 3:28 PM, Kasper Daniel Hansen
    >> < > > kasperdanielhansen at gmail.com> wrote:
    >> >
    >> > >> I'll have a look.
    >> >     >>
    >> > >> Basically, issues such as this is never the
    >> end-users > >> problem and is likely to either be caused
    >> by bumphunter > >> not importing correctly (most likely)
    >> or IRanges not > >> exporting correctly.
    >> >     >>
    >> > >> Kasper
    >> >     >>
    >> >     >>
    >> > >> On Wed, Nov 20, 2013 at 3:02 PM, Leonardo Collado
    >> Torres > >> < lcollado at jhsph.edu> wrote:
    >> >     >>
    >> > >>> Hello,
    >> >     >>>
    >> > >>> Found how to solve this. Basically, the NAMESPACE
    >> of the > >>> bumphunter package is not complete (I
    >> think).
    >> >     >>>
    >> > >>> I downloaded
    >> >     >>>
    >> >     >>>
    >> http://bioconductor.org/packages/release/bioc/src/contrib/bumphunter_1.2.0.tar.gz
    >> > >>> , changed the version to 1.2.1 and added/modified
    >> the > >>> following lines to the NAMESPACE:
    >> >     >>>
    >> > >>> importFrom(IRanges, IRanges, distance, > >>>
    >> distanceToNearest, subjectHits) > >>>
    >> importMethodsFrom(GenomicRanges, seqnames, sort, strand,
    >> > >>> elementMetadata)
    >> >     >>>
    >> > >>> Once bumphunter was importing IRanges::distance, I
    >> got > >>> past the error I reported. Then I found other
    >> errors > >>> related to bumphunter not importing the
    >> GenomicRanges > >>> strand and elementMetadata functions,
    >> as well as the > >>> IRanges distanceToNearest, IRanges
    >> and subjectHits > >>> functions.
    >> >     >>>
    >> > >>> Best, Leo
    >> >     >>>
    >> >     >>>
    >> >     >>>
    >> >     >>>
    >> > >>> On Wed, Nov 20, 2013 at 2:46 PM, Leonardo Collado
    >> Torres > >>> < lcollado at jhsph.edu > wrote:
    >> >     >>>
    >> > >>> > Hi Harris,
    >> >     >>> >
    >> > >>> > Answering your question from your first email, I
    >> do > >>> not think that it > would help if bumphunter
    >> exported > >>> matchGenes() or .matchGenes().
    >> >     >>> >
    >> > >>> > Currently by just importing annotateNearest(), R
    >> is > >>> correctly able to use > annotateNearest(), then
    >> > >>> .matchGenes(), and also nearestgene(). The problem
    >> > is > >>> that nearestgene() uses IRanges::distance()
    >> but that > >>> function is not > being found even after
    >> importing it.
    >> >     >>> >
    >> > >>> > So as far as I understand, everything should be >
    >> >>> working since the > NAMESPACE< > >>>
    >> https://github.com/lcolladotor/derfinder/blob/v0.0.34/NAMESPACE
    >> >has:
    >> >     >>> >
    >> > >>> > importFrom(bumphunter,annotateNearest) > > >>>
    >> importMethodsFrom(IRanges,distance) > > >>>
    >> importFrom(IRanges,distance)
    >> >     >>> >
    >> > >>> > That is why I am confused and do not know what is
    >> the > >>> cause of the problem.
    >> >     >>> >
    >> >     >>> >
    >> > >>> > One possible explanation could be that
    >> bumphunter's > >>> NAMESPACE
    >> >     >>> >
    >> >     >>>
    >> https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/bumphunter/NAMESPACEdoesn't
    >> > >>> > import the IRanges::distance method.
    >> >     >>> >
    >> >     >>> >
    >> >     >>> >
    >> > >>> > Regarding your second email (quoted below), I do
    >> not > >>> import the > IRanges::nearest method, but it
    >> doesn't > >>> seem to be causing problems.  That > could
    >> be because > >>> bumphunter does import the
    >> IRanges::nearest method
    >> >     >>> >
    >> > >>> > If I comment out line 147 of >
    >> >     >>>
    >> https://github.com/lcolladotor/derfinder/blob/v0.0.34/R/analyzeChr.R,
    >> > >>> > aka, comment out library("bumphunter") the
    >> example for > >>> analyzeChr() fails > with:
    >> >     >>> >
    >> > >>> > Error in withCallingHandlers(expr, warning = >
    >> >>> function(w) > invokeRestart("muffleWarning")) : >
    >> could > >>> not find function "distance"
    >> >     >>> >
    >> > >>> > So yes, I get the same error in real life and not
    >> only > >>> in CMD check.
    >> >     >>> >
    >> >     >>> >
    >> > >>> > Adding to the NAMESPACE the following line
    >> doesn't > >>> help either.
    >> >     >>> >
    >> > >>> > importMethodsFrom(IRanges,nearest)
    >> >     >>> >
    >> >     >>> >
    >> >     >>> >
    >> >     >>> >
    >> > >>> > Best, > Leo
    >> >     >>> >
    >> >     >>> >
    >> >     >>> >
    >> > >>> > On Wed, Nov 20, 2013 at 2:06 PM, Harris A. Jaffee
    >> > >>> <hj at jhu.edu> wrote:
    >> >     >>> >
    >> > >>> >> In nearestgene(), before the call to distance,
    >> there > >>> is a call to nearest.  >> How is that getting
    >> resolved?  > >>> Did you import nearest from IRanges?
    >> Can >> you run > >>> nearestgene under debug and step
    >> through it, seeing how > >>> nearest is >> resolved?  Do
    >> you only get an error from > >>> CMD check and not in
    >> real life?
    >> >     >>> >>
    >> >     >>> >>
    >> > >>> >> On Nov 20, 2013, at 12:16 PM, Leonardo Collado
    >> Torres > >>> wrote:
    >> >     >>> >>
    >> > >>> >> > Dear BioC-devel list,
    >> >     >>> >> >
    >> > >>> >> > I have what I hope is a simple
    >> problem. Basically, > >>> a function in my >> package
    >> uses > >>> bumphunter::annotateNearest. This function in
    >> turn uses > >>> >> IRanges::distance.
    >> >     >>> >> >
    >> > >>> >> > I would expect that using the following
    >> roxygen2 > >>> info would work:
    >> >     >>> >> >
    >> > >>> >> > #' @importMethodsFrom IRanges distance >> > #'
    >> > >>> @importFrom bumphunter annotateNearest >> > #' >
    >> >>> @importFrom IRanges distance
    >> >     >>> >> >
    >> > >>> >> > Note that "distance" is a generic in IRanges
    >> with > >>> methods for "Ranges"
    >> >     >>> >>
    >> >     >>>
    >> https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/IRanges/R/nearest-methods.R
    >> >     >>> >> >
    >> >     >>> >> >
    >> > >>> >> > When using devtools::check (or R CMD check) I
    >> end > >>> up with the following >> error:
    >> >     >>> >> >
    >> > >>> >> > Error in withCallingHandlers(expr, warning = >
    >> >>> function(w) >> invokeRestart("muffleWarning")) : >> >
    >> > >>> could not find function "distance" >> > Calls: >
    >> >>> analyzeChr -> annotateNearest -> .matchGenes -> > >>>
    >> nearestgene >> > Execution halted
    >> >     >>> >> >
    >> >     >>> >> >
    >> > >>> >> > Note that using library("bumphunter") before
    >> the > >>> annotateNearest call >> works. But we would
    >> like to have > >>> it work by using the correct namespace
    >> >> imports.
    >> >     >>> >> >
    >> > >>> >> > Thank you for your help!
    >> >     >>> >> >
    >> > >>> >> > Best, >> > Leonardo
    >> >     >>> >> >
    >> > >>> >> > PS Function in question is >>
    >> >     >>>
    >> https://github.com/lcolladotor/derfinder/blob/master/R/analyzeChr.R
    >> >     >>> >> >
    >> > >>> >> > > sessionInfo() >> > R version 3.0.2
    >> (2013-09-25) > >>> >> > Platform:
    >> x86_64-apple-darwin10.8.0 (64-bit)
    >> >     >>> >> >
    >> > >>> >> > locale: >> > [1] > >>>
    >> en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
    >> >     >>> >> >
    >> > >>> >> > attached base packages: >> > [1] stats
    >> graphics > >>> grDevices utils datasets methods base
    >> >     >>> >> >
    >> > >>> >> > other attached packages: >> > [1]
    >> derfinder_0.0.34 > >>> RcppArmadillo_0.3.920.1
    >> Rcpp_0.10.6 >> roxygen2_2.2.2 > >>> digest_0.6.3
    >> devtools_1.3
    >> >     >>> >> >
    >> > >>> >> > loaded via a namespace (and not attached): >>
    >> > [1] > >>> AnnotationDbi_1.24.0 Biobase_2.22.0
    >> BiocGenerics_0.8.0 > >>> >> biomaRt_2.18.0
    >> Biostrings_2.30.1 biovizBase_1.10.3 >> > >>> > [7]
    >> bitops_1.0-6 brew_1.0-6 BSgenome_1.30.0 >> > >>>
    >> bumphunter_1.2.0 cluster_1.14.4 codetools_0.2-8 >> > >
    >> >>> [13] colorspace_1.2-4 DBI_0.2-7 dichromat_2.0-0 >> >
    >> >>> doRNG_1.5.5 evaluate_0.5.1 foreach_1.4.1 >> > [19] >
    >> >>> GenomicFeatures_1.14.0 GenomicRanges_1.14.3
    >> ggbio_1.10.7 > >>> >> ggplot2_0.9.3.1 grid_3.0.2
    >> gridExtra_0.9.1 >> > [25] > >>> gtable_0.1.2 Hmisc_3.12-2
    >> httr_0.2 >> IRanges_1.20.5 > >>> iterators_1.0.6
    >> itertools_0.1-1 >> > [31] labeling_0.2 > >>>
    >> lattice_0.20-24 locfit_1.5-9.1 >> MASS_7.3-29 > >>>
    >> matrixStats_0.8.12 memoise_0.1 >> > [37] munsell_0.4.2 >
    >> >>> parallel_3.0.2 pkgmaker_0.17.4 >> plyr_1.8
    >> proto_0.3-10 > >>> qvalue_1.36.0 >> > [43]
    >> R.methodsS3_1.5.2 > >>> RColorBrewer_1.0-5 RCurl_1.95-4.1
    >> >> registry_0.2 > >>> reshape2_1.2.2 rngtools_1.2.3 >> >
    >> [49] rpart_4.1-3 > >>> Rsamtools_1.14.1 RSQLite_0.11.4 >>
    >> rtracklayer_1.22.0 > >>> scales_0.2.3 stats4_3.0.2 >> >
    >> [55] stringr_0.6.2 > >>> tcltk_3.0.2 tools_3.0.2 >>
    >> VariantAnnotation_1.8.5 > >>> whisker_0.3-2 XML_3.95-0.2
    >> >> > [61] xtable_1.7-1 > >>> XVector_0.2.0 zlibbioc_1.8.0
    >> >     >>> >> >
    >> >     >>> >> >
    >> > >>> >> > Leonardo Collado Torres, PhD student >> > >
    >> >>> Department of Biostatistics >> > Johns Hopkins > >>>
    >> University >> > Bloomberg School of Public Health >> > >
    >> >>> Website: http://www.biostat.jhsph.edu/~lcollado/ >> >
    >> > >>> Blog: http://lcolladotor.github.io/
    >> >     >>> >> >
    >> >     >>> >> >
    >> >     >>> >> >
    >> >     >>> >>
    >> >     >>> >>
    >> >     >>> >
    >> >     >>>
    >> > >>> [[alternative HTML version deleted]]
    >> >     >>>
    >> > >>> _______________________________________________ >
    >> >>> Bioc-devel at r-project.org mailing list > >>>
    >> https://stat.ethz.ch/mailman/listinfo/bioc-devel
    >> >     >>>
    >> >     >>
    >> >     >>
    >> >
    >> > > [[alternative HTML version deleted]]
    >> >
    >> > > _______________________________________________ > >
    >> Bioc-devel at r-project.org mailing list > >
    >> https://stat.ethz.ch/mailman/listinfo/bioc-devel
    >> >
    >> > _______________________________________________ >
    >> Bioc-devel at r-project.org mailing list >
    >> https://stat.ethz.ch/mailman/listinfo/bioc-devel
    >> >
    >>



More information about the Bioc-devel mailing list