Skip to content

Commit

Permalink
Merge branch 'devel' into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
cpanse authored Sep 30, 2024
2 parents fb19acc + cc1c4f2 commit 6cbef4c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: MsBackendRawFileReader
Type: Package
Title: Mass Spectrometry Backend for Reading Thermo Fisher Scientific raw Files
Version: 1.11.3
Version: 1.11.6
Authors@R: c(person(given = "Christian",
family = "Panse", email = "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-1975-3064")),
Expand All @@ -17,7 +17,7 @@ Imports:
MsCoreUtils,
S4Vectors,
IRanges,
rawrr (>= 1.10.1),
rawrr (>= 1.13.1),
utils,
BiocParallel
Suggests:
Expand Down
2 changes: 1 addition & 1 deletion R/MsBackendRawFileReader-functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ NULL
hdr_full <- .get_spectrum_metadata(x)

hdr <- cbind(hdr, hdr_full)

## Remove core spectra variables that contain only `NA`
hdr <- S4Vectors::DataFrame(hdr[, !(MsCoreUtils::vapply1l(hdr, function(z) all(is.na(z))) &
colnames(hdr) %in%
Expand Down
22 changes: 11 additions & 11 deletions R/MsBackendRawFileReader.R
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,19 @@ setMethod("peaksData", "MsBackendRawFileReader",
scanIndex, BPPARAM=BPPARAM)

rv <- lapply(pls, function(p){
if (all(c("centroid.mz", "centroid.intensity", "noises",
"resolutions", "baselines") %in% colnames(p))){
if (all(c("centroid.mZ", "centroid.intensity", "noises",
"resolutions", "baselines") %in% names(p))){

m <- as.matrix(cbind(p$centroid.mZ,
p$centroid.intensity,
p$noises,
p$resolutions,
p$baselines))
p$centroid.intensity))
## TODO(cp): add it
#p$noises,
#p$resolutions,
#p$baselines))

colnames(m) <- c("mz", "intensity",
"noises", "resolutions", "baselines")
}else if (all(c("centroid.mz", "centroid.intensity") %in% colnames(p) )){
colnames(m) <- c("mz", "intensity")
# "noises", "resolutions", "baselines")
}else if (all(c("centroid.mZ", "centroid.intensity") %in% names(p) )){
m <- as.matrix(cbind(p$centroid.mZ, p$centroid.intensity))
colnames(m) <- c("mz", "intensity")
}else if (length(p$mZ) > 0){
Expand All @@ -126,7 +127,7 @@ setMethod("peaksData", "MsBackendRawFileReader",
colnames(m) <- c("mz", "intensity")
}
else{
warning(paste0("Scan ", p$scan, " has an empyt peaklist!"))
warning(paste0("Scan ", p$scan, " has an empty peaklist!"))
m <- matrix(, 0, 2)
colnames(m) <- c("mz", "intensity")
}
Expand Down Expand Up @@ -171,7 +172,6 @@ setMethod("mz", "MsBackendRawFileReader", function(object, ..., BPPARAM = bppara
IRanges::NumericList(lapply(peaksData(object, BPPARAM = BPPARAM), "[", , 1), compress = FALSE)
})


#' @exportMethod filterScan
#' @rdname MsBackendRawFileReader
#' @param object MsBackendRawFileReader object
Expand Down
1 change: 1 addition & 0 deletions tests/testthat.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ be <- Spectra::backendInitialize(MsBackendRawFileReader::MsBackendRawFileReader(
files = c(sample_raw_file))

## Run the MsBackend spectra variable test suite

test_suite <- system.file("test_backends", "test_MsBackend",
package = "Spectra")

Expand Down

0 comments on commit 6cbef4c

Please sign in to comment.