Struct noodles_bam::record::sequence::Sequence[][src]

pub struct Sequence { /* fields omitted */ }
Expand description

A BAM record sequence.

Implementations

Creates a sequence by wrapping raw sequence data.

Examples
use noodles_bam::record::Sequence;
let sequence = Sequence::new(vec![0x12, 0x48], 4); // ACGT
assert_eq!(sequence.as_ref(), [0x12, 0x48]);

Returns whether the sequence contains any bases.

Examples
use noodles_bam::record::Sequence;

let sequence = Sequence::default();
assert!(sequence.is_empty());

let sequence = Sequence::new(vec![0x12, 0x48], 4); // ACGT
assert!(!sequence.is_empty());
👎 Deprecated since 0.8.0:

Use Sequence::len instead.

Returns the number of bases in the sequence.

Examples
use noodles_bam::record::Sequence;
let sequence = Sequence::new(vec![0x12, 0x48], 4); // ACGT
assert_eq!(sequence.len(), 4);

Returns the number of bases in the sequence.

Examples
use noodles_bam::record::Sequence;
let sequence = Sequence::new(vec![0x12, 0x48], 4); // ACGT
assert_eq!(sequence.len(), 4);

Returns a mutable reference to the base count.

Examples
use noodles_bam::record::Sequence;
let mut sequence = Sequence::default();
sequence.set_len(2);
assert_eq!(sequence.len(), 2);

Returns a reference to the base at the given index.

If the index is out of bounds, this returns None.

Examples
use noodles_bam::record::{sequence::Base, Sequence};

let sequence = Sequence::new(vec![0x12, 0x48], 4); // ACGT

assert_eq!(sequence.get(1), Some(&Base::C));
assert_eq!(sequence.get(8), None);

Returns a iterator over the bases in this sequence.

Examples
use noodles_bam::record::{sequence::Base, Sequence};

let sequence = Sequence::new(vec![0x12, 0x48], 4); // ACGT
let mut bases = sequence.bases();

assert_eq!(bases.next(), Some(Base::A));
assert_eq!(bases.next(), Some(Base::C));
assert_eq!(bases.next(), Some(Base::G));
assert_eq!(bases.next(), Some(Base::T));
assert_eq!(bases.next(), None);

Appends a base to the end of the sequence.

Examples
use noodles_bam::record::{sequence::Base, Sequence};

let mut sequence = Sequence::new(vec![0x12, 0x40], 3); // ACG

sequence.push(Base::T);
assert_eq!(sequence.as_ref(), [0x12, 0x48]); // ACGT
assert_eq!(sequence.len(), 4);

sequence.push(Base::A);
assert_eq!(sequence.as_ref(), [0x12, 0x48, 0x10]); //ACGTA
assert_eq!(sequence.len(), 5);

Trait Implementations

Performs the conversion.

Performs the conversion.

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

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

Compare self to key and return true if they are equal.

Performs the conversion.

Performs the conversion.

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.