Skip to content
Snippets Groups Projects
Unverified Commit d51d56af authored by meowcat's avatar meowcat Committed by GitHub
Browse files

Merge pull request #223 from jorainer/master

Fix mzR import after mzR::header reporting NA for missing data
parents c579455c 7d45afa5
No related branches found
No related tags found
No related merge requests found
Package: RMassBank
Type: Package
Title: Workflow to process tandem MS files and build MassBank records
Version: 2.11.4
Version: 2.11.5
Authors@R: c(
person(given = "RMassBank at Eawag", email = "massbank@eawag.ch",
role=c("cre")),
......
......@@ -198,14 +198,14 @@ findMsMsHR.mass <- function(msRaw, mz, limit.coarse, limit.fine, rtLimits = NA,
headerData[which(headerData$msLevel == 1),"precursorScanNum"] <- 0
}
# bugfix 201803: PRM scans that were performed before the first full scan (found in some files)
headerData <- headerData[
!((headerData$msLevel == 2) & (headerData$precursorScanNum == 0)),,drop=FALSE
]
headerData <- headerData[!((headerData$msLevel == 2) &
(is.na(headerData$precursorScanNum))),,
drop = FALSE]
# Find MS2 spectra with precursors which are in the allowed
# scan filter (coarse limit) range
findValidPrecursors <- headerData[
(headerData$precursorMZ > mz - limit.coarse) &
(headerData$precursorMZ < mz + limit.coarse),]
# scan filter (coarse limit) range; which to get rid of NAs
findValidPrecursors <- headerData[which(
headerData$precursorMZ > (mz - limit.coarse) &
headerData$precursorMZ < (mz + limit.coarse)), ]
# Find the precursors for the found spectra
validPrecursors <- unique(findValidPrecursors$precursorScanNum)
# check whether the precursors are real: must be within fine limits!
......@@ -245,9 +245,11 @@ findMsMsHR.mass <- function(msRaw, mz, limit.coarse, limit.fine, rtLimits = NA,
spectra <- lapply(eic$scan, function(masterScan)
{
masterHeader <- headerData[headerData$acquisitionNum == masterScan,]
childHeaders <- headerData[(headerData$precursorScanNum == masterScan)
& (headerData$precursorMZ > mz - limit.coarse)
& (headerData$precursorMZ < mz + limit.coarse) ,]
childHeaders <- headerData[
which(headerData$precursorScanNum == masterScan
& headerData$precursorMZ > (mz - limit.coarse)
& headerData$precursorMZ < (mz + limit.coarse)) , ,
drop = FALSE]
# Fix 9.10.17: headers now include non-numeric columns, leading to errors in data conversion.
# Remove non-numeric columns
......
......@@ -62,8 +62,8 @@ findMsMsHR.ticms2 <- function(msRaw, mz, limit.coarse, limit.fine, rtLimits = NA
# Find MS2 spectra with precursors which are in the allowed
# scan filter (coarse limit) range
findValidPrecursors <- headerData[
(headerData$precursorMZ > mz - limit.coarse) &
(headerData$precursorMZ < mz + limit.coarse),]
which(headerData$precursorMZ > (mz - limit.coarse) &
headerData$precursorMZ < (mz + limit.coarse)),]
# Find the precursors for the found spectra
......@@ -94,10 +94,12 @@ findMsMsHR.ticms2 <- function(msRaw, mz, limit.coarse, limit.fine, rtLimits = NA
ret$parentHeader[1,4:20] <- 0
ret$parentHeader[1,6] <- NA
childHeaders <- headerData[(headerData$acquisitionNum == masterScan)
& (headerData$precursorMZ > mz - limit.coarse)
& (headerData$precursorMZ < mz + limit.coarse) ,]
childHeaders <- headerData[
which(headerData$acquisitionNum == masterScan
& headerData$precursorMZ > (mz - limit.coarse)
& headerData$precursorMZ < (mz + limit.coarse)), ,
drop = FALSE]
childScans <- childHeaders$acquisitionNum
ret$parentScan <- min(childScans)-1
ret$parentHeader[1,1:3] <- min(childScans)-1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment