getNodeRun: Create a child run from two parent runs

View source: R/merge_runs.R

getNodeRunR Documentation

Create a child run from two parent runs

Description

Get merged features and merged chromatograms from parent runs. 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.rda at dataPath.

Usage

getNodeRun(
  runA,
  runB,
  mergeName,
  dataPath,
  fileInfo,
  features,
  mzPntrs,
  prec2chromIndex,
  precursors,
  params,
  adaptiveRTs,
  refRuns,
  multipeptide,
  peptideScores,
  ropenms,
  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.

mergeName

(string) name of the node that is generated with merging of runA and runB.

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) an empty environment used to store data for downstream analysis.

refRuns

(environment) an empty environment used to store data for downstream analysis.

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-06-06

See Also

childXICs, getChildXICs, traverseUp

Examples

library(data.table)
dataPath <- system.file("extdata", package = "DIAlignR")
params <- paramsDIAlignR()
fileInfo <- getRunNames(dataPath = dataPath)
mzPntrs <- list2env(getMZMLpointers(fileInfo))
precursors <- getPrecursors(fileInfo, oswMerged = TRUE, runType = params[["runType"]],
 context = "experiment-wide", maxPeptideFdr = params[["maxPeptideFdr"]])
peptideIDs <- unique(precursors$peptide_id)
peptideScores <- getPeptideScores(fileInfo, peptideIDs, oswMerged = TRUE, params[["runType"]], params[["context"]])
masters <- paste("master", 1:(nrow(fileInfo)-1), sep = "")
peptideScores <- lapply(peptideIDs, function(pep) {x <- peptideScores[.(pep)][,-c(1L)]
  x <- rbindlist(list(x, data.table("run" = masters, "score" = NA_real_, "pvalue" = NA_real_,
    "qvalue" = NA_real_)), use.names=TRUE)
  setkeyv(x, "run"); x})
names(peptideScores) <- as.character(peptideIDs)
features <- getFeatures(fileInfo, maxFdrQuery = 1.00, runType = "DIA_Proteomics")
## Not run: 
masterFeatures <- dummyFeatures(precursors, nrow(fileInfo)-1, 1L)
features <- do.call(c, list(features, masterFeatures))
multipeptide <- getMultipeptide(precursors, features, numMerge = 0L, startIdx = 1L)
prec2chromIndex <- getChromatogramIndices(fileInfo, precursors, mzPntrs)
masterChromIndex <- dummyChromIndex(precursors, nrow(fileInfo)-1, 1L)
prec2chromIndex <- do.call(c, list(prec2chromIndex, masterChromIndex))
mergeName <- "master1"
adaptiveRTs <- new.env()
refRuns <- new.env()
getNodeRun(runA = "run2", runB = "run0", mergeName = mergeName, dataPath = ".", fileInfo, features,
 mzPntrs, prec2chromIndex, precursors, params, adaptiveRTs, refRuns, multipeptide, peptideScores, ropenms = NULL)
file.remove(file.path(".", "xics", paste0(mergeName, ".chrom.sqMass")))
file.remove(list.files(".", pattern = "*_av.rds", full.names = TRUE))

## End(Not run)
for(run in names(mzPntrs)) DBI::dbDisconnect(mzPntrs[[run]])

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