sgibb / MALDIquant

Quantitative Analysis of Mass Spectrometry Data
https://strimmerlab.github.io/software/maldiquant/
60 stars 25 forks source link

On disk vector #62

Open dsammour opened 5 years ago

dsammour commented 5 years ago

Hi Sebastian,

This a pull request based on OnDiskVector class. I have the following comments:

 .isModified.OnDiskVector <- function(x) {
     m <- readBin(x@mpath, integer(), n=1L, size=NA_integer_, endian="little")
     if (m != x@modification)
        stop(x@path, " was modified by a different object.")
     FALSE
 }

I work solely on imzML files, there you'll inevitably need to modify the OnDiskVector (mass and/or intensity) via assignments such as:

s <- calibrateIntensity(s) # s is a list of MassSpectraOnDisk

Whenever this is called, the above check will through an error. To circumvent this, we will need to write separate methods for MassSpectraOnDisk where the following call would be enough:

calibrateIntensity(s) # s is a list of MassSpectraOnDisk

namely:

#intensity-methods
 if (length(object@intensity) == length(value)) {
    object@intensity <- as.double(value)
  } else {
    stop("Lengths of intensity(", length(object@intensity),
         ") and value (", length(value), ") have to be equal.")
}