[Bioc-devel] How to recreate R CMD BUILD environment in interactive session?

Hervé Pagès hpages at fredhutch.org
Mon Oct 23 22:40:13 CEST 2017

Hi Elizabeth,

Thanks for troubleshooting this.

Note that testing with identical()/checkIdentical() is safer than with 
'any(sort(colnames1) != sort(colnames2))'. The latter won't do the
right thing if 'colnames1' and 'colnames2' have different lengths.


On 10/23/2017 01:06 PM, Elizabeth Purdom wrote:
> Dear Martin,
> Just for completeness, I figured out the discrepancy and solved my problem. In my check, I check that the column names contain the expected names and I didn’t want to make the order required in a certain way so I used sort -- but only of one side because I naively assumed the other side would be fixed:
> any(sort(colnames(object at merge_nodeMerge)) != c('Contrast','isMerged','mergeClusterId','Node’)
> But the different environments are sorting differently!
> In my normal interactive R session:
>> sort(c("Contrast", "isMerged", "mergeClusterId", "Node"))
> [1] "Contrast"       "isMerged"       "mergeClusterId" "Node"
> In the build version of R however:
> Browse[2]> sort(c("Contrast", "isMerged", "mergeClusterId", "Node"))
> [1] "Contrast"       "Node"           "isMerged"       "mergeClusterId"
> Thank you very much for your help in getting an interactive session in the build environment!
> Elizabeth
>> On Oct 23, 2017, at 4:35 PM, Martin Morgan <martin.morgan at roswellpark.org> wrote:
>> On 10/23/2017 09:59 AM, Elizabeth Purdom wrote:
>>>> On Oct 23, 2017, at 3:47 PM, Martin Morgan <martin.morgan at roswellpark.org <mailto:martin.morgan at roswellpark.org>> wrote:
>>>> On 10/23/2017 09:26 AM, Elizabeth Purdom wrote:
>>>>> Hello,
>>>>> I am updating an existing package and I am getting an error in running my vignette (and a similar error in an example in help pages) but ONLY when I run R CMD BUILD. I can’t recreate the error in any session where I can debug and figure out what is happening. So my question is how can I recreate the exact environment of R CMD BUILD that runs the vignette but in an interactive session so that I can figure out what is going on?
>>>>> I have tried reproducing the error in other environments:
>>>>> * Running R —vanilla interactively and trying the code manually
>>>>> * running purl on my vignette to get pure R code and running just the R code with R CMD BATCH —vanilla
>>>> hint on the specific package and / or error message?
>>>> My approach would be to install the package, Stangle / purl the vignette, and R -f vignette.R, then trim the vignette to a fast reproducible case. But it sounds like you're doing that...
>>>> Martin
>>> Yes, that is what I tried but did not get the error from the R code.
>>> And I apologize, it’s the `clusterExperiment` package. My error was so specific to the class created by my package that I didn’t think it would be useful, but here is the relevant error message:
>>> Quitting from lines 271-272 (clusterExperimentTutorial.Rmd)
>>> Error: processing vignette 'clusterExperimentTutorial.Rmd' failed with diagnostics:
>>> invalid class "ClusterExperiment" object: merge_nodeMerge must have 4 columns and column names equal to: 'Node','Contrast','isMerged','mergeClusterId'
>>> Execution halted
>>> I would note that my vignette calls an object that is saved as a data object as part of my package to speed up compilation. But I experimented and you can also switch it so that it creates the object from scratch and doesn’t load the object, and it runs into the same error. There is a `LazyData: false` in my DESCRIPTION File, because I was having problems with my R data object, because it is of the class I make with my package, and without the package loaded there was some problem loading it.
>> I can reproduce the error with
>> clusterExperiment/vignettes master$ R_DEFAULT_PACKAGES= LC_COLLATE=C R -f clusterExperimentTutorial.R
>> leading to
>>> ## ----recallRSEC------------------------------------------------------------
>>> rsecFluidigm<-RSEC(rsecFluidigm,isCount=TRUE,combineProportion=0.6,mergeMethod="JC",mergeCutoff=0.05)
>> Error in validObject(.Object) :
>>   invalid class "ClusterExperiment" object: merge_nodeMerge must be data.frame with 4 columns and column names equal to: 'Node','Contrast','isMerged','mergeClusterId'
>> Calls: RSEC ... .local -> new -> initialize -> initialize -> validObject
>> Execution halted
>> and then for work inside R
>> clusterExperiment/vignettes$ R_DEFAULT_PACKAGES= LC_COLLATE=C R
>> Bioconductor version 3.6 (BiocInstaller 1.27.7), ?biocLite for help
>>> source("clusterExperimentTutorial.R", echo=TRUE, max=Inf)
>> Does that set you down the right path?
>> Martin
>> 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.
> 	[[alternative HTML version deleted]]
> _______________________________________________
> Bioc-devel at r-project.org mailing list
> https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_bioc-2Ddevel&d=DwIGaQ&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=3O1928D4_siHrVAZeKxKOXOeKeLFslkcQGPRdXb_YSk&s=_-4eL50gxWxWGFjisSH08OY5LgD1bmPVPvowL13m7_E&e=

Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages at fredhutch.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319

More information about the Bioc-devel mailing list