Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RMassBank_by_MaliRemorker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Environmental Cheminformatics
RMassBank_by_MaliRemorker
Commits
0f714417
Commit
0f714417
authored
9 years ago
by
ermueller
Browse files
Options
Downloads
Plain Diff
Solved merge conflict
parents
1055dc92
bc06fbff
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
R/leMsmsRaw.R
+35
-5
35 additions, 5 deletions
R/leMsmsRaw.R
with
35 additions
and
5 deletions
R/leMsmsRaw.R
+
35
−
5
View file @
0f714417
...
...
@@ -127,9 +127,22 @@ findMsMsHR <- function(fileName, cpdID, mode="pH",confirmMode =0, useRtLimit = T
#' @export
findMsMsHR.mass
<-
function
(
msRaw
,
mz
,
limit.coarse
,
limit.fine
,
rtLimits
=
NA
,
maxCount
=
NA
,
headerCache
=
NULL
,
fillPrecursorScan
=
FALSE
,
<<<<<<<
HEAD
deprofile
=
getOption
(
"RMassBank"
)
$
deprofile
,
cpdID
)
=======
deprofile
=
getOption
(
"RMassBank"
)
$
deprofile
,
peaksCache
=
NULL
)
>>>>>>>
bc06fbffa78117e642d1e8a95083aca89706d473
{
eic
<-
findEIC
(
msRaw
,
mz
,
limit.fine
,
rtLimits
)
eic
<-
findEIC
(
msRaw
,
mz
,
limit.fine
,
rtLimits
,
headerCache
=
headerCache
,
peaksCache
=
peaksCache
)
# if(!is.na(rtLimits))
# {
# eic <- subset(eic, rt >= rtLimits[[1]] & rt <= rtLimits[[2]])
...
...
@@ -419,7 +432,8 @@ findMsMsHRperxcms.direct <- function(fileName, cpdID, mode="pH", findPeaksArgs =
#' @author Michael A. Stravs, Eawag <michael.stravs@@eawag.ch>
#' @seealso findMsMsHR
#' @export
findEIC
<-
function
(
msRaw
,
mz
,
limit
=
NULL
,
rtLimit
=
NA
,
headerCache
=
NULL
,
floatingRecalibration
=
NULL
)
findEIC
<-
function
(
msRaw
,
mz
,
limit
=
NULL
,
rtLimit
=
NA
,
headerCache
=
NULL
,
floatingRecalibration
=
NULL
,
peaksCache
=
NULL
)
{
# calculate mz upper and lower limits for "integration"
if
(
all
(
c
(
"mzMin"
,
"mzMax"
)
%in%
names
(
mz
)))
...
...
@@ -431,6 +445,12 @@ findEIC <- function(msRaw, mz, limit = NULL, rtLimit = NA, headerCache = NULL, f
headerData
<-
as.data.frame
(
headerCache
)
else
headerData
<-
as.data.frame
(
header
(
msRaw
))
# Add row numbering because I'm not sure if seqNum or acquisitionNum correspond to anything really
if
(
nrow
(
headerData
)
>
0
)
headerData
$
rowNum
<-
1
:
nrow
(
headerData
)
else
headerData
$
rowNum
<-
integer
(
0
)
# If RT limit is already given, retrieve only candidates in the first place,
# since this makes everything much faster.
if
(
all
(
!
is.na
(
rtLimit
)))
...
...
@@ -440,7 +460,11 @@ findEIC <- function(msRaw, mz, limit = NULL, rtLimit = NA, headerCache = NULL, f
,]
else
headerMS1
<-
headerData
[
headerData
$
msLevel
==
1
,]
pks
<-
mzR
::
peaks
(
msRaw
,
headerMS1
$
seqNum
)
if
(
is.null
(
peaksCache
))
pks
<-
mzR
::
peaks
(
msRaw
,
headerMS1
$
seqNum
)
else
pks
<-
peaksCache
[
headerData
$
rowNum
]
# Sum intensities in the given mass window for each scan
if
(
is.null
(
floatingRecalibration
))
{
...
...
@@ -453,8 +477,8 @@ findEIC <- function(msRaw, mz, limit = NULL, rtLimit = NA, headerCache = NULL, f
headerMS1
$
mzMax
<-
mzlimits
[[
2
]]
+
predict
(
floatingRecalibration
,
headerMS1
$
retentionTime
)
}
intensity
<-
unlist
(
lapply
(
1
:
nrow
(
headerMS1
),
function
(
row
)
{
peaktable
<-
mzR
::
peaks
(
msRaw
,
headerMS1
[
row
,
"seqNum"
])
##Was "acquisitionNum" before; doesn't matter most of the time... unless you actively exclude things in the conversion of the mzML-file
{
peaktable
<-
pks
[[
row
]]
sum
(
peaktable
[
which
((
peaktable
[,
1
]
>=
headerMS1
[
row
,
"mzMin"
])
&
(
peaktable
[,
1
]
<=
headerMS1
[
row
,
"mzMax"
])),
2
])
...
...
@@ -463,6 +487,12 @@ findEIC <- function(msRaw, mz, limit = NULL, rtLimit = NA, headerCache = NULL, f
return
(
data.frame
(
rt
=
headerMS1
$
retentionTime
,
intensity
=
intensity
,
scan
=
headerMS1
$
acquisitionNum
))
}
makePeaksCache
<-
function
(
msRaw
,
headerCache
)
{
mzR
::
peaks
(
msRaw
,
headerCache
$
seqNum
)
}
#' Conversion of XCMS-pseudospectra into RMassBank-spectra
#'
#' Converts a pseudospectrum extracted from XCMS using CAMERA into the msmsWorkspace(at)specs-format that RMassBank uses
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment