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
f8e6b12b
Commit
f8e6b12b
authored
11 years ago
by
ermueller
Browse files
Options
Downloads
Patches
Plain Diff
Works now, even if some spectra aren't found
parent
a1ba76c2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
R/leMsMs.r
+1
-23
1 addition, 23 deletions
R/leMsMs.r
R/leMsmsRaw.R
+17
-8
17 additions, 8 deletions
R/leMsmsRaw.R
with
18 additions
and
31 deletions
R/leMsMs.r
+
1
−
23
View file @
f8e6b12b
...
...
@@ -117,30 +117,8 @@ msmsWorkflow <- function(w, mode="pH", steps=c(1:8), confirmMode = FALSE, newRec
for
(
i
in
1
:
length
(
unique
(
cpdIDs
))){
specs
<-
list
()
specsNull
<-
list
()
specsNotNull
<-
list
()
for
(
j
in
1
:
length
(
files
[[
i
]])){
specs
[[
j
]]
<-
findMsMsHRperxcms.direct
(
files
[[
i
]][
j
],
unique
(
cpdIDs
)[
i
],
mode
=
mode
,
findPeaksArgs
=
findPeaksArgs
,
plots
)
specsNull
[[
j
]]
<-
vector
()
specsNotNull
[[
j
]]
<-
vector
()
for
(
k
in
1
:
length
(
specs
[[
j
]]))
if
(
is.null
(
specs
[[
j
]][[
k
]])){
specsNull
[[
j
]]
<-
c
(
specsNull
[[
j
]],
k
)
}
else
{
specsNotNull
<-
c
(
specsNotNull
[[
j
]],
k
)}
}
if
(
length
(
specsNotNull
)
==
0
){
stop
(
"Couldn't find any peaks that fit criteria"
)
}
##This replaces the specs that are missing with specs already present
##Couldn't think of a better solution
for
(
j
in
length
(
specsNull
)){
warning
(
"A spectrum has been replaced because XCMS couldn't find any fitting peaks"
)
for
(
k
in
specsNull
[[
j
]]){
print
(
specsNotNull
[[
j
]][
1
])
specs
[[
j
]][[
k
]]
<-
specs
[[
j
]][[
specsNotNull
[[
j
]][
1
]]]
}
}
w
@
specs
[[
i
]]
<-
toRMB
(
unlist
(
specs
,
recursive
=
FALSE
),
unique
(
cpdIDs
)[
i
],
mode
=
mode
)
}
...
...
@@ -306,7 +284,7 @@ msmsWorkflow <- function(w, mode="pH", steps=c(1:8), confirmMode = FALSE, newRec
#' \item{list("id")}{
#' The compound ID (inherited from \code{msmsdata})}
#' \item{list("mode")}{
#' processing mode}
$
#' processing mode}
#' \item{list("parentHeader")}{
#' Parent spectrum header data (ex \code{msmsdata})}
#' \item{list("parentMs")}{
...
...
This diff is collapsed.
Click to expand it.
R/leMsmsRaw.R
+
17
−
8
View file @
f8e6b12b
...
...
@@ -253,8 +253,8 @@ findMsMsHRperxcms.direct <- function(fileName, cpdID, mode="pH", findPeaksArgs,
xrs
<-
split
(
msn2xcmsRaw
(
xrmsms
),
f
=
xrmsms
@
msnCollisionEnergy
)
## Fake s simplistic xcmsSet
xsmsms
<-
as.list
(
replicate
(
length
(
xrs
),
xcmsSet
(
files
=
fileName
,
method
=
"MS1"
)
))
setReplicate
<-
xcmsSet
(
files
=
fileName
,
method
=
"MS1"
)
xsmsms
<-
as.list
(
replicate
(
length
(
xrs
),
setReplicate
))
candidates
<-
list
()
anmsms
<-
list
()
psp
<-
list
()
...
...
@@ -350,6 +350,17 @@ findEIC <- function(msRaw, mz, limit = NULL, rtLimit = NA)
#' }
#' @export
toRMB
<-
function
(
msmsXCMSspecs
=
NA
,
cpdID
=
NA
,
mode
=
"pH"
,
MS1spec
=
NA
){
ret
<-
list
()
ret
$
mz
<-
findMz
(
cpdID
,
mode
=
mode
)
ret
$
id
<-
cpdID
ret
$
formula
<-
findFormula
(
cpdID
)
print
(
paste
(
"Length of msmsXCMSspecs:"
,
length
(
msmsXCMSspecs
)))
if
(
length
(
msmsXCMSspecs
)
==
0
){
ret
$
foundOK
<-
FALSE
print
(
"blabla"
)
return
(
ret
)
}
if
(
is.na
(
msmsXCMSspecs
)){
stop
(
"You need a readable spectrum!"
)
}
...
...
@@ -357,11 +368,12 @@ toRMB <- function(msmsXCMSspecs = NA, cpdID = NA, mode="pH", MS1spec = NA){
stop
(
"Please supply the compoundID!"
)
}
numScan
<-
length
(
msmsXCMSspecs
)
ret
<-
list
()
ret
$
foundOK
<-
1
ret
$
foundOK
<-
TRUE
ret
$
parentscan
<-
1
ret
$
parentHeader
<-
matrix
(
0
,
ncol
=
20
,
nrow
=
1
)
rownames
(
ret
$
parentHeader
)
<
-1
rownames
(
ret
$
parentHeader
)
<-
1
colnames
(
ret
$
parentHeader
)
<-
c
(
"seqNum"
,
"acquisitionNum"
,
"msLevel"
,
"peaksCount"
,
"totIonCurrent"
,
"retentionTime"
,
"basepeakMZ"
,
"basePeakIntensity"
,
"collisionEnergy"
,
"ionisationEnergy"
,
"lowMZ"
,
"highMZ"
,
"precursorScanNum"
,
"precursorMZ"
,
"precursorCharge"
,
"precursorIntensity"
,
"mergedScan"
,
"mergedResultScanNum"
,
...
...
@@ -427,9 +439,6 @@ toRMB <- function(msmsXCMSspecs = NA, cpdID = NA, mode="pH", MS1spec = NA){
peaks
[,
2
]
<-
specs
[,
7
]
return
(
peaks
)
})
ret
$
mz
<-
findMz
(
cpdID
,
mode
=
mode
)
ret
$
id
<-
cpdID
ret
$
formula
<-
findFormula
(
cpdID
)
return
(
ret
)
}
...
...
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