Skip to content
Snippets Groups Projects
Commit 03780562 authored by Todor Kondić's avatar Todor Kondić
Browse files

Start adding structure for MS2 extraction.

parent 07444a47
No related branches found
No related tags found
No related merge requests found
......@@ -337,7 +337,8 @@ extr_data <-function(m) {
## Big ms1 chromatogram table.
cg1 = new_ms1_cgm_table()
cg2 = new_ms2_cgm_table()
for (fn in fine[,unique(file)]) {
......@@ -356,21 +357,23 @@ extr_data <-function(m) {
## Extract MS1 chromatograms.
fncg1 = new_ms1_cgm_table()
fncg1 = extr_ms1_cgm(ms=ms,
isotab=isotab1,
qrt=F,
fncg1)
fncg1 = extr_ms1_cgm(ms=ms,
isotab=isotab2,
qrt=T,
fncg1)
cg1 = cg1[fncg1,.(precid,
rt,
intensity=i.intensity,
scan=i.scan)]
## Extract MS2 chromatograms.
fnfd = as.data.table(fData(ms),keep.rownames="scan",key="scan")
fncg2 = extr_ms2_cgm(fnfd,fncg1)
1+1
}
......
......@@ -124,10 +124,18 @@ new_ms2_cgm_cat <- function() {
an = integer(0))
}
new_ms2_cgm_table <- function() {
## Varios rt-related MS2 data.
data.table(precid = integer(0),
ce = numeric(0),
an = integer(0),
rt = numeric(0))
}
new_ms2_cgm_table <- function() {
## Creates a chromatogram.
data.table(precid = integer(0),
an = intege r(0),
an = integer(0),
rt = numeric(0),
intensity = numeric(0),
scan = character(0),
......
......@@ -620,7 +620,7 @@ create_fine_table <- function(m) {
"rt_min",
"rt_max",
"file"),
keyby=c("file","isofine")]
keyby=c("file","precid")]
}
......@@ -660,14 +660,14 @@ extr_ms1_cgm <- function(ms,isotab,qrt,res) {
## fill the data table.
for (i in 1L:nrow(mzrng)) {
rt = rtime(x[i,1])
isofine = isotab[(i),isofine]
chunk = data.table(isofine=isofine,
precid = isotab[(i),precid]
chunk = data.table(precid=precid,
rt=rt,
intensity=intensity(x[i,1]),
scan = names(rt),
key = c("isofine","rt"))
key = c("precid","rt"))
res = res[chunk,.(isofine,
res = res[chunk,.(precid,
rt,
intensity=i.intensity,
scan=i.scan)]
......@@ -678,3 +678,11 @@ extr_ms1_cgm <- function(ms,isotab,qrt,res) {
}
extr_ms2_cgm <- function(feat_table,one_file_cg1) {
## Get scanIdx.
browser()
precs = feat_table[one_file_cg1,.(scan,scanIdx),on="scan"]
}
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