mirror of
https://github.com/ruvnet/RuVector.git
synced 2026-06-02 15:49:47 +00:00
Implements a comprehensive DNA analyzer demonstrating RuVector's vector computing capabilities for bioinformatics: Modules (9): - types: Core domain types (DnaSequence, Nucleotide, ProteinSequence, etc.) - kmer: HNSW k-mer indexing with FNV-1a hashing and MinHash sketching - alignment: Smith-Waterman local alignment with CIGAR generation - variant: SNP calling from pileup data with genotype classification - protein: DNA-to-protein translation with contact graph prediction - epigenomics: Horvath clock biological age prediction from CpG methylation - pharma: CYP2D6 star allele calling and metabolizer phenotype prediction - pipeline: DAG-based genomic analysis orchestration - error: Typed error handling across all modules Testing (41 tests, 0 mocks): - 12 k-mer integration tests (encoding, HNSW search, MinHash Jaccard) - 17 pipeline e2e tests (alignment, variant calling, pharmacogenomics) - 12 security tests (buffer overflow, path traversal, concurrency, bounds) Benchmarks: Criterion suite for kmer, alignment, variant, protein, pipeline Binary: 7-stage demo (sequence gen, k-mer search, alignment, variant calling, protein analysis, epigenomics, pharmacogenomics) https://claude.ai/code/session_013B6stXbYwAkWHbE16sjUrq
54 lines
1.4 KiB
Rust
54 lines
1.4 KiB
Rust
//! Error types for DNA analysis operations
|
|
|
|
use thiserror::Error;
|
|
|
|
/// DNA analysis error types
|
|
#[derive(Error, Debug)]
|
|
pub enum DnaError {
|
|
/// Invalid DNA sequence (e.g., non-ACGTN characters)
|
|
#[error("Invalid DNA sequence: {0}")]
|
|
InvalidSequence(String),
|
|
|
|
/// K-mer indexing error
|
|
#[error("K-mer index error: {0}")]
|
|
IndexError(String),
|
|
|
|
/// Sequence alignment error
|
|
#[error("Alignment error: {0}")]
|
|
AlignmentError(String),
|
|
|
|
/// Variant calling error
|
|
#[error("Variant calling error: {0}")]
|
|
VariantCallError(String),
|
|
|
|
/// Analysis pipeline error
|
|
#[error("Pipeline error: {0}")]
|
|
PipelineError(String),
|
|
|
|
/// I/O error
|
|
#[error("I/O error: {0}")]
|
|
IoError(#[from] std::io::Error),
|
|
|
|
/// RuVector core error
|
|
#[error("Vector database error: {0}")]
|
|
VectorDbError(#[from] ruvector_core::RuvectorError),
|
|
|
|
/// Dimension mismatch
|
|
#[error("Dimension mismatch: expected {expected}, got {actual}")]
|
|
DimensionMismatch { expected: usize, actual: usize },
|
|
|
|
/// Empty sequence
|
|
#[error("Empty sequence provided")]
|
|
EmptySequence,
|
|
|
|
/// Invalid quality score
|
|
#[error("Invalid quality score: {0}")]
|
|
InvalidQuality(u8),
|
|
|
|
/// Invalid k-mer size
|
|
#[error("Invalid k-mer size: {0}")]
|
|
InvalidKmerSize(usize),
|
|
}
|
|
|
|
/// Result type for DNA analysis operations
|
|
pub type Result<T> = std::result::Result<T, DnaError>;
|