get_counts_sig_genes: Extract counts of differentially expressed genes

Description Usage Arguments Value

View source: R/get_counts_sig_genes.R

Description

This function uses the results from a differential expression analysis to filter a counts object to include only significant genes. Significance can be determined using p-value and log-fold-change cuts specified in p_cut and fc_cut, respectively, or by including a threshold column in topGenes and specifying that column using threshold_col.

Usage

1
2
3
4
5
get_counts_sig_genes(
  counts, topGenes,
  p_cut=0.01, fc_cut=log2(1.5),
  p_col="adj.P.Val", fc_col="logFC",
  threshold_col=NULL)

Arguments

counts

a matrix or data frame containing the gene expression data, or an object from which counts can be exrracted (such as an EList or DGEList). Should have samples in columns and genes in rows. Rownames must contain gene names corresponding to gene names in topGenes.

topGenes

a data frame, typically the output of a call to topTable. Must contain genes, log2 fold-change, and adjusted p-values.

p_cut

numeric, the cutoff for adjusted p-value. Genes with adjusted p-values greater than or equal to this value are not included in the result. Defaults to 0.01. Ignored if threshold_col is specified.

fc_cut

numeric, the absolute value cutoff for log2 fold change. Genes with absolute value log2-FC less than or equal to this value are not included in the result. Defaults to log2(1.5). Ignored if threshold_col is specified. Set to 0 to include all genes, or NULL to ignore logFC completely (e.g. for multi-group comparisons).

p_col

name or number of the column in topGenes containing the p-values to compare to p_cut. Defaults to "adj.P.Val", which corresponds to the output from topTable.

fc_col

name or number of the column in topGenes containing the fold-change values to compare to fc_cut. Defaults to "logFC", which corresponds to the output from topTable.

threshold_col

name or number of the column in topGenes containing the logical values indicating which genes meet thresholds. This is an alternate way to determine signficance of genes. If specified, p_cut and fc_cut are ignored.

Value

A matrix or data frame (matching the class of counts), with only rows with log-FC and adjusted p-values meeting specified thresholds.


BenaroyaResearch/limmaTools documentation built on Dec. 17, 2021, 10:49 a.m.