View source: R/gene_set_enrichment_plot.R
gene_set_enrichment_plot | R Documentation |
This function takes the output of gene_set_enrichment()
and creates a
heatmap visualization of the results.
gene_set_enrichment_plot(
enrichment,
xlabs = unique(enrichment$ID),
PThresh = 12,
ORcut = 3,
enrichOnly = FALSE,
layerHeights = c(0, seq_len(length(unique(enrichment$test)))) * 15,
mypal = c("white", (grDevices::colorRampPalette(RColorBrewer::brewer.pal(9,
"YlOrRd")))(50)),
cex = 1.2
)
enrichment |
The output of |
xlabs |
A vector of names in the same order and length as
|
PThresh |
A |
ORcut |
A |
enrichOnly |
A |
layerHeights |
A |
mypal |
A vector with the color palette to use. Gets passed to
|
cex |
Passed to |
Check https://github.com/LieberInstitute/HumanPilot/blob/master/Analysis/Layer_Guesses/check_clinical_gene_sets.R to see a full script from where this family of functions is derived from.
A plot visualizing the gene set enrichment odds ratio and p-value results.
Andrew E Jaffe, Leonardo Collado-Torres
layer_matrix_plot
Other Gene set enrichment functions:
gene_set_enrichment()
## Read in the SFARI gene sets included in the package
asd_sfari <- utils::read.csv(
system.file(
"extdata",
"SFARI-Gene_genes_01-03-2020release_02-04-2020export.csv",
package = "spatialLIBD"
),
as.is = TRUE
)
## Format them appropriately
asd_sfari_geneList <- list(
Gene_SFARI_all = asd_sfari$ensembl.id,
Gene_SFARI_high = asd_sfari$ensembl.id[asd_sfari$gene.score < 3],
Gene_SFARI_syndromic = asd_sfari$ensembl.id[asd_sfari$syndromic == 1]
)
## Obtain the necessary data
if (!exists("modeling_results")) {
modeling_results <- fetch_data(type = "modeling_results")
}
## Compute the gene set enrichment results
asd_sfari_enrichment <- gene_set_enrichment(
gene_list = asd_sfari_geneList,
modeling_results = modeling_results,
model_type = "enrichment"
)
## Visualize the gene set enrichment results
## with a custom color palette
gene_set_enrichment_plot(
asd_sfari_enrichment,
xlabs = gsub(".*_", "", unique(asd_sfari_enrichment$ID)),
mypal = c(
"white",
grDevices::colorRampPalette(
RColorBrewer::brewer.pal(9, "BuGn")
)(50)
)
)
## Specify the layer heights so it resembles more the length of each
## layer in the brain
gene_set_enrichment_plot(
asd_sfari_enrichment,
xlabs = gsub(".*_", "", unique(asd_sfari_enrichment$ID)),
layerHeights = c(0, 40, 55, 75, 85, 110, 120, 135),
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.