Skip to main content

MultiFastaProvider

Struct MultiFastaProvider 

Source
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

Source

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.

Source

pub fn from_directories<P: AsRef<Path>>(dirs: &[P]) -> Result<Self, FerroError>

Create a provider from multiple directories (e.g., transcripts + genome)

Source

pub fn from_manifest<P: AsRef<Path>>( manifest_path: P, ) -> Result<Self, FerroError>

Create a provider from a manifest file

Source

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",
)?;
Source

pub fn has_sequence(&self, name: &str) -> bool

Check if a sequence exists

Source

pub fn sequence_length(&self, name: &str) -> Option<u64>

Get the length of a sequence

Source

pub fn sequence_count(&self) -> usize

Get total number of sequences

Trait Implementations§

Source§

impl ReferenceProvider for MultiFastaProvider

Source§

fn get_transcript(&self, id: &str) -> Result<Transcript, FerroError>

Get a transcript by its accession
Source§

fn get_sequence( &self, id: &str, start: u64, end: u64, ) -> Result<String, FerroError>

Get a sequence region Read more
Source§

fn get_genomic_sequence( &self, contig: &str, start: u64, end: u64, ) -> Result<String, FerroError>

Get genomic sequence for a contig/chromosome Read more
Source§

fn has_genomic_data(&self) -> bool

Check if this provider has genomic sequence data Read more
Source§

fn has_transcript(&self, id: &str) -> bool

Check if a transcript exists
Source§

fn get_protein_sequence( &self, accession: &str, start: u64, end: u64, ) -> Result<String, FerroError>

Get protein sequence for a protein accession Read more
Source§

fn has_protein_data(&self) -> bool

Check if this provider has protein sequence data

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more