alignToMaster: Align descendants to master

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/merge_order.R

Description

During traverse-down, parent runs are aligned to the master/child run. This function performs the alignment by already saved aligned parent-child time vectors. For the aligned peaks, alignment_rank is set to 1 in multipeptide environment.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
alignToMaster(
  ref,
  eXp,
  alignedVecs,
  refRun,
  adaptiveRT,
  multipeptide,
  prec2chromIndex,
  mzPntrs,
  fileInfo,
  precursors,
  params,
  applyFun = lapply
)

Arguments

ref

(string) name of the descendant run. Must be in the rownames of fileInfo.

eXp

(string) name of one of the parent run. Must be in the rownames of fileInfo.

alignedVecs

(list of dataframes) Each dataframe contains aligned parents time-vectors and resulting child/master time vector for a precursor. This is the second element of getChildXICs output.

refRun

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

multipeptide

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

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.

mzPntrs

(list) a list of mzRpwiz.

fileInfo

(data-frame) output of getRunNames.

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.

applyFun

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

Details

refRun is flipped if eXp is runB instead of runA.

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

See Also

traverseUp, traverseDown, setAlignmentRank

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
dataPath <- system.file("extdata", package = "DIAlignR")
params <- paramsDIAlignR()
fileInfo <- DIAlignR::getRunNames(dataPath = dataPath)
mzPntrs <- list2env(getMZMLpointers(fileInfo))
features <- list2env(getFeatures(fileInfo, maxFdrQuery = 0.05, runType = "DIA_Proteomics"))
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)
prec2chromIndex <- list2env(getChromatogramIndices(fileInfo, precursors, mzPntrs))
multipeptide <- getMultipeptide(precursors, features)
prec2chromIndex <- list2env(getChromatogramIndices(fileInfo, precursors, mzPntrs))
adaptiveRTs <- new.env()
refRuns <- new.env()
tree <- ape::reorder.phylo(ape::read.tree(text = "(run1:7,run2:2)master1;"), "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)
multipeptide <- getMultipeptide(precursors, features)
alignedVecs <- readRDS(file = file.path(dataPath, "master1_av.rds"))
adaptiveRT <- (adaptiveRTs[["run1_run2"]] + adaptiveRTs[["run2_run1"]])/2
multipeptide[["14383"]]$alignment_rank[multipeptide[["14383"]]$run == "master1"] <- 1L
multipeptide <- alignToMaster(ref = "master1", eXp = "run1", alignedVecs, refRuns[["master1"]][,1], adaptiveRT,
 multipeptide, prec2chromIndex, mzPntrs, fileInfo, precursors, params)
# Cleanup
rm(mzPntrs)
file.remove(file.path(dataPath, "master1_av.rds"))
file.remove(file.path(dataPath, "xics", "master1.chrom.mzML"))

## End(Not run)

Roestlab/DIAlign documentation built on Feb. 25, 2021, 5:18 p.m.