[][src]Trait seq_io::BaseRecord

pub trait BaseRecord {
    fn head(&self) -> &[u8];
fn seq(&self) -> &[u8];
fn full_seq(&self) -> Cow<'_, [u8]>;
fn full_seq_given<'s, F>(&'s self, owned_fn: F) -> Cow<'s, [u8]>
    where
        F: FnOnce() -> &'s mut Vec<u8>
;
fn num_seq_lines(&self) -> usize;
fn has_quality(&self) -> bool;
fn opt_qual(&self) -> Option<&[u8]>;
fn opt_full_qual(&self) -> Option<Cow<'_, [u8]>>;
fn opt_full_qual_given<'s, F>(
        &'s self,
        owned_fn: F
    ) -> Option<Cow<'s, [u8]>>
    where
        F: FnOnce() -> &'s mut Vec<u8>
;
fn num_qual_lines(&self) -> usize;
fn write<W>(&self, writer: W) -> Result<()>
    where
        W: Write
; fn id_bytes(&self) -> &[u8] { ... }
fn id(&self) -> Result<&str, Utf8Error> { ... }
fn desc_bytes(&self) -> Option<&[u8]> { ... }
fn desc(&self) -> Option<Result<&str, Utf8Error>> { ... }
fn id_desc_bytes(&self) -> (&[u8], Option<&[u8]>) { ... }
fn id_desc(&self) -> Result<(&str, Option<&str>), Utf8Error> { ... } }

Required methods

fn head(&self) -> &[u8]

Return the header line of the record as byte slice

fn seq(&self) -> &[u8]

Return the record sequence as byte slice. With FASTA and multi-line FASTQ, this slice may contain line terminators if called on RefRecord. Use full_seq or full_seq_given instead in such cases, or iterate over lines with fasta/q/x::RefRecord::seq_lines()

fn full_seq(&self) -> Cow<'_, [u8]>

Returns the full sequence as Cow<[u8]>. If the sequence consists of a single line, then the sequence will be borrowed from the underlying buffer (equivalent to calling seq()). If there are multiple lines, an owned copy will be created.

fn full_seq_given<'s, F>(&'s self, owned_fn: F) -> Cow<'s, [u8]> where
    F: FnOnce() -> &'s mut Vec<u8>, 

Like full_seq returns the full sequence as Cow<[u8]>, with the difference that the vector that is used to store the contiguous sequence (in the case of multiple sequence lines) is provided in a closure, which is only executed if needed. This allows e.g. storing the necessary vectors in an arena allocator.

fn num_seq_lines(&self) -> usize

Returns the number of sequence lines. Calling record.seq_lines() gives the same result as record.seq_lines().len(), but the latter may be slow depending on the type PositionStore used since the line positions may have to be searched first.

fn has_quality(&self) -> bool

Returns a booleany specifying whether there is quality information in this record or not.

fn opt_qual(&self) -> Option<&[u8]>

Returns the quality information or None. With multi-line FASTQ, this slice may contain line terminators if called on RefRecord. Use opt_full_qual or opt_full_qual_given instead in such cases, or iterate over lines with fasta/q/x::RefRecord::[opt_]qual_lines()

fn opt_full_qual(&self) -> Option<Cow<'_, [u8]>>

Returns the quality scores as contiguous Cow<[u8]>, if present. If not dealing with multi-line FASTQ, this does not involve any copying (same as if calling opt_qual()). If there are multiple lines, an owned copy will be created.

fn opt_full_qual_given<'s, F>(&'s self, owned_fn: F) -> Option<Cow<'s, [u8]>> where
    F: FnOnce() -> &'s mut Vec<u8>, 

Like opt_full_qual returns the full quality scores as Cow<[u8]>, with the difference that the vector that is used to store the contiguous data (in the case of multiple quality lines) is provided in a closure, which is only executed if needed.

fn num_qual_lines(&self) -> usize

Returns the number of quality lines. Always > 0 with the current parsers.

fn write<W>(&self, writer: W) -> Result<()> where
    W: Write

Writes the record to an output.

The default for FASTA is to write one sequence line. Otherwise refer to the method fasta::Record::write_wrap.

Loading content...

Provided methods

fn id_bytes(&self) -> &[u8]

Returns the record ID (everything before an optional space) as byte slice.

fn id(&self) -> Result<&str, Utf8Error>

Returns the record ID (everything before an optional space) as &str.

fn desc_bytes(&self) -> Option<&[u8]>

Returns the record description (separated from the ID by a space) as byte slice, if present.

fn desc(&self) -> Option<Result<&str, Utf8Error>>

Returns the record description (separated from the ID by a space) as &str slice, if present.

fn id_desc_bytes(&self) -> (&[u8], Option<&[u8]>)

Return both the ID and the description of the record (if present) This should be faster than calling id() and desc() separately.

fn id_desc(&self) -> Result<(&str, Option<&str>), Utf8Error>

Returns both the ID and the description of the record (if present) as &str slices. This should be faster than calling id() and desc() separately.

Loading content...

Implementations on Foreign Types

impl<'a, R> BaseRecord for &'a R where
    R: BaseRecord
[src]

Loading content...

Implementors

impl BaseRecord for seq_io::fasta::OwnedRecord[src]

impl BaseRecord for seq_io::fastq::OwnedRecord[src]

impl BaseRecord for seq_io::fastx::OwnedRecord[src]

impl<'a, S> BaseRecord for seq_io::fasta::RefRecord<'a, S> where
    S: PositionStore
[src]

impl<'a, S> BaseRecord for seq_io::fastq::RefRecord<'a, S> where
    S: PositionStore
[src]

impl<'a, S> BaseRecord for seq_io::fastx::RefRecord<'a, S> where
    S: PositionStore
[src]

Loading content...