differentialAbundance: Differential abundance analysis

View source: R/differentialAbundance.R

differentialAbundanceR Documentation

Differential abundance analysis

Description

Use a Fisher exact test to calculate differential abdunance of each sequence in two samples and reports the log2 transformed fold change, P value and adjusted P value.

Usage

differentialAbundance(
  study_table,
  repertoire_ids = NULL,
  abundance = "duplicate_count",
  type = "junction_aa",
  q = 1,
  zero = 1,
  parallel = FALSE
)

Arguments

study_table

A tibble consisting of antigen receptor sequences imported by the LymphoSeq function readImmunoSeq.

repertoire_ids

A character vector of two repertoire_ids in study_table to be compared. If NULL, the first two repertoire_ids from study_table will be used.

abundance

The input value for the Fisher exact test. "duplicate_count" is recommend but "duplicate_count" may also be used.

type

A character vector indicating whether "junction_aa" or "junction" sequences should be used. If "junction_aa" is specified, then run productiveSeqs first.

q

A numeric value between 0.0 and 1.0 indicating the threshold Holms adjusted P value (also knowns as the false discovery rate or q value) to subset the results with. Any sequences with a q value greater than this value will not be shown.

zero

A numeric value to set all zero values to when calculating the log2 transformed fold change between samples 1 and 2. This does not apply to the p and q value calculations.

parallel

A boolean indicating wheter parallel processing should be used or not.

Value

Returns a data frame with columns corresponding to the frequency of the abudance measure in samples 1 and 2, the P value, Q value (Holms adjusted P value, also knowns as the false discovery rate), and log2 transformed fold change.

Examples

file_path <- system.file("extdata", "TCRB_sequencing", package = "LymphoSeq2")

stable <- readImmunoSeq(path = file_path)

atable <- productiveSeq(study_table = stable, aggregate = "junction_aa")

differentialAbundance(study_table = atable, repertoire_ids = c("TRB_Unsorted_949", "TRB_Unsorted_1320"), 
                      type = "junction_aa", q = 0.01, zero = 0.001)

elulu3/LymphoSeqTest documentation built on Aug. 27, 2022, 5:47 a.m.