Skip to content

Commit

Permalink
Remove code reading header in spectrapply
Browse files Browse the repository at this point in the history
- Remove the code inserted to fix issue #170; fixes issue #216.
- Add tests to the torture.R script checking if the #170 error still happens.
  • Loading branch information
jorainer committed May 30, 2017
1 parent 69ca00f commit a69c174
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/functions-OnDiskMSnExp.R
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ precursorValue_OnDiskMSnExp <- function(object, column) {
## Reading the header for the selecte spectra. This is to avoid getting
## "memory not mapped" errors when reading mz and intensity values from
## certain mzML files (issue #170).
hd_spectra <- mzR::header(fileh, fData$spIdx)
## hd_spectra <- mzR::header(fileh, fData$spIdx)
## Process MS1 and MSn separately
if (length(msLevel1) >= 1) {
ms1fd <- fData[msLevel1, , drop = FALSE]
Expand Down
20 changes: 20 additions & 0 deletions inst/scripts/torture.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,23 @@ for (i in 1:7500) {
sp <- spectra(res)
}

## Torture test to check for issue #170

library(doParallel)
registerDoParallel(2)
register(DoparParam())

options(mzR = list(default_backend = "Ramp"))

fls <- dir("/Users/jo/data/2016/2016_06/", pattern = "mzML", full.names = TRUE)
set.seed(123)
if (length(fls)) {
## Randomly grep 12 of them load them and extract spectra.
for (i in 1:5000) {
if (i %% 200 == 0)
cat(i, "\n")
fls_sub <- sample(fls, 12)
od <- readMSData2(fls_sub, verbose = FALSE)
spctr <- spectra(od)
}
}

0 comments on commit a69c174

Please sign in to comment.