[Bioc-devel] bnlearn method / generic definition (was Re: R CMD check problems)

Morgan, Martin Martin.Morgan at roswellpark.org
Thu Feb 25 16:45:47 CET 2016


This reproduces the problem

> loadNamespace('graph')
<environment: namespace:graph>
> loadNamespace('bnlearn')
Error: .onLoad failed in loadNamespace() for 'bnlearn', details:
  call: setMethod("nodes", cl, function(object) .nodes(object))
  error: no existing definition for function 'nodes'


and it's because of the way bnlearn loads itself


  if ("graph" %!in% loadedNamespaces()) {

    setGeneric("nodes", function(object, ...) standardGeneric("nodes"))
    setGeneric("nodes<-", function(object, value) standardGeneric("nodes<-"))
    setGeneric("degree", function(object, Nodes, ...) standardGeneric("degree"))

  }#THEN

  # add the methods.
  for (cl in bnlearn.classes) {

    setMethod("nodes", cl, function(object) .nodes(object))
    setMethod("nodes<-", cl, function(object, value) .relabel(object, value))
    setMethod("degree", cl, function(object, Nodes) .degree(object, Nodes))

  }#FOR

graph is loaded but not attached, so the generic that it defines is not visible to bnlearn.

I'm ccing the bnlearn maintainer

________________________________________
From: Bioc-devel <bioc-devel-bounces at r-project.org> on behalf of Vincent Carey <stvjc at channing.harvard.edu>
Sent: Thursday, February 25, 2016 10:23 AM
To: Luca De Sano; bioc-devel at r-project.org
Subject: Re: [Bioc-devel] R CMD check problems

I am evidently not expert in this topic.  However I was able to get past
the warning/halt you identified by moving the importFrom(bnlearn,...)
statements to the top of the NAMESPACE.  I cannot see in the WRE manual how
the order of namespace imports/exports should be controlled.  Other minds
will be needed to set this straight.

On Thu, Feb 25, 2016 at 6:06 AM, Luca De Sano <l.desano at campus.unimib.it>
wrote:

> This is my sessionInfo(), I've the current stable release of bnlearn (3.9).
>
> > sessionInfo()
> R version 3.2.3 (2015-12-10)
> Platform: x86_64-pc-linux-gnu (64-bit)
> Running under: Ubuntu 14.04.3 LTS
>
> locale:
>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>  [3] LC_TIME=it_IT.UTF-8        LC_COLLATE=en_US.UTF-8
>  [5] LC_MONETARY=it_IT.UTF-8    LC_MESSAGES=en_US.UTF-8
>  [7] LC_PAPER=it_IT.UTF-8       LC_NAME=C
>  [9] LC_ADDRESS=C               LC_TELEPHONE=C
> [11] LC_MEASUREMENT=it_IT.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] parallel  stats     graphics  grDevices utils     datasets  methods
> [8] base
>
> other attached packages:
> [1] TRONCO_2.4.0      bnlearn_3.9       doParallel_1.0.10 iterators_1.0.8
> [5] foreach_1.4.3     devtools_1.10.0
>
> loaded via a namespace (and not attached):
>  [1] igraph_1.0.1        graph_1.44.1        Rcpp_0.12.3
>  [4] magrittr_1.5        roxygen2_5.0.1      BiocGenerics_0.12.1
>  [7] munsell_0.4.3       xtable_1.8-2        colorspace_1.2-6
> [10] stringr_1.0.0       plyr_1.8.3          tools_3.2.3
> [13] grid_3.2.3          gtable_0.1.2        R.oo_1.20.0
> [16] withr_1.0.1         digest_0.6.9        gridExtra_2.0.0
> [19] RColorBrewer_1.1-2  Rgraphviz_2.10.0    reshape2_1.4.1
> [22] ggplot2_2.0.0       cgdsr_1.2.5         codetools_0.2-14
> [25] memoise_1.0.0       stringi_1.0-1       R.methodsS3_1.7.1
> [28] scales_0.3.0        stats4_3.2.3
>
>
> --
> Luca De Sano
> tel: +393337177338
> email: l.desano at campus.unimib.it
> PEC: luca.desano at pec.it
>
> On 25 February 2016 at 12:03, Vincent Carey <stvjc at channing.harvard.edu>
> wrote:
>
>> sessionInfo might help.  my guess is that you have an outofdate bnlearn
>> installed?
>>
>> On Thu, Feb 25, 2016 at 5:57 AM, Luca De Sano <l.desano at campus.unimib.it>
>> wrote:
>>
>>> Hi all,
>>> I'm working on a package named TRONCO (
>>> http://bioconductor.org/packages/devel/bioc/html/TRONCO.html ) which was
>>> released last year on bioconductor. Everytime I run R CMD check I get
>>> these
>>> two warnings:
>>>
>>> * checking whether the namespace can be loaded with stated dependencies
>>> ...
>>> WARNING
>>> Error: .onLoad failed in loadNamespace() for 'bnlearn', details:
>>>   call: setMethod("nodes", cl, function(object) .nodes(object))
>>>   error: no existing definition for function ‘nodes’
>>> Execution halted
>>>
>>> * checking whether the namespace can be unloaded cleanly ... WARNING
>>> Error: .onLoad failed in loadNamespace() for 'bnlearn', details:
>>>   call: setMethod("nodes", cl, function(object) .nodes(object))
>>>   error: no existing definition for function ‘nodes’
>>> Execution halted
>>>
>>> I've searched informations about these errors and I've only found some
>>> old
>>> posts on StackOverflow which suggested to change the order of the import.
>>> I've tried to do it with no result. At the moment I can't figure out what
>>> those warnings mean!
>>>
>>> Any suggestions?
>>>
>>> Warnings can be reproduced with the code listed below:
>>>
>>> git clone https://github.com/BIMIB-DISCo/TRONCO.git
>>> R CMD build TRONCO
>>> R CMD check TRONCO_2.3.0.tar.gz
>>>
>>> Thank you
>>>
>>> --
>>> Luca De Sano
>>> tel: +393337177338
>>> email: l.desano at campus.unimib.it
>>> PEC: luca.desano at pec.it
>>>
>>>         [[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


This email message may contain legally privileged and/or confidential information.  If you are not the intended recipient(s), or the employee or agent responsible for the delivery of this message to the intended recipient(s), you are hereby notified that any disclosure, copying, distribution, or use of this email message is prohibited.  If you have received this message in error, please notify the sender immediately by e-mail and delete this email message from your computer. Thank you.


More information about the Bioc-devel mailing list