compute_posterior_prob: Compute posterior probabilities for putative theoretical...

Description Usage Arguments Value Examples

View source: R/annotate_features.R

Description

Estimates posterior probabilities of all possible theoretical features for each measured feature based on prior probabilities and additional information about adduct and isotope connections using a Gibbs sampler. This function is based on code of the internal function IPA.sampler.Add.Iso.Bio in the R package IPA (available on github at https://github.com/francescodc87/IPA).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
compute_posterior_prob(
  prior.prob,
  dat,
  add.m = NULL,
  iso.m = NULL,
  bio.m = NULL,
  delta.add = 0.5,
  delta.iso = 0.5,
  delta.bio = 1,
  ratio.tol = 0.8,
  no.its = 1100,
  burn = 100
)

Arguments

prior.prob

matrix with prior probabilities for each measured feature in rows and theoretical features in columns (e.g. as generated by the function compute_prior_prob).

dat

data.frame with information about measured features with columns id (= unique identifier), mz (= measured mz value), intensity (= measured intensity).

add.m

matrix with information about adduct connections (e.g. as generated by function generate_connectivity_matrix).)

iso.m

matrix with information about isotope connections (e.g. as generated by function generate_connectivity_matrix).)

bio.m

matrix with information about biochemical connections (e.g. as generated by function generate_connectivity_matrix).)

delta.add

Numeric. Confidence on the information encoded in add.m (smaller value means higher confidence).

delta.iso

Numeric. Confidence on the information encoded in iso.m (smaller value means higher confidence).

delta.bio

Numeric. Confidence on the information encoded in bio.m (smaller value means higher confidence).

ratio.tol

Numeric. Minimum accepted ratio between thereoretical and observed intensity ratios between isotopes (default = 0.8).

no.its

Numeric. Number of iterations to be performed by the Gibbs sampler (default = 1100).

burn

Numeric. Number of initial iterations to be ignored when computing the posterior probabilities (default = 100).

Value

matrix with measured features in rows and theoretical possible features in columns. The cell i,j contains the posterior probability that measured feature i belongs to theoretical feature j.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
data("se.example")
data("info.features")

dat = prepare_data_for_annotation(se = se.example)
hits.m = find_hits(info.features = info.features,
                   dat = dat,
                   ppm = 20)

prior.prob = compute_prior_prob(hits.m = hits.m,
                                info.features = info.features,
                                dat = dat,
                                ppm = 20)
add.m = generate_connectivity_matrix(info.features = info.features,
                                     type = "adducts")

set.seed(20200402)
post.prob = compute_posterior_prob(prior.prob = prior.prob,
                                   dat = dat,
                                   add.m = add.m,
                                   delta.add = 0.1)

szymczak-lab/preprocessHighResMS documentation built on Oct. 6, 2020, 12:50 a.m.