getChildXICs: Develop child XICs for precursors

View source: R/merge_runs.R

getChildXICsR Documentation

Develop child XICs for precursors

Description

This function performs the chromatogram alignment of all precursors across runA and runB. Aligned chromatograms are merged into a child chromatogram. Aligned time vector and resulting child time vector for each precursor is also returned.

Usage

getChildXICs(
  runA,
  runB,
  fileInfo,
  features,
  mzPntrs,
  precursors,
  prec2chromIndex,
  refRun,
  peptideScores,
  params,
  applyFun = lapply
)

Arguments

runA

(string) name of a run to be merged with runB. Must be in the rownames of fileInfo.

runB

(string) name of a run to be merged with runA. Must be in the rownames of fileInfo.

fileInfo

(data-frame) output of getRunNames.

features

(list of data-frames) contains features and their properties identified in each run.

mzPntrs

(list) a list of mzRpwiz.

precursors

(data-frame) atleast two columns transition_group_id and transition_ids are required.

prec2chromIndex

(list) a list of dataframes having following columns:
transition_group_id: it is PRECURSOR.ID from osw file.
chromatogramIndex: index of chromatogram in mzML file.

refRun

(integer) must be of the same length as of precursors. 1: reference is runA, 2: reference is runB.

peptideScores

(list of data-frames) each dataframe has scores of a peptide across all runs.

params

(list) parameters are entered as list. Output of the paramsDIAlignR function.

applyFun

(function) value must be either lapply or BiocParallel::bplapply.

Value

(list) has three elements. The first element has child XICs for all the precursors. The second element has corresponding aligned time vectors. Third element contains Residual Standard Errors (RSE) of global fits amongst runA and runB.

Author(s)

Shubham Gupta, shubh.gupta@mail.utoronto.ca

ORCID: 0000-0003-3500-8152

License: (c) Author (2020) + GPL-3 Date: 2020-06-06

See Also

childXICs, getNodeRun

Examples

dataPath <- system.file("extdata", package = "DIAlignR")
params <- paramsDIAlignR()
fileInfo <- DIAlignR::getRunNames(dataPath = dataPath)
mzPntrs <- getMZMLpointers(fileInfo)
features <- getFeatures(fileInfo, maxFdrQuery = 1.00, runType = "DIA_Proteomics")
precursors <- getPrecursors(fileInfo, oswMerged = TRUE, runType = "DIA_Proteomics",
 context = "experiment-wide", maxPeptideFdr = 0.05)
precursors <- dplyr::arrange(precursors, .data$peptide_id, .data$transition_group_id)
peptideIDs <- unique(precursors$peptide_id)
peptideScores <- getPeptideScores(fileInfo, peptideIDs, oswMerged = TRUE, params[["runType"]], params[["context"]])
peptideScores <- lapply(peptideIDs, function(pep) dplyr::filter(peptideScores, .data$peptide_id == pep))
names(peptideScores) <- as.character(peptideIDs)
prec2chromIndex <- getChromatogramIndices(fileInfo, precursors, mzPntrs)
var2 <- as.character(sapply(peptideIDs, function(p) precursors$transition_group_id[which(precursors$peptide_id == p)[1]]))
refRun <- data.frame(rep(1L, length(peptideIDs)), var2)
mergedXICs <- getChildXICs(runA = "run1", runB = "run2", fileInfo, features, mzPntrs,
  precursors, prec2chromIndex, refRun, peptideScores, params)
for(con in mzPntrs) DBI::dbDisconnect(con)

shubham1637/DIAlign documentation built on March 27, 2023, 7:12 a.m.