diff --git a/Cargo.toml b/Cargo.toml index f286492..8919586 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -70,6 +70,8 @@ backend_mkl_system = ["dep:ndarray-linalg", "ndarray-linalg/intel-mkl-system"] backend_faer = ["dep:faer"] faer_links_ndarray_static_openblas = ["backend_faer", "backend_openblas"] +eigensnp = [] # Requires nightly Rust + # --- Utility Features --- jemalloc = ["dep:jemalloc-ctl"] enable-eigensnp-diagnostics = [] diff --git a/README.md b/README.md index 27acd74..9034fce 100644 --- a/README.md +++ b/README.md @@ -118,10 +118,16 @@ Loads a PCA model from a file previously saved with `save_model`. The loaded mod EigenSNP is a sophisticated Principal Component Analysis algorithm specifically designed for large-scale genomic datasets, such as those found in biobanks or population-scale studies. It efficiently handles datasets where the number of SNPs (features) significantly exceeds the number of samples. +To use EigenSNP, enable the `eigensnp` feature in your `Cargo.toml` (note that this currently requires the use of nightly Rust): +```toml +[dependencies] +efficient_pca = { version = "*", features = ["eigensnp"] } +``` + ### Key Features * 🧬 **Genomic-Optimized**: Designed for SNP data with linkage disequilibrium (LD) block structure -* ⚡ **Scalable**: Uses randomized SVD (RSVD) and memory-efficient f32 precision for large datasets +* ⚡ **Scalable**: Uses randomized SVD (RSVD) and memory-efficient f32 precision for large datasets * 🔧 **Highly Configurable**: Extensive tuning parameters for different dataset characteristics * 📊 **Multi-Stage Algorithm**: Local eigenSNP basis learning → condensed features → global PCA → refinement * 🔍 **Diagnostics**: Optional detailed diagnostics for algorithm analysis (with feature flag) diff --git a/src/lib.rs b/src/lib.rs index 67c466a..84feadd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,17 +1,20 @@ -#![feature(portable_simd)] +#![cfg_attr(feature = "eigensnp", feature(portable_simd))] #![doc = include_str!("../README.md")] // Crate-level documentation pub mod diagnostics; -pub mod eigensnp; pub mod linalg_backends; // Consolidated module pub mod pca; +#[cfg(feature = "eigensnp")] +pub mod eigensnp; + #[cfg(feature = "enable-eigensnp-diagnostics")] pub mod eigensnp_tests; pub use pca::PCA; // Re-export key items from the eigensnp module for users of the EigenSNP functionality. +#[cfg(feature = "eigensnp")] pub use eigensnp::{ CondensedFeatureId, EigenSNPCoreAlgorithm, EigenSNPCoreAlgorithmConfig, EigenSNPCoreOutput, LdBlockListId, LdBlockSpecification, PcaReadyGenotypeAccessor, PcaSnpId, PrincipalComponentId,