traverseUp: Traverses up from leaves to the root

View source: R/merge_order.R

traverseUpR Documentation

Traverses up from leaves to the root

Description

While traversing from leaf to root node, at each node a master run is created. Merged features and merged chromatograms from parent runs are estimated. Chromatograms are written on the disk at dataPath/xics. For each precursor aligned parent time-vectors and corresponding child time-vector are also calculated and written as *_av.rds at dataPath.

Accesors to the new files are added to fileInfo, mzPntrs and prec2chromIndex. Features, reference used for the alignment and adaptiveRTs of global alignments are also added to corresponding environment.

Usage

traverseUp(
  tree,
  dataPath,
  fileInfo,
  features,
  mzPntrs,
  prec2chromIndex,
  precursors,
  params,
  adaptiveRTs,
  refRuns,
  multipeptide,
  peptideScores,
  ropenms,
  applyFun = lapply
)

Arguments

tree

(phylo) a phylogenetic tree.

dataPath

(string) path to xics and osw directory.

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.

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.

precursors

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

params

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

adaptiveRTs

(environment) For each descendant-pair, it contains the window around the aligned retention time, within which features with m-score below aligned FDR are considered for quantification.

refRuns

(environment) For each descendant-pair, the reference run is indicated by 1 or 2 for all the peptides.

multipeptide

(environment) contains multiple data-frames that are collection of features associated with analytes. This is an output of getMultipeptide.

peptideScores

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

ropenms

(pyopenms module) get this python module through get_ropenms. Required only for chrom.mzML files.

applyFun

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

Value

(None)

Author(s)

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

ORCID: 0000-0003-3500-8152

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

See Also

getTree, getNodeRun

Examples

dataPath <- system.file("extdata", package = "DIAlignR")
params <- paramsDIAlignR()
fileInfo <- getRunNames(dataPath = dataPath)
mzPntrs <- list2env(getMZMLpointers(fileInfo))
features <- list2env(getFeatures(fileInfo, maxFdrQuery = params[["maxFdrQuery"]], runType = params[["runType"]]))
precursors <- getPrecursors(fileInfo, oswMerged = TRUE, runType = params[["runType"]],
 context = "experiment-wide", maxPeptideFdr = params[["maxPeptideFdr"]])
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)
peptideScores <- list2env(peptideScores)
multipeptide <- getMultipeptide(precursors, features)
prec2chromIndex <- list2env(getChromatogramIndices(fileInfo, precursors, mzPntrs))
adaptiveRTs <- new.env()
refRuns <- new.env()
tree <- ape::read.tree(text = "(run1:9,(run2:7,run0:2)master2:5)master1;")
tree <- ape::reorder.phylo(tree, "postorder")
## Not run: 
ropenms <- get_ropenms(condaEnv = "envName", useConda=TRUE)
multipeptide <- traverseUp(tree, dataPath, fileInfo, features, mzPntrs, prec2chromIndex, precursors, params,
 adaptiveRTs, refRuns, multipeptide, peptideScores, ropenms)
for(run in names(mzPntrs)) DBI::dbDisconnect(mzPntrs[[run]])
# Cleanup
file.remove(list.files(dataPath, pattern = "*_av.rds", full.names = TRUE))
file.remove(list.files(file.path(dataPath, "xics"), pattern = "^master[0-9]+\\.chrom\\.sqMass$", full.names = TRUE))

## End(Not run)

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