CalculateFractionInTrome: Calculate Fraction of Genes in Transcriptome

View source: R/Seurat.Utils.R

CalculateFractionInTromeR Documentation

Calculate Fraction of Genes in Transcriptome

Description

Calculates the fraction of specified genes within the entire transcriptome of each cell in a Seurat object. This function is useful for assessing the relative abundance of a set of genes across cells, such as identifying cells with high expression of marker genes.

Usage

CalculateFractionInTrome(
  genesCalc.Cor.Seuratet = c("MALAT1"),
  obj = combined.obj,
  data.slot = c("counts", "data")[2]
)

Arguments

obj

A Seurat object containing gene expression data. Default: combined.obj. The function extracts gene expression data from this object to calculate fractions.

data.slot

The data slot from which to extract expression data. This can be "counts" for raw counts or "data" for normalized data. Default: second element ("data").

geneset

A character vector of gene symbols for which the fraction in the transcriptome will be calculated. Default: c("MALAT1"). The function will check for the existence of these genes in the Seurat object.

Value

A numeric vector where each element represents the fraction of the specified geneset's expression relative to the total transcriptome of a cell, expressed as a percentage. The names of the vector correspond to cell IDs.

Note

This function calls check.genes to verify the existence of the specified genes within the Seurat object. If genes are not found, it will return a warning.

See Also

GetAssayData for retrieving expression data from a Seurat object.

Examples

## Not run: 
if (interactive()) {
  # Assuming `combined.obj` is your Seurat object
  fractionInTranscriptome <- CalculateFractionInTranscriptome(geneset = c("MALAT1", "GAPDH"), obj = combined.obj)
  # This will return the fraction of MALAT1 and GAPDH in the transcriptome of each cell
}

## End(Not run)


vertesy/Seurat.utils documentation built on Dec. 4, 2024, 5:20 p.m.