From 4262e53b4c5d1786cbb71b724e93ba63782896d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Todor=20Kondi=C4=87?= <kontrapunkt@uclmail.net> Date: Wed, 29 Mar 2023 16:35:58 +0200 Subject: [PATCH] Move gen_summ from mix to data-model. --- R/data-model.R | 16 ++++++++++++++++ R/mix.R | 14 -------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/R/data-model.R b/R/data-model.R index 79f177d..331b146 100644 --- a/R/data-model.R +++ b/R/data-model.R @@ -113,3 +113,19 @@ empty_spectra_table <- function() { setkey(r,precid,scan) r } + + +## Based on the `comprehensive' and `qa' tabs, greate `summ'. +gen_summ <- function(comp,qa) { + comp_cols <- intersect(SUMM_COLS,colnames(comp)) + rdcomp <- comp[,..comp_cols] + data.table::setkeyv(rdcomp,BASE_KEY) + summ <- qa[rdcomp,nomatch=F] #We changed `nomatch' cases from NA + #to F, because NA does not work well + #with X == F condition. + ## flgs <- c(QA_FLAGS,"ms2_sel") + ## summ[is.na(qa_ms1_exists),(flgs):=F] + data.table::setkeyv(summ,SUMM_KEY) + summ[.(F),c("qlt_ms1","qlt_ms2"):=0.,on="qa_ms1_exists"] + summ +} diff --git a/R/mix.R b/R/mix.R index d0dc255..105b025 100644 --- a/R/mix.R +++ b/R/mix.R @@ -797,20 +797,6 @@ analyse_extracted_data_old <- function(extr,prescreen_param) { res } -## Based on the `comprehensive' and `qa' tabs, greate `summ'. -gen_summ <- function(comp,qa) { - comp_cols <- intersect(SUMM_COLS,colnames(comp)) - rdcomp <- comp[,..comp_cols] - data.table::setkeyv(rdcomp,BASE_KEY) - summ <- qa[rdcomp,nomatch=F] #We changed `nomatch' cases from NA - #to F, because NA does not work well - #with X == F condition. - ## flgs <- c(QA_FLAGS,"ms2_sel") - ## summ[is.na(qa_ms1_exists),(flgs):=F] - data.table::setkeyv(summ,SUMM_KEY) - summ[.(F),c("qlt_ms1","qlt_ms2"):=0.,on="qa_ms1_exists"] - summ -} -- GitLab