Skip to main content

FastxRecords

Struct FastxRecords 

Source
pub struct FastxRecords<T> { /* private fields */ }
Expand description

Generic collection of sequence records, indexed by name.

Implementations§

Source§

impl<T: FastxRecord> FastxRecords<T>

Source

pub fn num_records(&self) -> usize

Return record count.

Source

pub fn get_max_length(&self) -> usize

Return length of the longest sequence

Source

pub fn records_by_name(&self, names: Vec<String>) -> (FastxRecords<T>, String)

Return a subset of records from a list of names.

§Arguments
  • names - A list of record names, not necessarily all present in the current object.
§Returns

A tuple containing a FastxRecords object with any records present in the input list and a list of names not found. An empty list returns an empty object. Record indexes still refer to the original file. Duplicate record names are removed in the FastxRecords object but not in the list of absent records.

Source

pub fn subsequences(&self, start: usize, end: usize) -> FastxRecords<T>

Return subsequences of all records.

§Arguments
  • start - Base-0 start position (inclusive)
  • end - Base-0 end position (exclusive)
§Returns

A FastxRecords object with all records, but with the subsequence between start and end.

Source

pub fn subsequences_by_name( &self, names_ranges: Vec<NameWithRange>, ) -> (FastxRecords<T>, String)

Return subsequences of named records.

§Arguments
  • names_ranges - Record names and ranges.
§Returns

A tuple containing a FastxRecords object with subsets of any records present in the input list and a list of names not found. An empty list returns an empty object. Record indexes still refer to the original file. Duplicate record names are removed in the FastxRecords object but not in the list of absent records.

Source

pub fn merge(&mut self, from: FastxRecords<T>)

Merge in a FastxRecords object.

Any records also present in the current object are overwritten by new values.

§Arguments
  • from - an object to merge
Source

pub fn save_records(&self, output_path: &str) -> Result<(), String>

Save the records to a file.

§Arguments
  • output_path - Path to a file
§Errors

Returns an error if the file cannot be created or any record cannot be written.

Source

pub fn save_sorted_records(&self, output_path: &str) -> Result<(), String>

Save the records in the order they appeared in the original file.

§Arguments
  • output_path - Path to a file
§Errors

Returns an error if the file cannot be created or any record cannot be written.

Trait Implementations§

Source§

impl<T: Debug> Debug for FastxRecords<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for FastxRecords<T>

§

impl<T> RefUnwindSafe for FastxRecords<T>
where T: RefUnwindSafe,

§

impl<T> Send for FastxRecords<T>
where T: Send,

§

impl<T> Sync for FastxRecords<T>
where T: Sync,

§

impl<T> Unpin for FastxRecords<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for FastxRecords<T>

§

impl<T> UnwindSafe for FastxRecords<T>
where T: UnwindSafe,

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, 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, 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.