pub struct MultiFastaProvider { /* private fields */ }Expand description
Multi-FASTA reference provider
Provides efficient random access to sequences across multiple FASTA files. Useful for reference datasets split across files (e.g., RefSeq transcripts).
§Example
use ferro_hgvs::reference::multi_fasta::MultiFastaProvider;
let provider = MultiFastaProvider::from_directory("reference_data/transcripts")?;
let seq = provider.get_sequence("NM_000546.6", 0, 100)?;Implementations§
Source§impl MultiFastaProvider
impl MultiFastaProvider
Sourcepub fn from_directory<P: AsRef<Path>>(dir: P) -> Result<Self, FerroError>
pub fn from_directory<P: AsRef<Path>>(dir: P) -> Result<Self, FerroError>
Create a new multi-FASTA provider from a directory of FASTA files
Scans the directory for .fna and .fa files with accompanying .fai indexes.
Sourcepub fn from_directories<P: AsRef<Path>>(dirs: &[P]) -> Result<Self, FerroError>
pub fn from_directories<P: AsRef<Path>>(dirs: &[P]) -> Result<Self, FerroError>
Create a provider from multiple directories (e.g., transcripts + genome)
Sourcepub fn from_manifest<P: AsRef<Path>>(
manifest_path: P,
) -> Result<Self, FerroError>
pub fn from_manifest<P: AsRef<Path>>( manifest_path: P, ) -> Result<Self, FerroError>
Create a provider from a manifest file
Sourcepub fn with_cdot<P: AsRef<Path>, Q: AsRef<Path>>(
fasta_path: P,
cdot_path: Q,
) -> Result<Self, FerroError>
pub fn with_cdot<P: AsRef<Path>, Q: AsRef<Path>>( fasta_path: P, cdot_path: Q, ) -> Result<Self, FerroError>
Create a provider from a single FASTA file with cdot metadata
This is the recommended method for normalizing intronic variants, as it combines genomic sequence data (from FASTA) with transcript metadata (from cdot) needed for coordinate conversions.
§Arguments
fasta_path- Path to an indexed FASTA file (must have .fai index)cdot_path- Path to a cdot JSON file (can be gzipped)
§Example
let provider = MultiFastaProvider::with_cdot(
"reference.fa",
"cdot-0.2.32.refseq.GRCh38.json.gz",
)?;Sourcepub fn has_sequence(&self, name: &str) -> bool
pub fn has_sequence(&self, name: &str) -> bool
Check if a sequence exists
Sourcepub fn sequence_length(&self, name: &str) -> Option<u64>
pub fn sequence_length(&self, name: &str) -> Option<u64>
Get the length of a sequence
Sourcepub fn sequence_count(&self) -> usize
pub fn sequence_count(&self) -> usize
Get total number of sequences