Add directionality to pathway enrichment
add_pathway_direction(
x,
gene_hits,
delim = "/",
dir_colname = "z-score",
verbose = FALSE,
...
)
enrichResult
object as returned by clusterProfiler::enricher()
numeric
vector, with values c(-1, 1)
to
indicate up or down, respectively, and whose names(gene_hits)
should match the gene symbols (or values) in x@result$geneID
.
If no names(gene_hits)
match values in the geneID
column,
the direction score will ultimately be populated with NA
values.
character
string with delimiter used in the
enrichResult
object, default: "/"
character
string indicating the column name to
create, default "z-score"
.
logical
indicating whether to print verbose output.
additional arguments are ignored.
enrichResult
object, with directional values populated
into the result column name defined by dir_colname
.
When no genes in a gene set are present in gene_hits
the
expected directional value is NA
.
This function uses pathway enrichment data provided as an
enrichResult
object. Data is added as a new column (default "z-score")
with numeric
values indicating the direction of change.
It requires gene_hits
with the direction of change for each gene,
which is used to determine the up- and down-regulated genes
in each gene set.
The default equation uses the IPA z-score of activation, since the z-score has beneficial properties in downstream visualization functions. It is symmetric around zero, and implies reasonable thresholds.
Note that when no genes involved in enrichment are present in the
gene_hits
data, the resulting directional value is expected
to be NA
, which will be treated as "non-directional" in downstream
visualization functions.
The IPA Activation "z-score"
uses the following formula:
z <- (N_genes_up - N_genes_down) / sqrt(N_genes_up + N_genes_down)
Citation for IPA formula: https://doi.org/10.1093/bioinformatics/btt703 as referenced: IPA FAQ - Statistical Calculations
Other jam enrichment functions:
multiEnrichMap()
,
topEnrichBySource()