[][src]Struct bio::io::fastq::Record

pub struct Record { /* fields omitted */ }

A FastQ record.

Implementations

impl Record[src]

pub fn new() -> Self[src]

Create a new, empty FastQ record.

pub fn with_attrs(
    id: &str,
    desc: Option<&str>,
    seq: TextSlice,
    qual: &[u8]
) -> Self
[src]

Create a new FastQ record from given attributes.

Example

use bio::io::fastq::Record;

let record = Record::with_attrs("id_str", Some("desc"), b"ATGCGGG", b"QQQQQQQ");
assert_eq!(record.id(), "id_str");
assert_eq!(record.desc(), Some("desc"));
assert_eq!(record.seq(), b"ATGCGGG");
assert_eq!(record.qual(), b"QQQQQQQ");

pub fn is_empty(&self) -> bool[src]

Check if a record is empty.

Example

use bio::io::fastq::Record;

let mut record = Record::new();
assert!(record.is_empty());

record = Record::with_attrs("id_str", Some("desc"), b"ATGCGGG", b"QQQQQQQ");
assert!(!record.is_empty());

pub fn check(&self) -> Result<(), &str>[src]

Check the validity of a FastQ record.

Errors

This function will return an Err if one of the following conditions is met:

  • The record identifier is empty.
  • There is a non-ASCII character found in either the sequence or quality strings.
  • The sequence and quality strings do not have the same length.

Example

use bio::io::fastq::Record;

let mut record = Record::with_attrs("id", None, "Prüfung".as_ref(), b"!!!!!!!");
let actual = record.check().unwrap_err();
let expected = "Non-ascii character found in sequence.";
assert_eq!(actual, expected);

record = Record::with_attrs("id_str", Some("desc"), b"ATGCGGG", b"QQQQQQQ");
assert!(record.check().is_ok());

pub fn id(&self) -> &str[src]

Return the id of the record.

pub fn desc(&self) -> Option<&str>[src]

Return descriptions if present.

pub fn seq(&self) -> TextSlice[src]

Return the sequence of the record.

pub fn qual(&self) -> &[u8][src]

Return the base qualities of the record.

Trait Implementations

impl Clone for Record[src]

impl Debug for Record[src]

impl Default for Record[src]

impl<'de> Deserialize<'de> for Record[src]

impl Display for Record[src]

fn fmt(&self, f: &mut Formatter) -> Result<(), Error>[src]

Allows for using Record in a given formatter f. In general this is for creating a String representation of a Record and, optionally, writing it to a file.

Errors

Returns std::fmt::Error if there is an issue formatting to the stream.

Examples

Read in a Fastq Record and create a String representation of it.

use bio::io::fastq::Reader;
use std::fmt::Write;
// create a "fake" fastq file
let fq: &'static [u8] = b"@id description\nACGT\n+\n!!!!\n";
let mut records = Reader::new(fq).records().map(|r| r.unwrap());
let record = records.next().unwrap();

let mut actual = String::new();
// populate `actual` with a string representation of our record
write!(actual, "{}", record).unwrap();

let expected = std::str::from_utf8(fq).unwrap();

assert_eq!(actual, expected)

impl PartialEq<Record> for Record[src]

impl SequenceRead for Record[src]

impl Serialize for Record[src]

impl StructuralPartialEq for Record[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,