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 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§fn clone(&self) -> SequenceCollection
fn clone(&self) -> SequenceCollection
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SequenceCollection
impl Debug for SequenceCollection
Source§impl Display for SequenceCollection
impl Display for SequenceCollection
Source§impl From<SequenceCollection> for SequenceCollectionRecord
impl From<SequenceCollection> for SequenceCollectionRecord
Source§fn from(collection: SequenceCollection) -> Self
fn from(collection: SequenceCollection) -> Self
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
impl SequenceCollectionExt for SequenceCollection
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 to_record(&self) -> SequenceCollectionRecord
fn to_record(&self) -> SequenceCollectionRecord
Convert to a SequenceCollectionRecord for storage.
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.