ruvector/examples/dna/src/error.rs
rUv 9641c470e9 feat(rvdna): native 23andMe genotyping pipeline v0.2.0
Replaces the Python rvdna-bridge with a pure Rust implementation:
- 7-stage pipeline: parse, QC, classification, pharma, health, compound, report
- CYP2D6/CYP2C19 diplotype calling with confidence gating (Strong/Moderate/Weak/Unsupported)
- 17 health variant interpretations (APOE, BRCA1/2, TP53, MTHFR, COMT, OPRM1, etc.)
- Genotype normalization (case/strand insensitive, allele-sorted)
- CPIC drug recommendations gated on Moderate+ confidence
- Panel QC signatures with het rate metrics
- MTHFR compound analysis and pain sensitivity profiling
- 91 tests passing (79 lib + 12 security)

Published as rvdna v0.2.0 on crates.io.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-02-20 20:40:51 +00:00

58 lines
1.5 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),
/// 23andMe file parse error
#[error("Parse error: {0}")]
ParseError(String),
}
/// Result type for DNA analysis operations
pub type Result<T> = std::result::Result<T, DnaError>;