Running ‘test_constructors.R’ [6s/10s]
  Running ‘test_csr_filter.R’ [5s/8s]
  Running ‘test_ext_data.R’ [5s/8s]
  Running ‘test_global_ref_filter.R’ [5s/9s]
  Running ‘test_pixel_count_filter.R’ [5s/7s]
Running the tests in ‘tests/test_csr_filter.R’ failed.
Complete output:
  > # Test cmplete spatial randomness
  > 
  > library(testthat)
  > library(SPUTNIK)
  > 
  > test_that("CSR filter", {
  +   x <- bladderMALDIRompp2010(verbose = TRUE)
  +   mz <- attr(x, "mass")
  +   shape <- attr(x, "size")
  + 
  +   msX <- msiDataset(values = x, mz = mz, rsize = shape[1], csize = shape[2])
  +   msX <- normIntensity(msX, "PQN")
  +   msX <- varTransform(msX, "log2")
  +   
  +   ticImg <- totalIonCountMSI(msX)
  +   roi <- refImageBinaryOtsu(ticImg)
  +   
  +   # Reduce M/Z list for quick test
  +   mz.mask <- msX@mz >= 800
  +   msX@matrix <- msX@matrix[, mz.mask]
  +   msX@mz <- msX@mz[mz.mask]
  + 
  +   cat("Clark-Evans test...")
  +   csrCE <- CSRPeaksFilter(msX,
  +     method = "ClarkEvans",
  +     adjMethod = "bonferroni",
  +     returnQvalues = TRUE,
  +     plotCovariate = FALSE,
  +     verbose = TRUE
  +   )
  + 
  +   cat("Passing covariate as argument for Kolmogorov-Smirnov test...")
  +   set.seed(123)
  +   csrKS <- CSRPeaksFilter(msX,
  +     method = "KS",
  +     covariateImage = roi, # Calculate the covariate
  +     adjMethod = "bonferroni",
  +     returnQvalues = TRUE,
  +     plotCovariate = FALSE,
  +     verbose = TRUE
  +   )
  + 
  +   expect_is(csrCE, "list")
  +   expect_equal(attr(csrCE, "names"), c("p.value", "q.value"))
  +   expect_is(csrKS, "list")
  +   expect_equal(attr(csrKS, "names"), c("p.value", "q.value"))
  + 
  +   csrFiltCE <- createPeaksFilter(which(csrCE$q.value < 0.05))
  +   csrFiltKS <- createPeaksFilter(which(csrKS$q.value < 0.05))
  + 
  +   expect_equal(length(csrFiltCE$sel.peaks), 83)
  +   expect_equal(length(csrFiltKS$sel.peaks), 133)
  + })
  Downloading the data from the repository...
  trying URL 'https://raw.github.com/paoloinglese/SPUTNIKexamples/master/data/maldiData.rda'
  ── Warning (???): CSR filter ───────────────────────────────────────────────────
  downloaded length 0 != reported length 516
  Backtrace:
   1. SPUTNIK::bladderMALDIRompp2010(verbose = TRUE)
   6. utils::download.file(addr, z, mode = "wb")
  
  ── Warning (???): CSR filter ───────────────────────────────────────────────────
  cannot open URL 'https://raw.github.com/paoloinglese/SPUTNIKexamples/master/data/maldiData.rda': HTTP status was '503 Service Unavailable'
  Backtrace:
   1. SPUTNIK::bladderMALDIRompp2010(verbose = TRUE)
   6. utils::download.file(addr, z, mode = "wb")
  
  ── Error (???): CSR filter ─────────────────────────────────────────────────────
  Error in `download.file(addr, z, mode = "wb")`: cannot open URL 'https://raw.github.com/paoloinglese/SPUTNIKexamples/master/data/maldiData.rda'
  Backtrace:
   1. SPUTNIK::bladderMALDIRompp2010(verbose = TRUE)
   2. base::tryCatch(...)
   3. base (local) tryCatchList(expr, classes, parentenv, handlers)
   4. base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
   5. value[[3L]](cond)
  
  Error in reporter$stop_if_needed() : Test failed
  Calls: test_that -> <Anonymous>
  Execution halted
Running the tests in ‘tests/test_ext_data.R’ failed.
Complete output:
  > # Test external data
  > 
  > library(testthat)
  > library(SPUTNIK)
  > 
  > # MALDI-MSI example
  > 
  > test_that("bladder MALDI-MSI", {
  +   x <- bladderMALDIRompp2010(verbose = TRUE)
  +   expect_equal(length(attr(x, "mass")), 1175)
  +   expect_equal(attr(x, "size"), c(260, 134))
  +   expect_equal(dim(x), c(34840, 1175))
  + })
  Downloading the data from the repository...
  trying URL 'https://raw.github.com/paoloinglese/SPUTNIKexamples/master/data/maldiData.rda'
  ── Warning (???): bladder MALDI-MSI ────────────────────────────────────────────
  downloaded length 0 != reported length 516
  Backtrace:
   1. SPUTNIK::bladderMALDIRompp2010(verbose = TRUE)
   6. utils::download.file(addr, z, mode = "wb")
  
  ── Warning (???): bladder MALDI-MSI ────────────────────────────────────────────
  cannot open URL 'https://raw.github.com/paoloinglese/SPUTNIKexamples/master/data/maldiData.rda': HTTP status was '503 Service Unavailable'
  Backtrace:
   1. SPUTNIK::bladderMALDIRompp2010(verbose = TRUE)
   6. utils::download.file(addr, z, mode = "wb")
  
  ── Error (???): bladder MALDI-MSI ──────────────────────────────────────────────
  Error in `download.file(addr, z, mode = "wb")`: cannot open URL 'https://raw.github.com/paoloinglese/SPUTNIKexamples/master/data/maldiData.rda'
  Backtrace:
   1. SPUTNIK::bladderMALDIRompp2010(verbose = TRUE)
   2. base::tryCatch(...)
   3. base (local) tryCatchList(expr, classes, parentenv, handlers)
   4. base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
   5. value[[3L]](cond)
  
  Error in reporter$stop_if_needed() : Test failed
  Calls: test_that -> <Anonymous>
  Execution halted
Running the tests in ‘tests/test_global_ref_filter.R’ failed.
Complete output:
  > # Test global reference filter
  > 
  > library(testthat)
  > library(SPUTNIK)
  > 
  > test_that("global reference filter", {
  +   x <- bladderMALDIRompp2010(verbose = TRUE)
  +   mz <- attr(x, "mass")
  +   shape <- attr(x, "size")
  + 
  +   msX <- msiDataset(values = x, mz = mz, rsize = shape[1], csize = shape[2])
  +   msX <- normIntensity(msX, "median")
  +   msX <- varTransform(msX, "log2")
  +   
  +   refImg <- refImageContinuous(msX, method = "sum")
  +   roiImg <- refImageBinaryOtsu(refImg)
  + 
  +   cat("similarity: pearson
  + ")
  +   gpfPearson <- globalPeaksFilter(
  +     msiData = msX, referenceImage = refImg,
  +     method = "pearson", threshold = 0
  +   )
  +   cat("similarity: spearman
  + ")
  +   gpfSpearman <- globalPeaksFilter(
  +     msiData = msX, referenceImage = refImg,
  +     method = "spearman", threshold = 0
  +   )
  +   cat("similarity: ssim
  + ")
  +   gpfSSIM <- globalPeaksFilter(
  +     msiData = msX, referenceImage = refImg,
  +     method = "ssim",
  +     threshold = 0
  +   )
  +   cat("similarity: nmi
  + ")
  +   gpfNMI <- globalPeaksFilter(
  +     msiData = msX, referenceImage = roiImg,
  +     method = "nmi", threshold = 0
  +   )
  + 
  +   expect_is(gpfPearson, "list")
  +   expect_equal(attr(gpfPearson, "peak.filter"), T)
  +   expect_equal(attr(gpfPearson, "filter"), "globalPeaks")
  +   expect_is(gpfSpearman, "list")
  +   expect_equal(attr(gpfSpearman, "peak.filter"), T)
  +   expect_equal(attr(gpfSpearman, "filter"), "globalPeaks")
  +   expect_is(gpfSSIM, "list")
  +   expect_equal(attr(gpfSSIM, "peak.filter"), T)
  +   expect_equal(attr(gpfSSIM, "filter"), "globalPeaks")
  +   expect_is(gpfNMI, "list")
  +   expect_equal(attr(gpfNMI, "peak.filter"), T)
  +   expect_equal(attr(gpfNMI, "filter"), "globalPeaks")
  + 
  +   expect_equal(length(gpfPearson$sel.peaks), 502)
  +   expect_equal(length(gpfSpearman$sel.peaks), 586)
  +   expect_equal(length(gpfSSIM$sel.peaks), 1125)
  +   expect_equal(length(gpfNMI$sel.peaks), 515)
  + })
  Downloading the data from the repository...
  trying URL 'https://raw.github.com/paoloinglese/SPUTNIKexamples/master/data/maldiData.rda'
  ── Warning (???): global reference filter ──────────────────────────────────────
  downloaded length 0 != reported length 516
  Backtrace:
   1. SPUTNIK::bladderMALDIRompp2010(verbose = TRUE)
   6. utils::download.file(addr, z, mode = "wb")
  
  ── Warning (???): global reference filter ──────────────────────────────────────
  cannot open URL 'https://raw.github.com/paoloinglese/SPUTNIKexamples/master/data/maldiData.rda': HTTP status was '503 Service Unavailable'
  Backtrace:
   1. SPUTNIK::bladderMALDIRompp2010(verbose = TRUE)
   6. utils::download.file(addr, z, mode = "wb")
  
  ── Error (???): global reference filter ────────────────────────────────────────
  Error in `download.file(addr, z, mode = "wb")`: cannot open URL 'https://raw.github.com/paoloinglese/SPUTNIKexamples/master/data/maldiData.rda'
  Backtrace:
   1. SPUTNIK::bladderMALDIRompp2010(verbose = TRUE)
   2. base::tryCatch(...)
   3. base (local) tryCatchList(expr, classes, parentenv, handlers)
   4. base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
   5. value[[3L]](cond)
  
  Error in reporter$stop_if_needed() : Test failed
  Calls: test_that -> <Anonymous>
  Execution halted
Running the tests in ‘tests/test_pixel_count_filter.R’ failed.
Complete output:
  > # Test pixel count filter
  > 
  > library(testthat)
  > library(SPUTNIK)
  > 
  > test_that("pixel count filter", {
  +   MIN_NUM_PIXELS <- 9
  + 
  +   x <- bladderMALDIRompp2010(verbose = TRUE)
  +   mz <- attr(x, "mass")
  +   shape <- attr(x, "size")
  + 
  +   msX <- msiDataset(values = x, mz = mz, rsize = shape[1], csize = shape[2])
  +   msX <- normIntensity(msX, "PQN")
  +   msX <- varTransform(msX, "log2")
  +   
  +   refImg <- refImageContinuous(msX, method = "sum")
  +   roiImg <- refImageBinaryOtsu(refImg)
  +   
  +   cpfAggr0 <- countPixelsFilter(
  +     msiData = msX, roiImage = roiImg,
  +     minNumPixels = MIN_NUM_PIXELS, aggressive = 0
  +   )
  +   cpfAggr1 <- countPixelsFilter(
  +     msiData = msX, roiImage = roiImg,
  +     minNumPixels = MIN_NUM_PIXELS, aggressive = 1
  +   )
  +   cpfAggr2 <- countPixelsFilter(
  +     msiData = msX, roiImage = roiImg,
  +     minNumPixels = MIN_NUM_PIXELS, aggressive = 2
  +   )
  +   expect_is(cpfAggr0, "list")
  +   expect_equal(attr(cpfAggr0, "peak.filter"), T)
  +   expect_equal(attr(cpfAggr0, "filter"), "countPixels")
  +   expect_is(cpfAggr1, "list")
  +   expect_equal(attr(cpfAggr1, "peak.filter"), T)
  +   expect_equal(attr(cpfAggr1, "filter"), "countPixels")
  +   expect_is(cpfAggr2, "list")
  +   expect_equal(attr(cpfAggr2, "peak.filter"), T)
  +   expect_equal(attr(cpfAggr2, "filter"), "countPixels")
  + 
  +   # Number of selected peaks must be: numAggressive0 >= numAggressive1 >=
  +   # numAggressive >= 2
  +   expect_true((length(cpfAggr0$sel.peaks) >= length(cpfAggr1$sel.peaks)) &&
  +     (length(cpfAggr0$sel.peaks) >= length(cpfAggr2$sel.peaks)) &&
  +     (length(cpfAggr1$sel.peaks) >= length(cpfAggr2$sel.peaks)))
  +   expect_equal(length(cpfAggr0$sel.peaks), 174)
  +   expect_equal(length(cpfAggr1$sel.peaks), 152)
  +   expect_equal(length(cpfAggr2$sel.peaks), 86)
  + })
  Downloading the data from the repository...
  trying URL 'https://raw.github.com/paoloinglese/SPUTNIKexamples/master/data/maldiData.rda'
  ── Warning (???): pixel count filter ───────────────────────────────────────────
  downloaded length 0 != reported length 516
  Backtrace:
   1. SPUTNIK::bladderMALDIRompp2010(verbose = TRUE)
   6. utils::download.file(addr, z, mode = "wb")
  
  ── Warning (???): pixel count filter ───────────────────────────────────────────
  cannot open URL 'https://raw.github.com/paoloinglese/SPUTNIKexamples/master/data/maldiData.rda': HTTP status was '503 Service Unavailable'
  Backtrace:
   1. SPUTNIK::bladderMALDIRompp2010(verbose = TRUE)
   6. utils::download.file(addr, z, mode = "wb")
  
  ── Error (???): pixel count filter ─────────────────────────────────────────────
  Error in `download.file(addr, z, mode = "wb")`: cannot open URL 'https://raw.github.com/paoloinglese/SPUTNIKexamples/master/data/maldiData.rda'
  Backtrace:
   1. SPUTNIK::bladderMALDIRompp2010(verbose = TRUE)
   2. base::tryCatch(...)
   3. base (local) tryCatchList(expr, classes, parentenv, handlers)
   4. base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
   5. value[[3L]](cond)
  
  Error in reporter$stop_if_needed() : Test failed
  Calls: test_that -> <Anonymous>
  Execution halted