1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
use super::*;
use crate::dna_format::*;
#[cfg(feature = "packed-seq")]
use packed_seq::{PackedSeq, PackedSeqVec};
pub trait HelicaseParser {
/// Get the [`Format`] associated to this parser (FASTA or FASTQ).
fn format(&self) -> Format;
/// Get a reference to the current header.
fn get_header(&self) -> &[u8];
/// Get an owned version of the current header.
/// This will trigger a new allocation and a copy.
fn get_header_owned(&mut self) -> Vec<u8>;
/// Get a reference to the current sequence as a slice of bytes.
fn get_dna_string(&self) -> &[u8];
/// Get an owned version of the current sequence as a `Vec<u8>`.
/// This will trigger a new allocation and possibly a copy.
fn get_dna_string_owned(&mut self) -> Vec<u8>;
/// Get a reference to the current sequence as [`ColumnarDNA`].
fn get_dna_columnar(&self) -> &ColumnarDNA;
/// Get an owned version of the current sequence as [`ColumnarDNA`].
/// This will trigger a new allocation.
fn get_dna_columnar_owned(&mut self) -> ColumnarDNA;
/// Get a reference to the current sequence as [`PackedDNA`].
fn get_dna_packed(&self) -> &PackedDNA;
/// Get an owned version of the current sequence as [`PackedDNA`].
/// This will trigger a new allocation.
fn get_dna_packed_owned(&mut self) -> PackedDNA;
/// Get a [`PackedSeq`] based on the underlying [`PackedDNA`].
///
/// Note this is equivalent to:
/// ```rust
/// self.get_dna_packed().as_packed_seq()
/// ```
#[cfg(feature = "packed-seq")]
#[inline(always)]
fn get_packed_seq(&self) -> PackedSeq<'_> {
self.get_dna_packed().as_packed_seq()
}
/// Get a [`PackedSeqVec`] based on the underlying [`PackedDNA`].
/// This will trigger a new allocation.
///
/// Note this is equivalent to:
/// ```rust
/// self.get_dna_packed_owned().into_packed_seq_vec()
/// ```
#[cfg(feature = "packed-seq")]
#[inline(always)]
fn get_packed_seq_vec(&mut self) -> PackedSeqVec {
self.get_dna_packed_owned().into_packed_seq_vec()
}
/// Get a reference to the bitmask marking non-ACTG bases.
fn get_mask_non_actg(&self) -> &BitMask;
/// Get an owned version of the bitmask marking non-ACTG bases.
/// This will trigger a new allocation.
fn get_mask_non_actg_owned(&mut self) -> BitMask;
/// Get a reference to the bitmask marking non-ACTG bases.
fn get_mask_n(&self) -> &BitMask;
/// Get an owned version of the bitmask marking non-ACTG bases.
/// This will trigger a new allocation.
fn get_mask_n_owned(&mut self) -> BitMask;
/// Get the length of the current sequence.
fn get_dna_len(&self) -> usize;
/// Get a reference to the current quality line.
/// Returns `None` for FASTA.
#[inline(always)]
fn get_quality(&self) -> Option<&[u8]> {
None
}
/// Get an owned version of the current quality line.
/// This will trigger a new allocation and a copy.
/// Returns `None` for FASTA.
#[inline(always)]
fn get_quality_owned(&mut self) -> Option<Vec<u8>> {
None
}
/// Manually clear the information of the current chunk.
/// This is only useful when [`MERGE_DNA_CHUNKS`](crate::config::advanced::MERGE_DNA_CHUNKS) is enabled.
fn clear_chunk(&mut self);
/// Manually clear the information of the current record.
/// This is only useful when [`MERGE_RECORDS`](crate::config::advanced::MERGE_RECORDS) is enabled.
fn clear_record(&mut self);
}
pub trait HelicaseParserIter: HelicaseParser + Iterator<Item = Event> {}
impl<T: HelicaseParser + Iterator<Item = Event>> HelicaseParserIter for T {}