New Features and Enhancements in v1.2.0

Dark Theme Support for Feature Plot Visualization

The FeaturePlot3 and FeaturePlot3.grid functions now support a dark theme option, providing better contrast for visualizing gene expression patterns, particularly in presentations or low-light environments:

library(Seurat)
library(SeuratExtend)

# Using dark theme with FeaturePlot3
FeaturePlot3(
  pbmc, 
  color = "rgb", 
  feature.1 = "CD3D", 
  feature.2 = "CD14", 
  feature.3 = "CD79A", 
  pt.size = 1,
  dark.theme = TRUE
)

New Violin Plot Styling Options

The VlnPlot2 function now supports an "outline" style option, which uses white-filled violins with colored outlines instead of the default filled style:

# Outline style for violin plots
genes <- c("CD3D", "CD14", "CD79A")
VlnPlot2(pbmc, features = genes, style = "outline", ncol = 1)

New ClusterDistrPlot Function

The new ClusterDistrPlot function extends ClusterDistrBar to allow comparison of cluster distribution patterns between experimental conditions. When the condition parameter is provided, it creates boxplots grouped by condition instead of stacked bars:

# Compare cluster distribution between conditions
ClusterDistrPlot(
  origin = pbmc$sample_id,
  cluster = pbmc$cluster,
  condition = pbmc$condition
)

This function inherits styling options from VlnPlot2 when in boxplot mode, making it highly versatile for comparing cell type proportions across experimental groups.

Enhanced Log Fold Change Options in Differential Analysis Plots

Both WaterfallPlot and VolcanoPlot functions now support different logarithm bases for fold change calculations through the log.base parameter:

# Using log base 2 for fold change calculations in WaterfallPlot
WaterfallPlot(
  pbmc, 
  group.by = "cluster", 
  features = VariableFeatures(pbmc)[1:80],
  ident.1 = "Mono CD14", 
  ident.2 = "CD8 T cell", 
  length = "logFC",
  log.base = "2",    # Use log2 instead of natural log
  top.n = 20)
# Using log base 2 in VolcanoPlot
VolcanoPlot(
  pbmc,
  ident.1 = "B cell",
  ident.2 = "CD8 T cell",
  log.base = "2"    # Use log2 instead of natural log
)

Available options include: - log.base = "e": Natural logarithm (default) - log.base = "2": Log base 2 - log.base = "10": Log base 10 - Any numeric value for custom bases

Color Scheme Updates

New "Bright" Color Scheme and Default Change

A new vibrant color scheme "bright" has been added for visualizations requiring higher contrast:

library(cowplot)
DimPlot2(pbmc, features = c("orig.ident", "cluster"), cols = "bright", ncol = 2, theme = NoAxes())

Based on user feedback, the default discrete color scheme has been changed from "default" (darker theme) to "light" to avoid color inconsistency in DimPlot2 when toggling between labeled and unlabeled displays.

If you prefer to retain the original "default" (darker) color scheme, you can use:

seu <- save_colors(seu, col_list = list("discrete" = "default"))

Enhanced Gene Set Enrichment Analysis (GSEA) Capabilities

Improved Database Management

SeuratExtend now offers enhanced ways to manage and update the GO and Reactome databases used in your GSEA analyses:

# Install specific versions of SeuratExtendData for different database releases
install_SeuratExtendData("latest")    # Latest version (April 2025 data)
install_SeuratExtendData("stable")    # Stable version (January 2020 data)
install_SeuratExtendData("v0.2.1")    # Specific version with January 2020 datasets
install_SeuratExtendData("v0.3.0")    # Specific version with April 2025 datasets

This ensures compatibility with specific analysis workflows or when you need to match results from previous studies.

Creating and Using Custom Databases

SeuratExtend now provides a more streamlined workflow for creating and using custom GO or Reactome databases:

# Load custom database
custom_GO_Data <- readRDS("path/to/your/GO_Data.rds")

# Use with SeuratExtend by assigning to global environment
GO_Data <- custom_GO_Data

# Run analysis
seu <- GeneSetAnalysisGO(seu, parent = "immune_system_process")

# When done, remove the global variable
rm(GO_Data)

This feature is particularly useful for: - Using the latest database updates - Creating databases for additional model organisms - Developing custom pathway collections

For detailed documentation on creating custom databases, SeuratExtend provides comprehensive guides accessible through:

browseURL("https://github.com/huayc09/SeuratExtendData/blob/main/inst/db_creation/README_GO_Data.md")
browseURL("https://github.com/huayc09/SeuratExtendData/blob/main/inst/db_creation/README_Reactome_Data.md")

Apple Silicon (M1/M2/M3/M4) Support for Trajectory Analysis

SeuratExtend v1.2.0 adds support for Apple Silicon chips (M1/M2/M3/M4), allowing macOS users to run Python-based trajectory analysis tools. However, this support comes with specific limitations that require following a particular workflow to avoid R session crashes:

# IMPORTANT: Apple Silicon users MUST initialize Python environment BEFORE loading any data
library(SeuratExtend)
activate_python()  # Must call this function FIRST to prevent memory-related crashes

# Only THEN load your data and proceed with analysis
seu <- readRDS("path/to/seurat_object.rds")

Important Considerations:

Despite these limitations, the create_condaenv_seuratextend() function now automatically detects Apple Silicon and uses the appropriate configuration, enabling Mac users to run:

Bug Fixes and Improvements

Several important bug fixes and enhancements have been implemented based on user feedback:

New Features and Enhancements in v1.1.0

New Visualization Functions

Enhanced Dot Plots with DotPlot2

A new function DotPlot2 has been introduced, combining dot size (percent of expressing cells) with color intensity (average expression) for more informative visualizations:

library(Seurat)
library(SeuratExtend)

# With grouped features
grouped_features <- list(
  "B_cell_markers" = c("MS4A1", "CD79A"),
  "T_cell_markers" = c("CD3D", "CD8A", "IL7R"),
  "Myeloid_markers" = c("CD14", "FCGR3A", "S100A8")
)
DotPlot2(pbmc, features = grouped_features)

New Volcano Plots

The new VolcanoPlot function provides statistical visualization of differential expression:

VolcanoPlot(pbmc, 
            ident.1 = "B cell",
            ident.2 = "CD8 T cell")

UMAP Arrow Annotations

Added theme_umap_arrows for simplified axis indicators on dimension reduction plots:

DimPlot2(pbmc, theme = NoAxes()) + theme_umap_arrows()

Enhanced Existing Functions

VlnPlot2 Enhancements

Added support for mean and median lines in violin plots:

VlnPlot2(pbmc, 
         features = c("CCR7", "IL7R", "TCF7"),
         cols = "light",
         show.mean = TRUE,      # Show mean and median lines
         mean_colors = c("red", "blue"),  # Colors for mean and median
         ncol = 1)

New WaterfallPlot Style: "segment"

Added a new visualization style "segment" to WaterfallPlot, providing an alternative way to display differences between conditions:

# Prepare data
pbmc <- GeneSetAnalysis(pbmc, genesets = hall50$human)
matr <- pbmc@misc$AUCell$genesets

# Create a plot using the new segment style
WaterfallPlot(
  matr,
  f = pbmc$cluster,
  ident.1 = "Mono CD14",
  ident.2 = "CD8 T cell",
  style = "segment",
  color_theme = "D"
)

Color Scheme Updates

New Default Color Schemes

Two major color scheme changes have been implemented in v1.1.0:

  1. For continuous variables: Changed from viridis "A" to RColorBrewer "Blues"
  2. For heatmaps: Updated from c(low = muted("blue"), mid = "white", high = muted("red")) to "BuRd"

Here are visual comparisons of the old and new defaults:

Continuous Variable Color Scheme
# Create a side-by-side comparison for continuous variables
library(cowplot)
library(ggpubr)

# Old default (viridis "A")
p1 <- DimPlot2(pbmc, 
               features = "CD3D", 
               cols = "A",  # Old default
               theme = theme_umap_arrows()) 

# New default (Blues)
p2 <- DimPlot2(pbmc, 
               features = "CD3D", 
               theme = theme_umap_arrows()) 

plot_grid(
  annotate_figure(p1, top = text_grob("Old Default (viridis 'A')", size = 14)), 
  annotate_figure(p2, top = text_grob("New Default ('Blues')", size = 14)),
  ncol = 2)
Heatmap Color Scheme
# Calculate data for heatmap
genes <- VariableFeatures(pbmc)
toplot <- CalcStats(pbmc, features = genes, method = "zscore", order = "p", n = 4)

# Create side-by-side heatmap comparison
p1 <- Heatmap(toplot, 
              color_scheme = c(low = scales::muted("blue"), 
                             mid = "white", 
                             high = scales::muted("red")), # Old default
              lab_fill = "zscore") +
      ggtitle("Old Default (blue-white-red)")

p2 <- Heatmap(toplot, 
              lab_fill = "zscore") +  # New default (BuRd) is automatically applied
      ggtitle("New Default ('BuRd')")

plot_grid(p1, p2, ncol = 2)

To revert to previous color schemes: - For continuous variables: Use cols = "A" - For heatmaps: Use color_scheme = c(low = scales::muted("blue"), mid = "white", high = scales::muted("red"))

New RColorBrewer Integration

Added support for RColorBrewer sequential and diverging palettes:

Feature Enhancements

Bug Fixes

Documentation Updates

Conda Environment Setup

The create_condaenv_seuratextend() function documentation has been updated with important compatibility information:

Note for Apple Silicon Users: The function is not currently compatible with Apple Silicon/M1/M2 devices (#7). Users with Apple Silicon devices who are interested in contributing to the development of M1/M2 support are welcome to reach out via GitHub Issues.

Windows-Specific File Download

When downloading loom files (which are HDF5-based binary files) on Windows, it's essential to use mode = "wb" in the download.file() function:

# Example for Windows users
download.file("https://example.com/file.loom", "file.loom", mode = "wb")

This prevents Windows from modifying line endings in the binary file, which would corrupt the HDF5 format. Mac and Linux users don't require this parameter, but including it is harmless.

sessionInfo()


huayc09/SeuratExtend documentation built on July 5, 2025, 1:41 a.m.