How pathogenomics-lab/snpick works
Project Type and Purpose
• SNPick is a Rust-based command-line tool (CLI) for bioinformatics, designed to extract SNP sites from large FASTA alignments.
• It targets high-performance, memory-efficient batch processing of genomic data, producing either a reduced SNP-only FASTA or a standard VCF file for downstream phylogenetic tools (RAxML, IQ-TREE).
File-Structure Analysis
• Top-level:
• Cargo.toml / Cargo.lock – Rust build and dependency manifests
• src/main.rs – single binary entry point, likely organizing modules internally
• .github/ – CI (GitHub Actions), issue/pr templates, code of conduct
• README.md, LICENSE – documentation and licensing
• No separate “lib” or “tests” directory, so internal modules and tests live inside src/main.rs or nested sub-modules.
• Build workflows: rust.yml under .github/workflows for automated testing and release builds.
Key README Insights
• Core features: FASTA reader, SNP detection engine, multi-threading, IUPAC nucleotide handling, VCF writer, progress bar.
• CLI flags: –fasta, –output, –threads, –vcf, –vcf-output, –include-gaps.
• Packaging: distributed via Bioconda and GitHub releases.
a. Main Components
1. CLI Argument Parser
2. FASTA Input Module
3. SNP Extraction Core
4. Thread Pool / Task Scheduler
5. Memory Manager / Data Structures
6. Output Writer (FASTA & VCF)
7. Progress Monitor
8. External Interfaces (Filesystem, User Shell, Downstream Tools)
b. Relationships & Interactions
• User invokes the binary with flags → Argument Parser configures modules
• FASTA Input Module reads sequences (File I/O) → passes to SNP Extraction Core
• Thread Pool dispatches alignment chunks to parallel Extraction workers
• Extraction Core uses Memory Manager to track variable sites, handles IUPAC codes
• As SNPs are discovered, data is buffered and fed to Output Writer
• Progress Monitor polls I/O and worker progress → updates spinner/bar to STDERR
• Final output files written to disk; user may pipe into RAxML/IQ-TREE or open VCF
c. Architectural Patterns & Principles
• Single-process, multi-threaded pipeline (shared-memory concurrency)
• Modular separation of concerns: I/O ↔ Processing ↔ Output ↔ Monitoring
• Efficient memory use via streaming and chunking, avoiding full in-memory alignment
• CLI-first design, minimal dependencies for portability
d. Technologies & Libraries
• Rust (Cargo build system)
• Likely crates: clap or structopt (argument parsing), rayon (thread pool), bio or custom FASTA parser, indicatif (progress bar), serde or custom VCF writer