[−][src]Struct bio::io::fastq::Record
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]
id: &str,
desc: Option<&str>,
seq: TextSlice,
qual: &[u8]
) -> Self
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]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
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]
fn name(&self) -> &[u8]
[src]
fn base(&self, i: usize) -> u8
[src]
fn base_qual(&self, i: usize) -> u8
[src]
fn len(&self) -> usize
[src]
impl Serialize for Record
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,