map_genes: Map Gene Identifiers in DESeq2 Results

View source: R/BulkRNAseq.R

map_genesR Documentation

Map Gene Identifiers in DESeq2 Results

Description

This function maps Ensembl gene IDs in DESeq2 differential expression results to target gene names using a provided gene mapping data frame.

Usage

map_genes(DE_Seq_Result, gene_mapping = gene_mapping_MMUL10)

Arguments

DE_Seq_Result

A data frame containing DESeq2 results, where row names are Ensembl gene IDs.

gene_mapping

A data frame with at least two columns: '"input"' (Ensembl IDs) and '"target"' (gene symbols). Default is 'gene_mapping_MMUL10'.

Details

The function:

  • Extracts Ensembl gene IDs from 'DE_Seq_Result' row names.

  • Merges DESeq2 results with 'gene_mapping' to retrieve corresponding gene symbols.

  • Assigns '"gene"' column values based on mapped names or retains Ensembl IDs if no match is found.

Value

A data frame with an additional '"ensembl_ID"' column and a '"gene"' column containing mapped gene names. If no match is found in 'gene_mapping', the Ensembl ID is retained as the gene name.

Examples

## Not run: 
# Example DESeq2 results (mock data)
DE_Seq_Result <- data.frame(log2FoldChange = c(1.5, -2.3, 0.8),
                            padj = c(0.01, 0.05, 0.2))
rownames(DE_Seq_Result) <- c("ENSG000001", "ENSG000002", "ENSG000003")

# Example gene mapping table
gene_mapping <- data.frame(input = c("ENSG000001", "ENSG000002"),
                           target = c("GeneA", "GeneB"))

# Run gene mapping
mapped_results <- map_genes(DE_Seq_Result, gene_mapping)
print(mapped_results)

## End(Not run)

eisascience/scCustFx documentation built on June 2, 2025, 3:59 a.m.