brew: Bayesian Enrichment Estimation in R (BEER)

View source: R/brew.R

brewR Documentation

Bayesian Enrichment Estimation in R (BEER)

Description

Run BEER to estimate posterior probabilities of enrichment, sample-specific attenuation constants, relative fold-changes in comparison to beads-only samples, and proportion of peptides enriched per sample as described in Chen et. al. See Details for more information on input parameters.

Usage

brew(
  object,
  prior.params = list(method = "edgeR", a_pi = 2, b_pi = 300, a_phi = 1.25, b_phi =
    0.1, a_c = 80, b_c = 20, fc = 1),
  beads.args = list(lower = 1),
  se.params = list(method = "mle"),
  jags.params = list(n.chains = 1, n.adapt = 1000, n.iter = 10000, thin = 1, na.rm =
    TRUE, burn.in = 0, post.thin = 1, seed = as.numeric(format(Sys.Date(), "%Y%m%d"))),
  sample.dir = NULL,
  assay.names = c(phi = NULL, phi_Z = "logfc", Z = "prob", c = "sampleInfo", pi =
    "sampleInfo"),
  beadsRR = FALSE,
  BPPARAM = bpparam()
)

Arguments

object

PhIPData object

prior.params

named list of prior parameters

beads.args

named list of parameters supplied to estimating beads-only prior parameters (a_0, b_0)

se.params

named list of parameters specific to identifying clearly enriched peptides

jags.params

named list of parameters for running MCMC using JAGS

sample.dir

path to temporarily store RDS files for each sample run, if NULL then [base::tempdir] is used to temporarily store MCMC output and cleaned afterwards.

assay.names

named vector indicating where MCMC results should be stored in the PhIPData object

beadsRR

logical value specifying whether each beads-only sample should be compared to all other beads-only samples.

BPPARAM

[BiocParallel::BiocParallelParam] passed to BiocParallel functions.

Details

prior.params. List of prior parameters. Parameters include,

  • method: method used to estimate beads-only prior parameters a_0, b_0. Valid methods include 'custom' or any of the methods specified in getAB. If method = 'custom' is specified, a_0 and b_0 must be included in the list of prior parameters. 'edgeR' is used as the default method for estimating a_0, b_0.

  • a_pi, b_pi: prior shape parameters for the proportion of peptides enriched in a sample. Defaults to 2 and 300, respectively.

  • a_phi, b_phi: prior shape parameters of the gamma distribution that describe the valid range of enriched-fold changes. The shift is specified by fc. The default values of a_phi and b_phi are 1.25 and 0.1, respectively.

  • a_c, b_c: prior shape parameters for the attenuation constant. Default values for a_c and b_c are 80 and 20.

  • fc: minimum fold change for an enriched-peptide. fc describes the shift in the gamma distribution.

beads.args. Named list of parameters supplied to getAB. The estimation method used is specified in prior.params, but other valid parameters include lower and upper bounds for elicited parameters. As JAGS recommends that a, b > 1 for the beta distribution, beads.args defaults to list(lower = 1).

se.params. Named list of parameters supplied to guessEnriched. By default list(method = 'mle') is used to identify clearly enriched peptides.

jags.params. Named list of parameters for MCMC sampling. By default, BEER only runs one chain with 1,000 adaptation iteration and 10,000 sampling iterations. If unspecified, BEER uses the current date as the seed.

sample.dir. Path specifying where to store the intermediate results. If NULL, then results are stored in the default temporary directory. Otherwise, the MCMC samples for running BEER on each sample is stored as a single RDS file in the specified directory.

assay.names. Named list specifying where to store the point estimates. If NULL, estimates are not added to the PhIPData object. Valid exported estimates include,

  • phi: fold-change estimate after marginalizing over the posterior probability of enrichment. By default point estimates are not exported.

  • phi_Z: fold-change estimate presuming the peptide is enriched. By default phi_Z estimates are stored in 'logfc' assay.

  • Z: posterior probability of enrichment. Estimates are stored in the 'prob' assay by default.

  • c: attenuation constant estimates. Stored in 'sampleInfo' by default.

  • pi: point estimates for the proportion of peptides enriched in a sample. Stored in 'sampleInfo' by default.

Value

A PhIPData object with BEER results stored in the locations specified by assay.names.

See Also

[BiocParallel::BiocParallelParam] for subclasses, beadsRR for running each beads-only sample against all remaining samples, getAB for more information about valid parameters for estimating beads-only prior parameters, guessEnriched for more information about how clearly enriched peptides are identified, and [rjags::jags.model] for MCMC sampling parameters.

Examples

sim_data <- readRDS(system.file("extdata", "sim_data.rds", package = "beer"))

## Default back-end evaluation
brew(sim_data)

## Serial
brew(sim_data, BPPARAM = BiocParallel::SerialParam())

## Snow
brew(sim_data, BPPARAM = BiocParallel::SnowParam())

athchen/beer documentation built on July 2, 2022, 10:35 p.m.