pub struct Record { /* private fields */ }
Expand description
An instance of a Fastx Record. This is a two attribute object containing the sequence ID and the Sequence.
Implementations
sourceimpl Record
impl Record
sourcepub fn new() -> Self
pub fn new() -> Self
Usage
Creates a new instance of a [Record]
let record = fxread::Record::new();
assert!(record.empty());
sourcepub fn new_fasta(data: Vec<u8>, id: usize, seq: usize) -> Self
pub fn new_fasta(data: Vec<u8>, id: usize, seq: usize) -> Self
Usage
Creates a new instance of a [Record]
from a preinitialized
[Vec<u8>]
with the id
and seq
endpoints calculated. These
endpoints are inclusive of the ‘\n’ terminator and the data is
expected to exclude the prefix ‘>’ marker.
let data = b"seq.0\nACGT\n".to_vec();
let id = 6;
let seq = 5;
let fasta = fxread::Record::new_fasta(data, id, seq);
assert_eq!(fasta.id(), b"seq.0");
assert_eq!(fasta.seq(), b"ACGT");
sourcepub fn new_fastq(
data: Vec<u8>,
id: usize,
seq: usize,
plus: usize,
qual: usize
) -> Self
pub fn new_fastq(
data: Vec<u8>,
id: usize,
seq: usize,
plus: usize,
qual: usize
) -> Self
Usage
Creates a new instance of a [Record]
from a preinitialized
[Vec<u8>]
with the id
, seq
, plus
, and qual
endpoints calculated.
These endpoints are inclusive of the ‘\n’ terminator and the data is
expected to exclude the prefix ‘@’ marker.
let data = b"seq.0\nACGT\n+\n1234\n".to_vec();
let id = 6;
let seq = 5;
let plus = 2;
let qual = 5;
let fasta = fxread::Record::new_fastq(data, id, seq, plus, qual);
assert_eq!(fasta.id(), b"seq.0");
assert_eq!(fasta.seq(), b"ACGT");
assert_eq!(fasta.plus().unwrap(), b"+");
assert_eq!(fasta.qual().unwrap(), b"1234");
sourcepub fn id(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
pub fn id(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
Returns a reference of the sequence ID
sourcepub fn seq(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
pub fn seq(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
Returns a reference of the sequence
sourcepub fn data(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
pub fn data(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
Returns a reference to the raw data underlying the record
sourcepub fn valid(&self) -> bool
pub fn valid(&self) -> bool
Validates that the record is not partially constructed or composed of unexpected nucleotides
sourcepub fn seq_rev_comp(&self) -> Vec<u8>
pub fn seq_rev_comp(&self) -> Vec<u8>
Reverse Complements the sequence
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Record
impl Send for Record
impl Sync for Record
impl Unpin for Record
impl UnwindSafe for Record
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more