GEX_DEgenes: Wrapper for differential gene expression analysis and...

View source: R/GEX_DEgenes.R

GEX_DEgenesR Documentation

Wrapper for differential gene expression analysis and plotting

Description

Extracts the differentially expressed genes between two groups of cells. These groups are defined as cells having either of two entries (group1, group2) in the grouping.column of the input Seurat object metadata This function uses the FindMarkers function from the Seurat package.

Usage

GEX_DEgenes(
  GEX,
  FindMarkers.out,
  grouping.column,
  group1,
  group2,
  min.pct,
  filter,
  return.plot,
  logFC,
  color.p.threshold,
  color.log.threshold,
  color.by.threshold,
  up.genes,
  down.genes,
  base,
  label.n.top.genes,
  genes.to.label,
  platypus.version,
  size.top.colorbar
)

Arguments

GEX

Output Seurat object from automate_GEX or VDJ_GEX_matrix_function (VDJ_GEX_matrix.output[[2]]) function that contained at least two distinct biological groups.

FindMarkers.out

OPTIONAL: the output of the FindMarkers function. This skips the DEG calculation step and outputs desired plots. All plotting parameters function as normal. Grouping parameters and min.pct are ignored.

grouping.column

Character. A column name of GEX@meta.data. In this column, group1 and group2 should be found. Defaults to "sample_id". Could also be set to "seurat_clusters" to generate DEGs between cells of 2 chosen clusters.

group1

either character or integer specifying the first group of cells that should be compared. (e.g. "s1" if sample_id is used as grouping.column)

group2

either character or integer specifying the first group of cells that should be compared. (e.g. "s2" if sample_id is used as grouping.column)

min.pct

The minimum percentage of cells expressing a gene in either of the two groups to be compared.

filter

Character vector of initials of the genes to be filtered. Default is c("MT-", "RPL", "RPS"), which filters mitochondrial and ribosomal genes.

return.plot

Character specifying if a "heatmap", "heatmap" or a "volcano" or "none" is to be returned. If not "none" then @return is a list where the first element is a dataframe and the second a plot (see @return). Defaults to none

logFC

Logical specifying whether the genes will be displayed based on logFC (TRUE) or pvalue (FALSE).

color.p.threshold

numeric specifying the adjusted p-value threshold for geom_points to be colored. Default is set to 0.01.

color.log.threshold

numeric specifying the absolute logFC threshold for geom_points to be colored. Default is set to 0.25.

color.by.threshold

Boolean. Set to TRUE to color by color.p.threshold and color.log.threshold. Set to FALSE for a continuous color scale by fold change.

up.genes

FOR HEATMAP Integer specifying the number of upregulated genes to be shown.

down.genes

FOR HEATMAP Integer specifying the number of downregulated genes to be shown.

base

The base with respect to which logarithms are computed. Default: 2

label.n.top.genes

FOR VOLCANO Interger. How many top genes to label either by Fold change (if logFC ==TRUE) or by p.value (if logFC == FALSE). More than 50 are not recommended. Also works in conjunction with genes.to.label

genes.to.label

FOR VOLCANO Character vector of genes to label irregardless of their p value.

platypus.version

Function works with V2 and V3, no need to set this parameter

size.top.colorbar

Integer. Size of the top colorbar for heatmap plot.

Value

Returns a dataframe containing the output from the FindMarkers function, which contains information regarding the genes that are differentially regulated, statistics (p value and log fold change), and the percent of cells expressing the particular gene for both groups.

Examples


try({DEGs <- GEX_DEgenes(GEX = Platypus::small_vgm[[2]],min.pct = .25,
group1 = "s1",group2 = "s2", return.plot = "volcano")})


Platypus documentation built on Oct. 18, 2024, 5:08 p.m.