FindDifferentVariants: Find differentially frequent variants between two populations

View source: R/FindDifferentVariants.R

FindDifferentVariantsR Documentation

Find differentially frequent variants between two populations

Description

Starting from a Seurat object, and two groups of cells (given as their ident name, or as a vector of cell barcodes. If second group is omitted, assumed to be all other cells), computes the differential frequency of occurance of variants with a chi-square frequency test. Both p-values and Bonferroni-corrected adjusted p-values are returned, as well as the difference of frequency of alternate alleles between the two populations.

Usage

FindDifferentVariants(
  object,
  ident.1,
  ident.2 = NULL,
  min.cells = 15,
  sort.by = "pval",
  assay = c("REF", "ALT"),
  layer = "data",
  show.progress = 500,
  pval.lower.limit = 1e-100
)

Arguments

object

Seurat object.

ident.1

character(n). The name of an identity or a list of cell barcodes or column positions in the Seurat object, defining the first cell population.

ident.2

character(n). The name of an identity or a list of cell barcodes or column positions in the Seurat object, defining the second cell population, or NULL to use all the other cells. Default: NULL.

min.cells

numeric(1). The minimal number of cells that should be have data in both populations for differential testing to be performed. Default: 15.

sort.by

character(1). "pval" to sort the result dataframe by p-value, or "deltafreq" to sort by absolute difference in frequency. Any other value will result in no sorting, conserving the feature order in the Seurat object. Default: pval.

layer

character(1). The assay layer that should be used in the Seurat object. Default: "data".

show.progress

numeric(1). Number of tests performed between updates on the advance. FALSE or 0 for no progress reports. Default: 500.

pval.lower.limit

numeric(1). p-vals lower than this limit will be truncated to this limit. Useful to avoid log(0) and set an axis limit in volcano-like plots of the results.

assays

character(2). The name of the assays in which the reference allele count and alt allele count are stored in the seurat object. Default: c("REF","ALT").

Value

Returns a data frame with columns "n1" (number of cells with variant data in population 1) and "n2" (same in population 2), the frequency of ref and alt allele in both populations "freq1" and "freq2", the difference in frequency "deltafreq", and the results of the chi-square test for identitical frequency with or without Bonferroni correction "pval" and "adj.pval".

Examples

DifferentialTestingresults <- FindDifferentVariants(MySeuratObject, "FirstIdentName", "OtherIdentName")

nbroguiere/burgertools documentation built on Jan. 30, 2024, 3:48 a.m.