Skip to content

feat: Ultra-large matrix support and Read10X performance optimization#10017

Open
BenjaminDEMAILLE wants to merge 255 commits into
satijalab:developfrom
BenjaminDEMAILLE:feature/spam-matrix-support
Open

feat: Ultra-large matrix support and Read10X performance optimization#10017
BenjaminDEMAILLE wants to merge 255 commits into
satijalab:developfrom
BenjaminDEMAILLE:feature/spam-matrix-support

Conversation

@BenjaminDEMAILLE

Copy link
Copy Markdown

This PR introduces comprehensive support for ultra-large matrices and significantly optimizes Read10X performance.

Key Features:

  • Ultra-large matrix support with spam integration
  • 2-10x Read10X performance improvement via data.table
  • Batch processing automation with CreateMultipleSeurat
  • SoupX integration for doublet decontamination
  • Full backward compatibility maintained

Technical improvements:

  • Integrated data.table::fread for faster I/O
  • Vectorized file processing and memory optimization
  • Enhanced support for matrices exceeding 2^31 elements
  • Smart auto-detection for workflow automation

All changes maintain full API compatibility.

dcollins15 and others added 30 commits February 4, 2025 18:41
Update triggers for Integration Checks after default branch change
Correction to use AddMetaData function

Co-authored-by: David Collins <23369610+dcollins15@users.noreply.github.com>
Fix GroupCorrelation and GroupCorrelationPlot for Seurat V5 compatibility
Update PercentageFeatureSet to throw warning for missing features
…re-set

Fix PercentageFeatureSet to respect the `assay` parameter
Fix `PercentageFeatureSet` to raise warning if any `features` are not present
zskylarli and others added 27 commits June 3, 2025 11:15
…uild-niche-assay

Add arguments to kmeans call in BuildNicheAssay function
- Add spam as suggested dependency in DESCRIPTION
- Create LargeMatrix class union including spam matrices
- Add conditional spam support detection in zzz.R

Addresses satijalab#9798: Enable Seurat to Handle Ultra-Large Matrices (>2^31 values)
- Add CheckMatrixSize() function to detect matrices exceeding dgCMatrix limits
- Enhance RowMeanSparse(), RowSumSparse(), RowVarSparse() with spam matrix support
- Update RowSparseCheck() to handle spam matrices properly
- Add 64-bit indexing support through spam package integration

These utilities enable Seurat to work with ultra-large sparse matrices that exceed
the 2^31 element limit of standard dgCMatrix objects.
- Update CLR and RC normalization to accept spam matrices
- Add VST.spam() method for variable feature selection on large matrices
- Enhance CalcDispersion() to handle spam matrices with size-based conversion
- Update FindVariableFeatures() to recognize and process spam matrices
- Add intelligent memory management for ultra-large datasets

This enables normalization and feature selection workflows to scale beyond
traditional dgCMatrix limitations.
- Add as.sparse.spam() method for converting spam matrices to dgCMatrix
- Enable seamless integration of spam matrices with existing Seurat workflows
- Provide compatibility layer for spam matrices in object creation and manipulation

This allows CreateSeuratObject() and related functions to work directly
with spam matrices while maintaining backward compatibility.
- Add spam matrix detection and optimization in BuildClusterTree()
- Implement ComputeDistanceMatrix() with memory-efficient spam handling
- Add CheckSpamMemoryUsage() for intelligent resource management
- Enhance MergeNode() with spam matrix awareness
- Provide automatic fallback strategies for ultra-large matrices

Features include:
- Automatic detection of spam matrices in phylogenetic analysis
- Memory-optimized distance computation for large datasets
- Feature sampling for matrices exceeding memory thresholds
- Informative user guidance for optimization strategies
- Create detailed documentation for ultra-large matrix support
- Provide usage examples and best practices for spam matrices
- Document memory considerations and optimization strategies
- Include performance tips and troubleshooting guide
- Add code examples for common workflows with large datasets

This documentation helps users leverage spam matrices effectively for
atlas-scale single-cell analysis beyond dgCMatrix limitations.
- Add unit tests for CheckMatrixSize() function
- Test spam matrix detection and handling in utility functions
- Validate RowMeanSparse(), RowSumSparse(), RowVarSparse() with spam matrices
- Test VST.spam() method functionality
- Add integration tests for BuildClusterTree() with spam matrices
- Include memory management and fallback strategy tests

These tests ensure robust spam matrix support across all enhanced functions
and validate proper handling of ultra-large datasets.
- Document new ultra-large matrix support using spam package
- List enhanced functions with 64-bit indexing capabilities
- Reference issue satijalab#9798 for context
- Highlight key improvements for atlas-scale analysis

This completes the spam matrix integration feature set for handling
datasets that exceed traditional dgCMatrix limits (>2^31 elements).
- Add Author and Maintainer fields to DESCRIPTION for R CMD check compatibility
- Add S3method exports for VST.spam and as.sparse.spam in NAMESPACE
- Fix spam matrix variance calculation in preprocessing5.R
- Add get_soup_groups(): Standard Seurat preprocessing for cluster groups
- Add add_soup_groups(): Wrapper to add soup groups to Seurat objects
- Add make_soup(): Core SoupX decontamination with flexible parameters
- Add RunSoupX(): Complete workflow for single objects or lists
- Export all functions in NAMESPACE
- Support both single Seurat objects and lists
- Auto-append '_soupx' to save filenames
- Parallel processing for soup group assignment
- Sequential processing for decontamination to avoid I/O conflicts
- Add create_multiple_seurat_example.R: Basic usage examples
- Add process_multiple_10x_example.R: Advanced workflow examples
- Demonstrate auto-detection, resource optimization, and saving options
- Add OptimizeMatrixFormat(): Intelligent matrix format optimization
- Support spam matrices for efficient sparse operations
- Support DelayedArray/HDF5Array for memory-efficient processing
- Auto-selection based on matrix characteristics and memory constraints
- Memory-aware processing for ultra-large matrices (>2^31 values)
…gration

- Integrated data.table::fread for 2-10x faster I/O operations on barcodes and features
- Added vectorized file path construction and optimized suffix stripping
- Implemented efficient column naming and improved memory management
- Enhanced NA handling with vectorized replacement logic
- Added optimized read.delim parameters (comment.char='', quote='') when data.table unavailable
- Maintained full backward compatibility with existing Read10X API
- Updated documentation to reflect performance improvements

Performance improvements:
- 2-10x speedup for loading 10X Genomics data
- Reduced memory allocation overhead
- Faster text processing for large feature/barcode files
- Optimized file I/O operations
@PaulRegnier

Copy link
Copy Markdown

Hello Seurat community,

I just came across this giant PR, which is of critical interest for me, and just wondered what is its current status?

Is it planned to be merged with the dev branch in the next months or is it delayed?

I can even provide some help (for testing, or whatever), if ever needed.

Thank you all for your impressive commitment in the development of this incredible package :)

Paul

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.