OrgHeatmap is an R package for visualizing numerical data (e.g., gene expression levels, physiological indicators) on human, mouse, and organelle diagrams. It supports custom color schemes, organ system filtering, and quantitative bar charts to intuitively display data distribution across anatomical structures.
- Multi-species Support: Visualize data on human, mouse, or organelle diagrams
- Flexible Color Schemes: Unified color configuration for heatmaps and bar charts
- Organ System Filtering: Focus on specific anatomical systems (circulatory, respiratory, etc.)
- Quantitative Comparison: Integrated bar charts for value comparison
- Name Standardization: Handle non-standard organ names with mapping functionality
- Data Aggregation: Automatic handling of duplicate organ entries (mean, sum, count)
- High-Quality Output: Save plots and cleaned data in multiple formats
install.packages("OrgHeatmap_0.3.1.tar.gz", repos = NULL, type = "source")# Install devtools if not already installed
if (!require("devtools")) install.packages("devtools")
devtools::install_github("QiruiShen439/OrgHeatmap")The package automatically checks for and installs required dependencies:
# Core dependencies (automatically checked)
install.packages(c("sf", "dplyr", "stringdist", "ggpolypath", "patchwork",
"viridis", "data.table", "stringr", "RColorBrewer",
"ggplot2", "purrr"))library(OrgHeatmap)
# Load built-in example dataset
data_path <- system.file("extdata", "exampledata.Rdata", package = "OrgHeatmap")
load(data_path)
# Inspect data structure
head(example_Data3)# Create basic organ visualization with default settings
result <- OrgHeatmap(data = example_Data3)
print(result$plot)# Visualize mouse digestive system
mouse_result <- OrgHeatmap(
data = example_Data1,
species = "mouse",
system = "digestive",
palette = "PuBu",
title = "Mouse Digestive System"
)
print(mouse_result$plot)# Create organelle data
organelle_data <- data.frame(
organ = c("mitochondrion", "nucleus", "endoplasmic_reticulum", "cell_membrane"),
value = c(15.2, 8.7, 6.3, 6.8)
)
# Visualize organelles
organelle_result <- OrgHeatmap(
data = organelle_data,
species = "organelle",
title = "Organelle Expression"
)
print(organelle_result$plot)# Focus on specific organ systems
circulatory_plot <- OrgHeatmap(
data = example_Data3,
system = "circulatory",
title = "Circulatory System Data",
showall = TRUE # Show all organ outlines for context
)
print(circulatory_plot$plot)respiratory_plot <- OrgHeatmap(
data = example_Data3,
system = "respiratory",
palette = "PuBuGn", # RColorBrewer palette
reverse_palette = TRUE, # Reverse color order
color_mid = "#87CEEB", # Custom middle color
organbar = TRUE,
organbar_title = "Mean Value",
title = "Respiratory System (PuBuGn Palette)"
)custom_plot <- OrgHeatmap(
data = example_Data3,
color_low = "#F7FBFF", # Light blue for low values
color_high = "#08306B", # Dark blue for high values
color_mid = "#6BAED6", # Medium blue for middle values
organbar_low = "#FFF7BC", # Light yellow for bar chart low
organbar_high = "#D95F0E", # Dark orange for bar chart high
title = "Custom Color Gradient"
)# Custom organ name standardization
custom_mapping <- c(
"adrenal" = "adrenal_gland",
"lymph node" = "lymph_node",
"soft tissue" = "muscle"
)
mapped_plot <- OrgHeatmap(
data = expr_data,
organ_name_mapping = custom_mapping,
value_col = "expression",
title = "TP53 Expression with Custom Mapping"
)# Extend default organ system mapping
prostate_organ_systems <- rbind(
human_organ_systems,
data.frame(
organ = c("prostate", "bone", "lymph_node", "adrenal_gland"),
system = c("reproductive", "musculoskeletal", "lymphatic", "endocrine"),
stringsAsFactors = FALSE
)
)
extended_plot <- OrgHeatmap(
data = example_Data3,
organ_system_map = prostate_organ_systems,
system = "reproductive",
title = "Extended Organ System Mapping"
)result <- OrgHeatmap(
data = example_Data3,
system = "circulatory",
save_plot = TRUE,
plot_path = file.path(getwd(), "circulatory_system.png"),
plot_width = 12,
plot_height = 10,
plot_dpi = 300,
plot_device = "png",
save_clean_data = TRUE,
clean_data_path = file.path(getwd(), "cleaned_data.rds")
)# Access all returned components
print(result$plot) # ggplot2 object
head(result$clean_data) # Cleaned data frame
result$system_used # System used for filtering
result$mapped_organs # Standardized organ names
result$missing_organs # Organs without coordinates
result$total_value # Sum of all valuesThe package uses a unified color system with the following priority: 1.Highest Priority: organbar_low/organbar_high (bar chart colors) 2.Medium Priority: color_low/color_high/color_mid (heatmap colors) 3.Lowest Priority: palette with optional reverse_palette
RColorBrewer Palettes: "YlOrRd", "PuBuGn", "Blues", etc. Viridis Palettes: "viridis", "plasma", "magma", "inferno", "cividis" Custom Colors: Any valid color name or hex code
-species: "human", "mouse", or "organelle"
-system: Filter by organ system (not applicable for organelles)
-palette: RColorBrewer palette name for unified coloring
-organbar: Show/hide quantitative bar chart
-showall: Display all organ outlines for anatomical context
-organ_name_mapping: Standardize non-standard organ names
-aggregate_method: "mean", "sum", or "count" for duplicate organs
The package includes comprehensive example datasets:
-example_Data1
-example_Data2
-example_Data3
-expr_data
# Check available organs in your species
names(human_organ_coord) # For human
names(mouse_organ_coord) # For mouse
names(organelle_organ_coord) # For organelles# Validate RColorBrewer palette names
RColorBrewer::brewer.pal.info# Install all dependencies manually if needed
install.packages(c("sf", "ggpolypath", "patchwork", "stringdist"))1.Ensure data has valid numeric values in the specified value column 2.Check that organ names match the coordinate data after standardization 3.Verify that the specified system contains organs with data
For comprehensive tutorials and parameter explanations:
# Access function documentation
?OrgHeatmap
# View all package vignettes
browseVignettes("OrgHeatmap")-
Qirui Shen
-
Email: shenqr@i.smu.edu.cn
-
GitHub: QiruiShen439