pub struct SequenceCollection {
pub metadata: SequenceCollectionMetadata,
pub sequences: Vec<SequenceRecord>,
}Expand description
A single Sequence Collection, which may or may not hold data.
Fields§
§metadata: SequenceCollectionMetadataCollection metadata (digest, level 1 digests, n_sequences, file_path)
sequences: Vec<SequenceRecord>Vector of SequenceRecords, which contain metadata (name, length, digests, alphabet) and optionally the actual sequence data.
Implementations§
Source§impl SequenceCollection
impl SequenceCollection
Sourcepub fn match_sequence_names(&self, other: &Self) -> Result<CollectionNameMatch>
pub fn match_sequence_names(&self, other: &Self) -> Result<CollectionNameMatch>
Match collection-local names by sequence content digest.
Shared and A-only groups follow collection A’s FASTA order; B-only groups follow collection B’s order. Repeated content is grouped so the result naturally represents one-to-many name mappings.
Sourcepub fn from_records(records: Vec<SequenceRecord>) -> Self
pub fn from_records(records: Vec<SequenceRecord>) -> Self
Create a SequenceCollection from a vector of SequenceRecords.
Sourcepub fn to_level2(&self) -> CollectionLevel2
pub fn to_level2(&self) -> CollectionLevel2
Return level 2 representation (full arrays, spec format).
Transposes Vec
Sourcepub fn build_sorted_sequences(&self) -> Vec<String>
pub fn build_sorted_sequences(&self) -> Vec<String>
Build the sorted_sequences array as SQ.-prefixed digest strings, sorted lexicographically.
Sourcepub fn build_name_length_pairs(&self) -> Vec<Value>
pub fn build_name_length_pairs(&self) -> Vec<Value>
Build the name_length_pairs array as JSON value objects {“length”: N, “name”: “X”}. Keys are in alphabetical order per canonical JSON.
Sourcepub fn build_sorted_name_length_pairs(&self) -> Vec<Value>
pub fn build_sorted_name_length_pairs(&self) -> Vec<Value>
Build the sorted_name_length_pairs array as JSON value objects, sorted by their canonical JSON digest.
Sourcepub fn compare(&self, other: &SequenceCollection) -> SeqColComparison
pub fn compare(&self, other: &SequenceCollection) -> SeqColComparison
Compare this collection with another, following the seqcol spec comparison algorithm.
Dynamically includes ancillary attributes (name_length_pairs, sorted_name_length_pairs, sorted_sequences) when present in each collection’s metadata.
Trait Implementations§
Source§impl Clone for SequenceCollection
impl Clone for SequenceCollection
Source§impl Debug for SequenceCollection
impl Debug for SequenceCollection
Source§impl Display for SequenceCollection
impl Display for SequenceCollection
Source§impl<'a> IntoIterator for &'a SequenceCollection
impl<'a> IntoIterator for &'a SequenceCollection
Source§impl IntoIterator for SequenceCollection
impl IntoIterator for SequenceCollection
Source§impl SequenceCollectionExt for SequenceCollection
Available on crate feature filesystem only.
impl SequenceCollectionExt for SequenceCollection
filesystem only.Source§fn from_fasta<P: AsRef<Path>>(file_path: P) -> Result<SequenceCollection>
fn from_fasta<P: AsRef<Path>>(file_path: P) -> Result<SequenceCollection>
Default behavior: read and write cache
Source§fn from_path_no_cache<P: AsRef<Path>>(
file_path: P,
) -> Result<SequenceCollection>
fn from_path_no_cache<P: AsRef<Path>>( file_path: P, ) -> Result<SequenceCollection>
No caching at all
Source§fn write_collection_rgsi<P: AsRef<Path>>(&self, file_path: P) -> Result<()>
fn write_collection_rgsi<P: AsRef<Path>>(&self, file_path: P) -> Result<()>
Write the SequenceCollection to an RGSI file.
Source§fn write_rgsi(&self) -> Result<()>
fn write_rgsi(&self) -> Result<()>
Write the SequenceCollection to an RGSI file using the stored file path.
Source§fn write_fasta<P: AsRef<Path>>(
&self,
file_path: P,
line_width: Option<usize>,
) -> Result<()>
fn write_fasta<P: AsRef<Path>>( &self, file_path: P, line_width: Option<usize>, ) -> Result<()>
Write the SequenceCollection to a FASTA file.