Running 'celToApd.R' [161s]
  Running 'createApd.R' [186s]
  Running 'gtypeCelToPQ.R' [0s]
  Running 'readApdRectangle.R' [154s]
  Running 'readApdUnits.R' [0s]
  Running 'writeApdMap.R' [156s]
Running the tests in 'tests/celToApd.R' failed.
Complete output:
  > library("aroma.apd")
  Loading required package: affxparser
  aroma.apd v0.7.0 (2023-06-23 11:40:02 UTC) successfully loaded. See ?aroma.apd for help.
  > library("R.utils")  ## Arguments
  Loading required package: R.oo
  Loading required package: R.methodsS3
  R.methodsS3 v1.8.2 (2022-06-13 22:00:14 UTC) successfully loaded. See ?R.methodsS3 for help.
  R.oo v1.26.0 (2024-01-24 05:12:50 UTC) successfully loaded. See ?R.oo for help.
  
  Attaching package: 'R.oo'
  
  The following object is masked from 'package:R.methodsS3':
  
      throw
  
  The following objects are masked from 'package:methods':
  
      getClasses, getMethods
  
  The following objects are masked from 'package:base':
  
      attach, detach, load, save
  
  R.utils v2.12.3 (2023-11-18 01:00:02 UTC) successfully loaded. See ?R.utils for help.
  
  Attaching package: 'R.utils'
  
  The following object is masked from 'package:affxparser':
  
      findFiles
  
  The following object is masked from 'package:utils':
  
      timestamp
  
  The following objects are masked from 'package:base':
  
      cat, commandArgs, getOption, isOpen, nullfile, parse, use, warnings
  
  > 
  > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  > # 1. Scan for existing CEL files
  > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  > # a) Scan for CEL files
  > files <- list.files(pattern="[.](cel|CEL)$")
  > files <- files[!file.info(files)$isdir]
  > if (length(files) > 0 && require("affxparser")) {
  +   cat("Create an optimal read map for CEL file:", files[1], "\n")
  +   cdffile <- findCdf(readCelHeader(files[1])$chiptype)
  +   res <- cdfToApdMap(cdffile)
  + 
  +   cat("Converting CEL file to APD file:", files[1], "\n")
  +   apdfile <- celToApd(files[1])
  +   cat("Created APD file:", apdfile, "\n")
  +   file.remove(apdfile)
  + 
  +   cat("Converting CEL file to APD file with an optimized read map:", files[1], "\n")
  +   apdfile <- celToApd(files[1], mapType=res$mapType)
  +   cat("Created APD file:", apdfile, "\n")
  + 
  +   writeMap <- invertMap(res$readMap)
  +   for (file in files[-1]) {
  +     cat("Converting CEL file to APD file with an optimized read map:", file, "\n")
  +     apdfile <- celToApd(file, mapType=res$mapType, writeMap=writeMap)
  +     cat("Created APD file:", apdfile, "\n")
  +   }
  + } # if (length(files) > 0)
  > 
  > proc.time()
     user  system elapsed 
     0.32    0.12    0.40 
Running the tests in 'tests/createApd.R' failed.
Complete output:
  > library("aroma.apd")
  Loading required package: affxparser
  aroma.apd v0.7.0 (2023-06-23 11:40:02 UTC) successfully loaded. See ?aroma.apd for help.
  > 
  > # Float precision
  > .Machine$float.eps <- (2^((8-4)*8)*.Machine$double.eps)
  > tol <- .Machine$float.eps ^ 0.5
  > 
  > 
  > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  > # 1. Create an Affymetrix Probe Signal (APD) file for a
  > #    'Mapping50K_Hind240' with 1600-by-1600 probes.
  > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  > chipType <- "Mapping50K_Hind240"
  > nbrOfCells <- 1600^2
  > 
  > pathname <- paste(tempfile(), "apd", sep=".")
  > createApd(pathname, nbrOfCells=nbrOfCells, chipType=chipType)
  > 
  > # File size
  > cat("File name:", pathname, "\n")
  File name: D:\temp\Rtmpcd3njU\file11dc01e737c6a.apd 
  > cat("File size:", file.info(pathname)$size, "bytes\n")
  File size: 10244369 bytes
  > cat("APD header:\n")
  APD header:
  > header <- readApdHeader(pathname)
  Warning messages:
  1: In readChar(con = con, nchars = 64) :
    truncating string with embedded nuls
  2: In readChar(con = con, nchars = 16) :
    truncating string with embedded nuls
  > print(header)
  $creator
  [1] "R package aroma.snp by Henrik Bengtsson"
  
  $dataType
  [1] "float"
  
  $bytesPerCell
  [1] "4"
  
  $RStorageMode
  [1] "double"
  
  $chipType
  [1] "Mapping50K_Hind240"
  
  $nbrOfProbes
  [1] 2560000
  
  > 
  > 
  > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  > # 2. Update the signals for a subset of probes
  > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  > cells <- c(1, 1100:1120, 220:201, 998300:999302)
  > signals <- log(cells+1, base=2)  # Fake signals
  > updateApd(pathname, indices=cells, data=signals)
  Warning messages:
  1: In readChar(con = con, nchars = 64) :
    truncating string with embedded nuls
  2: In readChar(con = con, nchars = 16) :
    truncating string with embedded nuls
  > 
  > 
  > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  > # 3. Re-read the signals for a subset of probes
  > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  > apd <- readApd(pathname, indices=cells)
  Warning messages:
  1: In readChar(con = con, nchars = 64) :
    truncating string with embedded nuls
  2: In readChar(con = con, nchars = 16) :
    truncating string with embedded nuls
  > 
  > # Signals in APD files are stored as floats (since this is
  > # the precision in CEL files).
  > stopifnot(all.equal(signals, apd$intensities, tolerance=tol))
  > 
  > 
  > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  > # 4. Re-read the signals for a subset of probes
  > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  > if (require("affxparser")) {
  +   cdfFile <- findCdf(chipType)
  +   if (length(cdfFile) > 0) {
  + 
  +     apd <- readApdUnits(pathname, units=100:104)
  + 
  +     # Sample new data (with one decimal precision)
  +     apd2 <- lapply(apd, function(unit) {
  +       lapply(unit, function(groups) {
  +         n <- length(groups$intensities)
  +         values <- as.integer(runif(n, max=655350))/10
  +         list(intensities=values)
  +       })
  +     })
  + 
  +     # Update APD file with new data
  +     updateApdUnits(pathname, units=100:104, data=apd2)
  + 
  +     # Re-read data to verify correctness
  +     apd <- readApdUnits(pathname, units=100:104)
  + 
  +     # Signals in APD files are stored as floats (since this is
  +     # the precision in CEL files).
  +     stopifnot(all.equal(apd2, apd, tolerance=tol))
  +   } # if (length(cdfFile) > 0 ...)
  + } # if (require("affxparser"))
  > 
  > 
  > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  > # 4. Clean up
  > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  > file.remove(pathname)
  [1] TRUE
  > 
  > proc.time()
     user  system elapsed 
     2.81   19.03   22.34 
Running the tests in 'tests/readApdRectangle.R' failed.
Complete output:
  > library("aroma.apd")
  Loading required package: affxparser
  aroma.apd v0.7.0 (2023-06-23 11:40:02 UTC) successfully loaded. See ?aroma.apd for help.
  > 
  > # Local functions
  > rotate270 <- function(x, ...) {
  +   x <- t(x)
  +   nc <- ncol(x)
  +   if (nc < 2) return(x)
  +   x[,nc:1,drop=FALSE]
  + }
  > 
  > # Scan current directory for APD files
  > files <- list.files(pattern="[.](apd|APD)$")
  > files <- files[!file.info(files)$isdir]
  > if (length(files) > 0) {
  +   apdFile <- files[1]
  + 
  +   # Read APD intensities in the upper left corner
  +   apd <- readApdRectangle(apdFile, xrange=c(0,250), yrange=c(0,250))
  +   z <- rotate270(apd$intensities)
  +   sub <- paste("Chip type:", apd$header$chipType)
  +   image(z, col=gray.colors(256), axes=FALSE, main=apdFile, sub=sub)
  +   text(x=0, y=1, labels="(0,0)", adj=c(0,-0.7), cex=0.8, xpd=TRUE)
  +   text(x=1, y=0, labels="(250,250)", adj=c(1,1.2), cex=0.8, xpd=TRUE)
  + }
  > 
  > proc.time()
     user  system elapsed 
     0.28    0.09    0.31 
Running the tests in 'tests/writeApdMap.R' failed.
Complete output:
  > library("aroma.apd")
  Loading required package: affxparser
  aroma.apd v0.7.0 (2023-06-23 11:40:02 UTC) successfully loaded. See ?aroma.apd for help.
  > library("R.utils") # Arguments
  Loading required package: R.oo
  Loading required package: R.methodsS3
  R.methodsS3 v1.8.2 (2022-06-13 22:00:14 UTC) successfully loaded. See ?R.methodsS3 for help.
  R.oo v1.26.0 (2024-01-24 05:12:50 UTC) successfully loaded. See ?R.oo for help.
  
  Attaching package: 'R.oo'
  
  The following object is masked from 'package:R.methodsS3':
  
      throw
  
  The following objects are masked from 'package:methods':
  
      getClasses, getMethods
  
  The following objects are masked from 'package:base':
  
      attach, detach, load, save
  
  R.utils v2.12.3 (2023-11-18 01:00:02 UTC) successfully loaded. See ?R.utils for help.
  
  Attaching package: 'R.utils'
  
  The following object is masked from 'package:affxparser':
  
      findFiles
  
  The following object is masked from 'package:utils':
  
      timestamp
  
  The following objects are masked from 'package:base':
  
      cat, commandArgs, getOption, isOpen, nullfile, parse, use, warnings
  
  > 
  > verbose <- Arguments$getVerbose(TRUE)
  > 
  > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  > # 1. Scan for existing CEL files
  > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  > # a) Scan current directory for CEL files
  > files <- list.files(pattern="[.](cel|CEL)$")
  > files <- files[!file.info(files)$isdir]
  > if (length(files) > 0 && require("affxparser")) {
  +   # b) Corresponding APD filenames
  +   celNames <- files
  +   apdNames <- gsub(pattern, ".apd", files)
  + 
  + 
  +   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  +   # 1. Copy the probe intensities from a CEL to an APD file
  +   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  +   for (kk in 1) {
  +     verbose && enter(verbose, "Reading CEL file #", kk)
  +     cel <- readCel(celNames[kk])
  +     verbose && exit(verbose)
  + 
  +     chipType <- cel$header$chiptype
  +     verbose && enter(verbose, "Getting read map for '", chipType, "'")
  +     mapType <- chipType
  +     mapFile <- paste(mapType, ".apm", sep="")
  +     if (file.exists(mapFile)) {
  +       verbose && enter(verbose, "Reading read map from APD map file")
  +       readMap <- readApdMap(mapFile)$map
  +       verbose && exit(verbose)
  +     } else {
  +       verbose && enter(verbose, "Generating read map from CDF file")
  +       cdfFile <- findCdf(chipType)
  +       readMap <- readCdfUnitsMap(cdfFile)
  +       writeApdMap(mapFile, map=readMap)
  +       verbose && exit(verbose)
  +     }
  +     verbose && exit(verbose)
  + 
  +     if (!file.exists(apdNames[kk])) {
  +       verbose && enter(verbose, "Calculating write map from read map")
  +       writeMap <- invertMap(readMap)
  +       verbose && exit(verbose)
  + 
  +       verbose && enter(verbose, "Creating APD file #", kk)
  +       writeApd(apdNames[kk], data=cel$intensities, chipType=chipType,
  +                                      mapType=mapType, writeMap=writeMap)
  +       verbose && exit(verbose)
  +       rm(writeMap)
  +     }
  + 
  +     verbose && enter(verbose, "Verifying APD file #", kk)
  +     apd <- readApd(apdNames[kk], readMap=readMap)
  +     verbose && exit(verbose)
  +     stopifnot(identical(apd$intensities, cel$intensities))
  + 
  +     rm(cel, mapType, mapFile, apd)
  +   }
  + 
  + 
  +   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  +   # 2. Read a subset of the units
  +   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  +   units <- c(1, 20:205)
  +   cel <- readCelUnits(celNames[1], units=units)
  +   apd <- readApdUnits(apdNames[1], units=units)
  +   stopifnot(identical(apd, cel))
  + 
  + 
  +   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  +   # 3. Benchmark reading with and without read map
  +   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  +   # To minimize the overhead from searching for and reading CDF
  +   # file when benchmarking, we read the CDF already here
  +   cdfFile <- findCdf(chipType)
  +   cdf <- readCdfCellIndices(cdfFile, units=units)
  + 
  +   cat("Benchmarks for read APD file:\n")
  +   t0 <- system.time({
  +     # Approximately 10 times faster than without a read map
  +     apd <- readApdUnits(apdNames[1], cdf=cdf, readMap=readMap)
  +   })[3]
  +   cat(sprintf("a) with read map by vector: %.3fs [ 1.00x]\n", t0))
  + 
  +   t <- system.time({
  +     apd <- readApdUnits(apdNames[1], cdf=cdf)
  +   })[3]
  +   cat(sprintf("b) with read map from file: %.3fs [%5.2fx]\n", t, t/t0))
  + 
  +   t <- system.time({
  +     # Force no read map to be used
  +     apd <- readApdUnits(apdNames[1], cdf=cdf, readMap=NULL)
  +   })[3]
  +   cat(sprintf("c) without read map       : %.3fs [%5.2fx]\n", t, t/t0))
  + } # if (length(files) > 0)
  > 
  > proc.time()
     user  system elapsed 
     0.28    0.09    0.35