Extract functional terms enriched in the DE genes, based on clusterProfiler
Source:R/run_enrichment.R
run_cluPro.Rd
A wrapper for extracting functional GO terms enriched in a list of (DE) genes, based on the algorithm and the implementation in the clusterProfiler package
Usage
run_cluPro(
de_container = NULL,
res_de = NULL,
de_genes = NULL,
bg_genes = NULL,
top_de = NULL,
FDR_threshold = 0.05,
min_counts = 0,
mapping = "org.Hs.eg.db",
de_type = "up_and_down",
keyType = "SYMBOL",
verbose = TRUE,
...
)
Arguments
- de_container
An object containing the data for a Differential Expression workflow (e.g.
DESeq2
,edgeR
orlimma
). Currently, this can be aDESeqDataSet
object, normally obtained after running your data through theDESeq2
framework.- res_de
An object containing the results of the Differential Expression analysis workflow (e.g.
DESeq2
,edgeR
orlimma
). Currently, this can be aDESeqResults
object created using theDESeq2
framework.- de_genes
A vector of (differentially expressed) genes
- bg_genes
A vector of background genes, e.g. all (expressed) genes in the assays
- top_de
numeric, how many of the top differentially expressed genes to use for the enrichment analysis. Attempts to reduce redundancy. Assumes the data is sorted by padj (default in DESeq2).
- FDR_threshold
The pvalue threshold to us for counting genes as de. Default is 0.05
- min_counts
numeric, min number of counts a gene needs to have to be included in the geneset that the de genes are compared to. Default is 0, recommended only for advanced users.
- mapping
Which
org.XX.eg.db
package to use for annotation - select according to the species- de_type
One of: 'up', 'down', or 'up_and_down' Which genes to use for GOterm calculations
- keyType
Gene format to input into enrichGO from clusterProfiler. If res_de and de_container are used use "SYMBOL" for more information check the enrichGO documentation
- verbose
Logical, whether to add messages telling the user which steps were taken
- ...
Further parameters to use for the
clusterProfiler::enrichGO()
function fromclusterProfiler
.
See also
clusterProfiler::enrichGO()
for the underlying method
Examples
library("macrophage")
library("DESeq2")
data(gse, package = "macrophage")
dds_macrophage <- DESeqDataSet(gse, design = ~ line + condition)
#> using counts and average transcript lengths from tximeta
rownames(dds_macrophage) <- substr(rownames(dds_macrophage), 1, 15)
keep <- rowSums(counts(dds_macrophage) >= 10) >= 6
dds_macrophage <- dds_macrophage[keep, ]
dds_macrophage <- DESeq(dds_macrophage)
#> estimating size factors
#> using 'avgTxLength' from assays(dds), correcting for library size
#> estimating dispersions
#> gene-wise dispersion estimates
#> mean-dispersion relationship
#> final dispersion estimates
#> fitting model and testing
data(res_de_macrophage, package = "mosdef")
library("AnnotationDbi")
library("org.Hs.eg.db")
library("clusterProfiler")
#> clusterProfiler v4.17.0 Learn more at https://yulab-smu.top/contribution-knowledge-mining/
#>
#> Please cite:
#>
#> S Xu, E Hu, Y Cai, Z Xie, X Luo, L Zhan, W Tang, Q Wang, B Liu, R Wang,
#> W Xie, T Wu, L Xie, G Yu. Using clusterProfiler to characterize
#> multiomics data. Nature Protocols. 2024, 19(11):3292-3320
#>
#> Attaching package: ‘clusterProfiler’
#> The following object is masked from ‘package:AnnotationDbi’:
#>
#> select
#> The following object is masked from ‘package:IRanges’:
#>
#> slice
#> The following object is masked from ‘package:S4Vectors’:
#>
#> rename
#> The following object is masked from ‘package:stats’:
#>
#> filter
CluProde_macrophage <- run_cluPro(
res_de = res_macrophage_IFNg_vs_naive,
de_container = dds_macrophage,
mapping = "org.Hs.eg.db"
)
#> 'select()' returned 1:many mapping between keys and columns
#> 'select()' returned 1:many mapping between keys and columns
#> 'select()' returned 1:many mapping between keys and columns
#> Your dataset has 1024 DE genes.
#> You selected 1024 (100.00%) genes for the enrichment analysis.
#> You are analyzing up_and_down-regulated genes in the `res_de` container