Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failure: length > 1 in coercion to logical #44

Open
sneumann opened this issue Jan 27, 2020 · 1 comment
Open

failure: length > 1 in coercion to logical #44

sneumann opened this issue Jan 27, 2020 · 1 comment

Comments

@sneumann
Copy link
Owner

After the BioC build farm has enabled _R_CHECK_LENGTH_1_LOGIC2_
(see https://stat.ethz.ch/pipermail/bioc-devel/2020-January/016081.html for details)
we get a build error http://bioconductor.org/checkResults/devel/bioc-LATEST/CAMERA/malbec2-checksrc.html , see below for a copy.

Chances are good that the issue is here:

if(!is.infinite(ini) && length(ini) > 0){

So what's left is to figure how to safely fix this code.

Yours, Steffen

* checking examples ... ERROR
Running examples in ‘CAMERA-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: annotate-methods
> ### Title: Automatic deconvolution/annotation of LC/ESI-MS data
> ### Aliases: annotate annotate,xcmsSet-method
> ### Keywords: methods
> 
> ### ** Examples
> 
>  library(CAMERA)
>  file <- system.file('mzdata/MM14.mzdata', package = "CAMERA")
>  xs   <- xcmsSet(file, method="centWave", ppm=30, peakwidth=c(5,10))
Detecting mass traces at 30 ppm ... OK
Detecting chromatographic peaks in 456 regions of interest ... OK: 126 found.
>  xsa  <- annotate(xs)
Start grouping after retention time.
Created 14 pseudospectra.
Generating peak matrix!
Run isotope peak annotation
 % finished: 20   ----------- FAILURE REPORT -------------- 
 --- failure: length > 1 in coercion to logical ---
 --- srcref --- 
: 
 --- package (from environment) --- 
CAMERA
 --- call from context --- 
FUN(newX[, i], ...)
 --- call from argument --- 
!is.infinite(ini) && length(ini) > 0
 --- R stacktrace ---
where 1: FUN(newX[, i], ...)
where 2: apply(hits.iso[!hit, , drop = FALSE], 1, function(x) {
    if (!all(is.na(x))) {
        ini <- which(x > iso)
        if (!is.infinite(ini) && length(ini) > 0) {
            x[min(ini):ncol(hits.iso)] <- NA
        }
    }
    x
})
where 3: t(apply(hits.iso[!hit, , drop = FALSE], 1, function(x) {
    if (!all(is.na(x))) {
        ini <- which(x > iso)
        if (!is.infinite(ini) && length(ini) > 0) {
            x[min(ini):ncol(hits.iso)] <- NA
        }
    }
    x
}))
where 4: findIsotopesPspec(isomatrix, mz, ipeak, int, params)
where 5: findIsotopes(xa, maxcharge = maxcharge, maxiso = maxiso, ppm = ppm, 
    mzabs = mzabs, intval = intval, minfrac = minfrac)
where 6: findIsotopes(xa, maxcharge = maxcharge, maxiso = maxiso, ppm = ppm, 
    mzabs = mzabs, intval = intval, minfrac = minfrac)
where 7: annotate(xs)
where 8: annotate(xs)

 --- value of length: 2 type: logical ---
   2    3 
TRUE TRUE 
 --- function from context --- 
function (x) 
{
    if (!all(is.na(x))) {
        ini <- which(x > iso)
        if (!is.infinite(ini) && length(ini) > 0) {
            x[min(ini):ncol(hits.iso)] <- NA
        }
    }
    x
}
<bytecode: 0x55a4ac4776c0>
<environment: 0x55a4ac473030>
 --- function search by body ---
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: length > 1 in coercion to logical
@sneumann
Copy link
Owner Author

For the record, there are more cases of && that trigger errors in

if(length(sampnames(xs)) > 1 && !nrow(xs@groups) > 0) {

and
if(object@sample == 1 && length(sampnames(object@xcmsSet)) == 1){

Several cases now fixed in bc0e9fd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant