Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
shinyscreen
Manage
Activity
Members
Labels
Plan
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review 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
shinyscreen
Commits
a54741c0
Commit
a54741c0
authored
2 years ago
by
Todor Kondić
Browse files
Options
Downloads
Patches
Plain Diff
Towards MS2 chromatograms.
parent
a16ca355
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
R/api.R
+30
-12
30 additions, 12 deletions
R/api.R
R/extraction.R
+3
-1
3 additions, 1 deletion
R/extraction.R
with
33 additions
and
13 deletions
R/api.R
+
30
−
12
View file @
a54741c0
...
@@ -313,7 +313,6 @@ mk_tol_funcs <- function(m) {
...
@@ -313,7 +313,6 @@ mk_tol_funcs <- function(m) {
}
}
##' @export
extr_data2
<-
function
(
m
)
{
extr_data2
<-
function
(
m
)
{
message
(
"Stage: extract"
)
message
(
"Stage: extract"
)
if
(
is.null
(
m
$
conf
$
serial
)
||
!
m
$
conf
$
serial
)
{
if
(
is.null
(
m
$
conf
$
serial
)
||
!
m
$
conf
$
serial
)
{
...
@@ -324,6 +323,7 @@ extr_data2 <-function(m) {
...
@@ -324,6 +323,7 @@ extr_data2 <-function(m) {
}
}
}
}
##' @export
extr_data
<-
function
(
m
)
{
extr_data
<-
function
(
m
)
{
fine
=
create_fine_table
(
m
)
fine
=
create_fine_table
(
m
)
...
@@ -335,11 +335,6 @@ extr_data <-function(m) {
...
@@ -335,11 +335,6 @@ extr_data <-function(m) {
dpath
=
m
$
run
$
paths
$
data
dpath
=
m
$
run
$
paths
$
data
## Open all files.
## Open all files.
fns
=
fine
[,
unique
(
file
)]
fns
=
fine
[,
unique
(
file
)]
lms
=
lapply
(
fns
,
function
(
fn
)
read_data_file
(
file.path
(
dpath
,
fn
)))
lms
=
lapply
(
fns
,
function
(
fn
)
read_data_file
(
file.path
(
dpath
,
fn
)))
...
@@ -360,14 +355,37 @@ extr_data <-function(m) {
...
@@ -360,14 +355,37 @@ extr_data <-function(m) {
setkey
(
cgram_ms1
,
file
,
precid
)
setkey
(
cgram_ms1
,
file
,
precid
)
## Extract MS2 chromatograms.
## Extract MS2 chromatograms.
cgram_ms2
=
data.table
(
precid
=
integer
(
0
),
an
=
integer
(
0
),
## Create the "coarse" table. Parent masses are known with
ce
=
numeric
(
0
),
## "coarse". We will prefilter our ms2 results based on that...x
rt
=
numeric
(
0
),
coarse
=
create_coarse_table
(
m
)
intensity
=
numeric
(
0
))
## Filter ms2 based on coarse. TODO
## coarse_ms2 = coarse[,filter_coarse(lms[[file]],.SD,lfdata[[file]]),
## by="file"]
## Join ms1 chromatogram data to ms2, connecting by the parent scan. TODO
## cgram_ms2 = coarse_ms2[,filter_parent_scans(lms[[file]],.SD,lfdata[[file]])]
## cgram_ms2 = data.table(precid=integer(0),
## an=integer(0),
## ce=numeric(0),
## rt=numeric(0),
## intensity=numeric(0))
for
(
fn
in
names
(
lfdata
))
{
for
(
fn
in
names
(
lfdata
))
{
browser
()
browser
()
x
=
lfdata
[[
file
]]
$
ms2
[
cgram_ms1
,
.
(
an
,
ce
,
precid
=
i.precid
),
on
=
"prec_idx==idx"
]
x
=
lfdata
[[
fn
]]
$
ms2
[
cgram_ms1
,
.
(
an
,
ce
,
precid
=
i.precid
,
rt
,
intensity
),
on
=
c
(
prec_idx
=
"idx"
),
nomatch
=
NULL
,
allow.cartesian
=
T
]
1+1
}
}
1+1
1+1
...
...
This diff is collapsed.
Click to expand it.
R/extraction.R
+
3
−
1
View file @
a54741c0
...
@@ -634,7 +634,7 @@ create_coarse_table <- function(m) {
...
@@ -634,7 +634,7 @@ create_coarse_table <- function(m) {
"rt_min"
,
"rt_min"
,
"rt_max"
,
"rt_max"
,
"file"
),
"file"
),
keyby
=
c
(
"file"
,
"isocoarse"
)]
keyby
=
c
(
"file"
,
"isocoarse"
,
"precid"
)]
}
}
...
@@ -688,6 +688,8 @@ get_fdata <- function(ms) {
...
@@ -688,6 +688,8 @@ get_fdata <- function(ms) {
res
$
ms2
=
fdata
[
msLevel
==
2L
,
.
(
scan
,
res
$
ms2
=
fdata
[
msLevel
==
2L
,
.
(
scan
,
idx
=
spIdx
,
idx
=
spIdx
,
an
=
acquisitionNum
,
an
=
acquisitionNum
,
rt
=
retentionTime
,
intensity
=
basePeakIntensity
,
ce
=
collisionEnergy
,
ce
=
collisionEnergy
,
prec_mz
=
precursorMZ
,
prec_mz
=
precursorMZ
,
prec_idx
=
precursorScanNum
)]
prec_idx
=
precursorScanNum
)]
...
...
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