[Bioc-devel] Error in cmd check, possibly because examples areexecuted in wrong order

Martin Morgan martin.morgan at roswellpark.org
Mon Jul 10 16:39:59 CEST 2017


On 07/09/2017 04:03 AM, Arman Sh wrote:
> Thank you very much for your response.  The last time, you recommended 
> that instead of storing data
> 
> in environment, use BiocFileCache package to store the function 
> outputs.  There are 5 functions that
> 
> work together. For convenience, I call them A, B, C, D, and E. C depends 
> on  A and B, while D and E
> 
> depend on C. There are two other functions that can employ these 
> functions in one run and get the
> 
> requested outputs. When the users want to change a parameter, e.g. 
> heatmap margins, only the
> 
> function D will work. So, it should be able to access outputs of 
> previous run.
> 
>  > It is still
> 
>  >   https://stat.ethz.ch/pipermail/bioc-devel/2017-June/011138.html
> 
>  > VERY BAD programming practice to write functions whose execution depends
> 
>  > on the state of the user environment.
> 
> No, this time it doesn’t directly store outputs in environments, just a 
> BiocFileCache object for every unique
> 
> submission name. As a professional programmer, what do you recommend? If 
> BiocFileCache is not linked
> 
> to environment, how some functions can know that they should skip while 
> the others can access the
> 
> stored data by a previous run?

The usual strategy is to check whether the cache is valid. If it is 
return the cached result. If not compute the new result.

The example would include the full set of steps to illustrate the 
computation, but would only compute the expensive results once.

Martin

> 
> I highly appreciate any advice or code sample you might kindly provide.
> 
> Best regards,
> 
> Arman
> 
> *From: *Martin Morgan <mailto:martin.morgan at roswellpark.org>
> *Sent: *Sunday, July 9, 2017 03:02
> *To: *Arman Sh <mailto:sh88.arman at gmail.com>; bioc-devel at r-project.org 
> <mailto:bioc-devel at r-project.org>
> *Subject: *Re: [Bioc-devel] Error in cmd check, possibly because 
> examples areexecuted in wrong order
> 
> Examples should be stand-alone; collation influences the order in which
> 
> files are included when the package is built, it does not influence
> 
> order of execution of examples. It is still
> 
>     https://stat.ethz.ch/pipermail/bioc-devel/2017-June/011138.html
> 
> VERY BAD programming practice to write functions whose execution depends
> 
> on the state of the user environment.
> 
> Martin
> 
> On 07/08/2017 06:08 PM, Arman Sh wrote:
> 
>  >
> 
>  > Hi, cmd check returns error for the package I’m developing. The only 
> possible reason is that it doesn’t check the functions in correct order. 
> This is how Collate section of my DESCRIPTION file looks like.
> 
>  >
> 
>  >                         Collate:
> 
>  >                             'cbaf-obtainMultipleStudies.R'
> 
>  >                             'cbaf-obtainOneStudy.R'
> 
>  >                             'cbaf-automatedStatistics.R'
> 
>  >                             'cbaf-availableData.R'
> 
>  >                             'cbaf-heatmapOutput.R'
> 
>  >                             'cbaf-xlsxOutput.R'
> 
>  >                             'cbaf-processMultipleStudies.R'
> 
>  >                             'cbaf-processOneStudy.R'
> 
>  >
> 
>  > and this is how header of my NAMESPACE file looks like:
> 
>  >
> 
>  >                             # Generated by roxygen2: do not edit by hand
> 
>  >
> 
>  >                             export(automatedStatistics)
> 
>  >                             export(availableData)
> 
>  >                             export(heatmapOutput)
> 
>  >                             export(obtainMultipleStudies)
> 
>  >                             export(obtainOneStudy)
> 
>  >                             export(processMultipleStudies)
> 
>  >                             export(processOneStudy)
> 
>  >                             export(xlsxOutput)
> 
>  >
> 
>  > I have set the error code in the ‘automatedStatistics’ function so 
> that it occurs if it is excecuted before obtainMultipleStudies or 
> obtainOneStudy. I’m using Roxygen2 for making the package. When I run my 
> code it proceeds without any error, but cmd check somehow can’t execute 
> the  functions in direct order, I guess.
> 
>  >
> 
>  > Since the function should prevent repetitive executions, I use a 
> BiocFileCache to store the output data for every submission and I made 
> the ‘Formal Class BiocFileCache’ available in global environment. I have 
> checked whether this causes the problem but even without pointing to 
> specific environment, cmd check  returns error. More interestingly, I 
> have manually executed the functions in correct order so that 
> BioFileCache object is created. But cmd check still returnes error!
> 
>  >
> 
>  >
> 
>  > The following is the cmd check results.
> 
>  >
> 
>  > Thank you very much in advance and with the best regards,
> 
>  > Arman
> 
>  >
> 
>  >
> 
>  >
> 
>  >
> 
>  >
> 
>  > ==> roxygen2::roxygenize('.', roclets=c('rd', 'collate', 'namespace', 
> 'vignette'))
> 
>  >
> 
>  > Updating vignettes
> 
>  > Documentation completed
> 
>  >
> 
>  > ==> Rcmd.exe build cbaf
> 
>  >
> 
>  > * checking for file 'cbaf/DESCRIPTION' ... OK
> 
>  > * preparing 'cbaf':
> 
>  > * checking DESCRIPTION meta-information ... OK
> 
>  > * installing the package to build vignettes
> 
>  > * creating vignettes ... OK
> 
>  > * checking for LF line-endings in source and make files
> 
>  > * checking for empty or unneeded directories
> 
>  > * building 'cbaf_0.99.0.tar.gz'
> 
>  >
> 
>  > ==> Rcmd.exe check cbaf_0.99.0.tar.gz
> 
>  >
> 
>  > * using log directory 'Z:/cbaf/Source code/cbaf.Rcheck'
> 
>  > * using R version 3.4.1 (2017-06-30)
> 
>  > * using platform: x86_64-w64-mingw32 (64-bit)
> 
>  > * using session charset: ISO8859-1
> 
>  > * checking for file 'cbaf/DESCRIPTION' ... OK
> 
>  > * this is package 'cbaf' version '0.99.0'
> 
>  > * package encoding: UTF-8
> 
>  > * checking package namespace information ... OK
> 
>  > * checking package dependencies ... OK
> 
>  > * checking if this is a source package ... OK
> 
>  > * checking if there is a namespace ... OK
> 
>  > * checking for executable files ... OK
> 
>  > * checking for hidden files and directories ... OK
> 
>  > * checking for portable file names ... OK
> 
>  > * checking whether package 'cbaf' can be installed ... OK
> 
>  > * checking installed package size ... OK
> 
>  > * checking package directory ... OK
> 
>  > * checking 'build' directory ... OK
> 
>  > * checking DESCRIPTION meta-information ... OK
> 
>  > * checking top-level files ... OK
> 
>  > * checking for left-over files ... OK
> 
>  > * checking index information ... OK
> 
>  > * checking package subdirectories ... OK
> 
>  > * checking R files for non-ASCII characters ... OK
> 
>  > * checking R files for syntax errors ... OK
> 
>  > * checking whether the package can be loaded ... OK
> 
>  > * checking whether the package can be loaded with stated dependencies 
> ... OK
> 
>  > * checking whether the package can be unloaded cleanly ... OK
> 
>  > * checking whether the namespace can be loaded with stated 
> dependencies ... OK
> 
>  > * checking whether the namespace can be unloaded cleanly ... OK
> 
>  > * checking loading without being on the library search path ... OK
> 
>  > * checking dependencies in R code ... OK
> 
>  > * checking S3 generic/method consistency ... OK
> 
>  > * checking replacement functions ... OK
> 
>  > * checking foreign function calls ... OK
> 
>  > * checking R code for possible problems ... NOTE
> 
>  > automatedStatistics: no visible binding for global variable 'rawList'
> 
>  > heatmapOutput: no visible binding for global variable
> 
>  >    'oldParamAutomatedStatistics'
> 
>  > heatmapOutput: no visible binding for global variable 'processedList'
> 
>  > heatmapOutput: no visible binding for global variable
> 
>  >    'simplifiction.cuttoff'
> 
>  > heatmapOutput: no visible global function definition for 'redgreen'
> 
>  > obtainMultipleStudies: no visible binding for global variable 'i'
> 
>  > xlsxOutput: no visible binding for global variable
> 
>  >    'oldParamAutomatedStatistics'
> 
>  > xlsxOutput: no visible binding for global variable 'processedList'
> 
>  > xlsxOutput: no visible binding for global variable 'validationResult'
> 
>  > Undefined global functions or variables:
> 
>  >    i oldParamAutomatedStatistics processedList rawList redgreen
> 
>  >    simplifiction.cuttoff validationResult
> 
>  > * checking Rd files ... OK
> 
>  > * checking Rd metadata ... OK
> 
>  > * checking Rd cross-references ... OK
> 
>  > * checking for missing documentation entries ... OK
> 
>  > * checking for code/documentation mismatches ... OK
> 
>  > * checking Rd \usage sections ... OK
> 
>  > * checking Rd contents ... OK
> 
>  > * checking for unstated dependencies in examples ... OK
> 
>  > * checking installed files from 'inst/doc' ... OK
> 
>  > * checking files in 'vignettes' ... OK
> 
>  > * checking examples ... ERROR
> 
>  > Running examples in 'cbaf-Ex.R' failed
> 
>  > The error most likely occurred in:
> 
>  >
> 
>  >> ### Name: automatedStatistics
> 
>  >> ### Title: Performing the requested statistics for various studies /
> 
>  >> ###   subgroups of a study.
> 
>  >> ### Aliases: automatedStatistics
> 
>  >>
> 
>  >> ### ** Examples
> 
>  >>
> 
>  >> automatedStatistics("test", obtainedDataType = "single study")
> 
>  > Error in automatedStatistics("test", obtainedDataType = "single study") :
> 
>  >    Please run one of the obtainSingleStudy() or 
> obtainMultipleStudies() functions first
> 
>  > Execution halted
> 
>  > * checking for unstated dependencies in vignettes ... OK
> 
>  > * checking package vignettes in 'inst/doc' ... OK
> 
>  > * checking running R code from vignettes ...
> 
>  >     'cbat.Rmd' using 'UTF-8' ... OK
> 
>  >   NONE
> 
>  > * checking re-building of vignette outputs ... OK
> 
>  > * checking PDF version of manual ... OK
> 
>  > * DONE
> 
>  > Status: 1 ERROR, 1 NOTE
> 
>  >
> 
>  > See
> 
>  >    'Z:/cbaf/Source code/cbaf.Rcheck/00check.log'
> 
>  > for details.
> 
>  >
> 
>  >
> 
>  > Exited with status 1.
> 
>  >
> 
>  >
> 
>  >             [[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.
> 


This email message may contain legally privileged and/or...{{dropped:2}}



More information about the Bioc-devel mailing list