logo

Struct bio::io::fasta::Record

source · []
pub struct Record { /* private fields */ }
Expand description

A FASTA record.

Implementations

Create a new instance.

Create a new Record from given attributes.

Examples
use bio::io::fasta::Record;

let read_id = "read1";
let description = Some("sampleid=foobar");
let sequence = b"ACGT";
let record = Record::with_attrs(read_id, description, sequence);

assert_eq!(">read1 sampleid=foobar\nACGT\n", record.to_string())

Check if record is empty.

Check validity of Fasta record.

Return the id of the record.

Return descriptions if present.

Return the sequence of the record.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

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 Fasta Record and create a String representation of it.

use bio::io::fasta::Reader;
use std::fmt::Write;
// create a "fake" fasta file
let fasta: &'static [u8] = b">id comment1 comment2\nACGT\n";
let mut records = Reader::new(fasta).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(fasta).unwrap();

assert_eq!(actual, expected)

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more

Checks if self is actually part of its subset T (and can be converted to it).

Use with care! Same as self.to_subset but without any property checks. Always succeeds.

The inclusion map: converts self to the equivalent element of its superset.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.