fastars 0.1.0

Ultra-fast QC and trimming for short and long reads
Documentation
//! Pipeline module for coordinating processing stages.
//!
//! This module provides the main pipeline executor that
//! coordinates reading, QC, trimming, filtering, and writing
//! using a multi-threaded producer-consumer architecture.
//!
//! ## Architecture
//!
//! The pipeline uses crossbeam channels for communication:
//!
//! - **Reader thread**: Reads batches from FASTQ files
//! - **Worker pool (N threads)**: Perform QC, trimming, and filtering in parallel
//! - **Aggregator thread**: Merges QC statistics from all workers
//! - **Writer thread**: Writes filtered reads to output files
//!
//! ## Example
//!
//! ```no_run
//! use std::path::PathBuf;
//! use fastars::pipeline::{PipelineConfig, PipelineExecutor};
//! use fastars::trim::TrimConfig;
//! use fastars::filter::FilterConfig;
//!
//! let config = PipelineConfig::short_read()
//!     .with_threads(4)
//!     .with_batch_size(1000)
//!     .with_input(PathBuf::from("reads.fastq.gz"))
//!     .with_output_prefix(PathBuf::from("output/filtered"));
//!
//! let executor = PipelineExecutor::new(config);
//! let result = executor.run().expect("Pipeline failed");
//!
//! println!("Processed {} reads", result.qc_before.total_reads);
//! println!("Pass rate: {:.1}%", result.pass_rate());
//! ```

pub mod executor;
pub mod mode_detect;
pub mod spsc_queue;

pub use executor::{PipelineConfig, PipelineExecutor, PipelineResult, WorkerStats};
pub use mode_detect::{detect_mode, ModeDetectionConfig};
pub use spsc_queue::{spsc_channel, SpscConsumer, SpscProducer, SpscQueue};

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_pipeline_module_exports() {
        // Verify we can use re-exported types
        let _config = PipelineConfig::new();
        let _stats = WorkerStats::new();
    }

    #[test]
    fn test_pipeline_config_presets() {
        let short = PipelineConfig::short_read();
        assert_eq!(short.mode, crate::trim::Mode::Short);

        let long = PipelineConfig::long_read();
        assert_eq!(long.mode, crate::trim::Mode::Long);
    }
}