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
8087a4a7
Commit
8087a4a7
authored
9 years ago
by
Michele Stravs
Browse files
Options
Downloads
Patches
Plain Diff
Refactoring: Vignette working until step 2
parent
27687857
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
DESCRIPTION
+1
-1
1 addition, 1 deletion
DESCRIPTION
R/formulaCalculator.R
+1
-1
1 addition, 1 deletion
R/formulaCalculator.R
R/leMsMs.r
+29
-24
29 additions, 24 deletions
R/leMsMs.r
R/leMsmsRaw.R
+4
-2
4 additions, 2 deletions
R/leMsmsRaw.R
with
35 additions
and
28 deletions
DESCRIPTION
+
1
−
1
View file @
8087a4a7
...
...
@@ -26,7 +26,7 @@ SystemRequirements: OpenBabel
biocViews: Bioinformatics, MassSpectrometry, Metabolomics, Software
Depends: Rcpp
Imports:
XML,RCurl,rjson, rcdk,yaml,mzR,methods,Biobase,MSnbase
XML,RCurl,rjson, rcdk,yaml,mzR,methods,Biobase,MSnbase
,S4Vectors
Suggests:
gplots,RMassBankData,
xcms (>= 1.37.1),
...
...
This diff is collapsed.
Click to expand it.
R/formulaCalculator.R
+
1
−
1
View file @
8087a4a7
...
...
@@ -339,6 +339,6 @@ ppm <- function(mass, dppm, l=FALSE, p=FALSE)
}
## # auxiliaries
##
emass <- 0.0005485799
.
emass
<-
0.0005485799
## pmass <- 1.007276565
## hmass <- 1.007825
This diff is collapsed.
Click to expand it.
R/leMsMs.r
+
29
−
24
View file @
8087a4a7
...
...
@@ -95,7 +95,7 @@ msmsWorkflow <- function(w, mode="pH", steps=c(1:8), confirmMode = FALSE, newRec
nProg
<-
0
message
(
"msmsWorkflow: Step 1. Acquire all MSMS spectra from files"
)
pb
<-
do.call
(
progressbar
,
list
(
object
=
NULL
,
value
=
0
,
min
=
0
,
max
=
nLen
))
w
@
spectra
<-
lapply
(
w
@
files
,
function
(
fileName
)
{
w
@
spectra
<-
as
(
lapply
(
w
@
files
,
function
(
fileName
)
{
# Find compound ID
splitfn
<-
strsplit
(
fileName
,
'_'
)
...
...
@@ -115,7 +115,7 @@ msmsWorkflow <- function(w, mode="pH", steps=c(1:8), confirmMode = FALSE, newRec
pb
<-
do.call
(
progressbar
,
list
(
object
=
pb
,
value
=
nProg
))
return
(
spec
)
}
)
}
)
,
"SimpleList"
)
names
(
w
@
spectra
)
<-
basename
(
as.character
(
w
@
files
))
# close progress bar
do.call
(
progressbar
,
list
(
object
=
pb
,
close
=
TRUE
))
...
...
@@ -176,7 +176,7 @@ msmsWorkflow <- function(w, mode="pH", steps=c(1:8), confirmMode = FALSE, newRec
nProg
<-
0
message
(
"msmsWorkflow: Step 2. First analysis pre recalibration"
)
pb
<-
do.call
(
progressbar
,
list
(
object
=
NULL
,
value
=
0
,
min
=
0
,
max
=
nLen
))
w
@
spectra
<-
lapply
(
w
@
spectra
,
function
(
spec
)
{
w
@
spectra
<-
as
(
lapply
(
w
@
spectra
,
function
(
spec
)
{
#print(spec$id)
s
<-
analyzeMsMs
(
spec
,
mode
=
mode
,
detail
=
TRUE
,
run
=
"preliminary"
,
filterSettings
=
settings
$
filterSettings
,
...
...
@@ -186,7 +186,7 @@ msmsWorkflow <- function(w, mode="pH", steps=c(1:8), confirmMode = FALSE, newRec
pb
<-
do.call
(
progressbar
,
list
(
object
=
pb
,
value
=
nProg
))
return
(
s
)
})
})
,
"SimpleList"
)
for
(
f
in
w
@
files
)
w
@
spectra
[[
basename
(
as.character
(
f
))]]
@
name
<-
basename
(
as.character
(
f
))
do.call
(
progressbar
,
list
(
object
=
pb
,
close
=
TRUE
))
...
...
@@ -705,21 +705,26 @@ analyzeMsMs.formula <- function(msmsPeaks, mode="pH", detail=FALSE, run="prelimi
childPeaksFilt
<-
filterLowaccResults
(
childPeaks
,
filterMode
,
filterSettings
)
childPeaksGood
<-
childPeaksFilt
[[
"TRUE"
]]
childPeaksBad
<-
childPeaksFilt
[[
"FALSE"
]]
if
(
is.null
(
childPeaksGood
))
childPeaksGood
<-
childPeaks
[
c
(),,
drop
=
FALSE
]
if
(
is.null
(
childPeaksBad
))
childPeaksBad
<-
childPeaks
[
c
(),,
drop
=
FALSE
]
childPeaksUnassigned
<-
childPeaks
[
is.na
(
childPeaks
$
dppm
),,
drop
=
FALSE
]
childPeaksUnassigned
$
good
<-
FALSE
childPeaksUnassigned
$
good
<-
rep
(
FALSE
,
nrow
(
childPeaksUnassigned
))
# count formulas within new limits
# (the results of the "old" count stay in childPeaksInt and are returned
# in $childPeaks)
if
(
!
is.null
(
childPeaksGood
))
{
countFormulasTab
<-
xtabs
(
~
formula
+
mz
,
data
=
childPeaksGood
)
countFormulas
<-
colSums
(
countFormulasTab
)
childPeaksGood
$
formulaCount
<-
countFormulas
[
as.character
(
childPeaksGood
$
mz
)]
}
childPeaksUnassigned
$
formulaCount
<-
NA
childPeaksBad
$
formulaCount
<-
NA
countFormulasTab
<-
xtabs
(
~
formula
+
mz
,
data
=
childPeaksGood
)
countFormulas
<-
colSums
(
countFormulasTab
)
childPeaksGood
$
formulaCount
<-
countFormulas
[
as.character
(
childPeaksGood
$
mz
)]
childPeaksUnassigned
$
formulaCount
<-
rep
(
NA
,
nrow
(
childPeaksUnassigned
))
childPeaksBad
$
formulaCount
<-
rep
(
NA
,
nrow
(
childPeaksBad
))
childPeaksBad
$
good
<-
rep
(
FALSE
,
nrow
(
childPeaksBad
))
# Now: childPeaksGood (containing the new, recounted peaks with good = TRUE), and childPeaksBad (containing the
# peaks with good=FALSE, i.e. outside filter criteria, with the old formula count even though it is worthless)
...
...
@@ -732,18 +737,18 @@ analyzeMsMs.formula <- function(msmsPeaks, mode="pH", detail=FALSE, run="prelimi
# to match order in childPeaks. After that, setData to the child slot.
childPeaksOmitted
<-
getData
(
child
)
childPeaksOmitted
<-
childPeaksOmitted
[
child
@
low
|
child
@
satellite
,,
drop
=
FALSE
]
childPeaksOmitted
$
rawOK
<-
FALSE
childPeaksOmitted
$
good
<-
FALSE
childPeaksOmitted
$
dppm
<-
NA
childPeaksOmitted
$
formula
<-
NA
childPeaksOmitted
$
mzCalc
<-
NA
childPeaksOmitted
$
dbe
<-
NA
childPeaksOmitted
$
dppmBest
<-
NA
childPeaksOmitted
$
formulaCount
<-
0
childPeaksOmitted
$
rawOK
<-
rep
(
FALSE
,
nrow
(
childPeaksOmitted
))
childPeaksOmitted
$
good
<-
rep
(
FALSE
,
nrow
(
childPeaksOmitted
))
childPeaksOmitted
$
dppm
<-
rep
(
NA
,
nrow
(
childPeaksOmitted
))
childPeaksOmitted
$
formula
<-
rep
(
NA
,
nrow
(
childPeaksOmitted
))
childPeaksOmitted
$
mzCalc
<-
rep
(
NA
,
nrow
(
childPeaksOmitted
))
childPeaksOmitted
$
dbe
<-
rep
(
NA
,
nrow
(
childPeaksOmitted
))
childPeaksOmitted
$
dppmBest
<-
rep
(
NA
,
nrow
(
childPeaksOmitted
))
childPeaksOmitted
$
formulaCount
<-
rep
(
0
,
nrow
(
childPeaksOmitted
))
childPeaks
$
satellite
<-
FALSE
childPeaks
$
low
<-
FALSE
childPeaks
$
rawOK
<-
TRUE
childPeaks
$
satellite
<-
rep
(
FALSE
,
nrow
(
childPeaks
))
childPeaks
$
low
<-
rep
(
FALSE
,
nrow
(
childPeaks
))
childPeaks
$
rawOK
<-
rep
(
TRUE
,
nrow
(
childPeaks
))
childPeaks
<-
childPeaks
[,
colnames
(
childPeaksOmitted
),
drop
=
FALSE
]
...
...
This diff is collapsed.
Click to expand it.
R/leMsmsRaw.R
+
4
−
2
View file @
8087a4a7
...
...
@@ -220,7 +220,9 @@ findMsMsHR.mass <- function(msRaw, mz, limit.coarse, limit.fine, rtLimits = NA,
centroided
=
TRUE
)
})
msmsSpecs
<-
do.call
(
c
,
msmsSpecs
)
msmsSpecs
<-
as
(
do.call
(
c
,
msmsSpecs
),
"SimpleList"
)
# build the new objects
masterSpec
<-
new
(
"Spectrum1"
,
...
...
@@ -285,7 +287,7 @@ findMsMsHR.direct <- function(msRaw, cpdID, mode = "pH", confirmMode = 0, useRtL
sp
<-
spectra
[[
confirmMode
+
1
]]
#sp@mz <- mzLimits
sp
@
id
<-
as.integer
(
cpdID
)
sp
@
id
<-
as.character
(
as.integer
(
cpdID
)
)
sp
@
name
<-
findName
(
cpdID
)
sp
@
formula
<-
findFormula
(
cpdID
)
return
(
sp
)
...
...
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