-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathenrich_analysis.Rd
More file actions
87 lines (74 loc) · 3.23 KB
/
Copy pathenrich_analysis.Rd
File metadata and controls
87 lines (74 loc) · 3.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pathway-enrichment-analysis.R
\name{enrich_analysis}
\alias{enrich_analysis}
\title{Perform GO/KEGG Enrichment or GSEA Analysis}
\usage{
enrich_analysis(
diff_data = NULL,
log2fc_col = NULL,
log2fc_threshold = 1,
pval_col = NULL,
pval_threshold = 0.05,
OrgDb = NULL,
organism = NULL,
type = c("go", "gsea"),
trend = c("up", "down"),
ont = c("BP", "CC", "MF", "ALL"),
pvalueCutoff = 0.05
)
}
\arguments{
\item{diff_data}{A data frame containing differential expression results with at least the columns \code{gene_name},
\code{log2fc_col}, and \code{pval_col}.}
\item{log2fc_col}{A character string specifying the name of the column in \code{diff_data} that contains log2 fold changes.}
\item{log2fc_threshold}{A numeric value specifying the log2 fold-change threshold for filtering differentially expressed genes.
Default is 1.}
\item{pval_col}{A character string specifying the name of the column in \code{diff_data} that contains p-values or adjusted p-values.}
\item{pval_threshold}{A numeric value specifying the threshold for filtering by p-values.
Default is 0.05.}
\item{OrgDb}{An \strong{OrgDb} object (e.g., \code{org.Hs.eg.db}) for gene annotation.}
\item{organism}{A character string specifying the KEGG organism code (e.g., \code{"hsa"} for Homo sapiens).}
\item{type}{A character string indicating the analysis type. Can be either \code{"go"} for GO/KEGG enrichment
or \code{"gsea"} for Gene Set Enrichment Analysis. Default is \code{c("go","gsea")} (match-arg).}
\item{trend}{A character string specifying whether to focus on up- or down-regulated genes for GO/KEGG enrichment.
Can be \code{"up"} or \code{"down"}. Default is \code{c("up","down")} (match-arg).}
\item{ont}{A character string specifying the GO sub-ontology. Can be \code{"BP"}, \code{"CC"}, \code{"MF"}, or \code{"ALL"}.
Default is \code{"BP"}.}
\item{pvalueCutoff}{A numeric value specifying the significance cutoff threshold for terms or pathways in the enrichment/GSEA results.
Default is 0.05.}
}
\value{
A named list with the following elements:
\itemize{
\item \code{enrich.go.obj}: The GO enrichment or GSEA result (depending on \code{type}).
\item \code{enrich.go.df}: A data frame filtered by \code{pvalueCutoff}, containing the GO terms or GSEA results.
\item \code{enrich.kegg.obj}: The KEGG enrichment or GSEA result.
\item \code{enrich.kegg.df}: A data frame filtered by \code{pvalueCutoff}, containing the KEGG pathways or GSEA results.
}
}
\description{
This function conducts Gene Ontology (GO) or Gene Set Enrichment Analysis (GSEA) on input differential data
using the clusterProfiler package. It can also perform KEGG pathway enrichment or GSEA. The function returns
both the enrichment result objects and filtered data frames containing significant terms/pathways.
}
\examples{
\dontrun{
# Example usage:
library(clusterProfiler)
library(org.Hs.eg.db)
# Assume diff_data is a data frame with columns: gene_name, log2FoldChange, pvalue
res <- enrich_analysis(
diff_data = diff_data,
log2fc_col = "log2FoldChange",
pval_col = "pvalue",
OrgDb = org.Hs.eg.db,
organism = "hsa",
type = "go",
trend = "up",
ont = "BP"
)
# Inspect the returned objects:
head(resenrich.go.df) #' head(resenrich.kegg.df)
}
}