MALDIquant
MALDIquant copied to clipboard
On disk vector
Hi Sebastian,
This a pull request based on OnDiskVector class. I have the following comments:
- while I find tracking changes to the OnDiskVector a good idea, I think the following check defeats its purpose (it is commented-out in this pull request):
.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
- in
.transformIntensity, wouldn't the following part violate themassandintensityassignments ?
#.transformIntensity
if (na.rm) {
naIdx <- which(!is.na(object@intensity))
object@intensity <- object@intensity[naIdx]
object@mass <- object@mass[naIdx]
}
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.")
}