Skip to content

Commit

Permalink
fix: fix coercion method from XcmsExperiment to XCMSnExp
Browse files Browse the repository at this point in the history
  • Loading branch information
jorainer committed Aug 5, 2024
1 parent d0c71d0 commit 1bd6d3d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions R/XcmsExperiment-functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -1168,8 +1168,8 @@ XcmsExperiment <- function() {
files = fileNames(from),
smoothed = NA)
n@phenoData <- new("NAnnotatedDataFrame", as.data.frame(sampleData(from)))
fd <- as.data.frame(spectra(from)@backend@spectraData)
fd$fileIdx <- match(fd$dataStorage, fileNames(from))
fd <- as.data.frame(MsExperiment::spectra(from)@backend@spectraData)
fd$fileIdx <- match(fd$dataStorage, unique(fd$dataStorage))
fd <- fd[, !colnames(fd) %in% c("dataStorage", "dataOrigin")]
colnames(fd) <- sub("scanIndex", "spIdx", colnames(fd))
colnames(fd) <- sub("rtime", "retentionTime", colnames(fd))
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test_XcmsExperiment-functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ test_that(".xcms_experiment_to_xcms_n_exp works", {

a <- loadXcmsData("xmse")
a1 <- a[1]
a1@spectra <- Spectra::setBackend(spectra(a1), MsBackendMemory())
a1@spectra <- Spectra::setBackend(spectra(a1), Spectra::MsBackendMemory())
expect_error(xcms:::.xcms_experiment_to_xcms_n_exp(a1), "MsBackendMzR")

res <- xcms:::.xcms_experiment_to_xcms_n_exp(a)
Expand Down

0 comments on commit 1bd6d3d

Please sign in to comment.