Struct noodles::bed::Record

source ·
pub struct Record<const N: u8> { /* private fields */ }
Expand description

A BED record.

Implementations§

source§

impl<const N: u8> Record<N>
where Record<N>: BedN<3>,

source

pub fn builder() -> Builder<N>

Creates a BED record builder.

source

pub fn reference_sequence_name(&self) -> &str

Returns the reference sequence name (chrom).

§Examples
use noodles_bed as bed;
use noodles_core::Position;

let record = bed::Record::<3>::builder()
    .set_reference_sequence_name("sq0")
    .set_start_position(Position::try_from(8)?)
    .set_end_position(Position::try_from(13)?)
    .build()?;

assert_eq!(record.reference_sequence_name(), "sq0");
source

pub fn start_position(&self) -> Position

Returns the feature start position (chromStart).

§Examples
use noodles_bed as bed;
use noodles_core::Position;

let start_position = Position::try_from(8)?;

let record = bed::Record::<3>::builder()
    .set_reference_sequence_name("sq0")
    .set_start_position(start_position)
    .set_end_position(Position::try_from(13)?)
    .build()?;

assert_eq!(record.start_position(), start_position);
source

pub fn end_position(&self) -> Position

Returns the feature end position (chromEnd).

§Examples
use noodles_bed as bed;
use noodles_core::Position;

let end_position = Position::try_from(13)?;

let record = bed::Record::<3>::builder()
    .set_reference_sequence_name("sq0")
    .set_start_position(Position::try_from(8)?)
    .set_end_position(end_position)
    .build()?;

assert_eq!(record.end_position(), end_position);
source

pub fn optional_fields(&self) -> &OptionalFields

Returns the list of raw optional fields.

§Examples
use noodles_bed as bed;
use noodles_core::Position;

let record = bed::Record::<3>::builder()
    .set_reference_sequence_name("sq0")
    .set_start_position(Position::try_from(8)?)
    .set_end_position(Position::try_from(13)?)
    .build()?;

assert!(record.optional_fields().is_empty());
source§

impl<const N: u8> Record<N>
where Record<N>: BedN<4>,

source

pub fn name(&self) -> Option<&Name>

Returns the feature name (name).

§Examples
use noodles_bed::{self as bed, record::Name};
use noodles_core::Position;

let name: Name = "ndls1".parse()?;

let record = bed::Record::<4>::builder()
    .set_reference_sequence_name("sq0")
    .set_start_position(Position::try_from(8)?)
    .set_end_position(Position::try_from(13)?)
    .set_name(name.clone())
    .build()?;

assert_eq!(record.name(), Some(&name));
source§

impl<const N: u8> Record<N>
where Record<N>: BedN<5>,

source

pub fn score(&self) -> Option<Score>

Returns the score (score).

§Examples
use noodles_bed::{self as bed, record::Score};
use noodles_core::Position;

let record = bed::Record::<5>::builder()
    .set_reference_sequence_name("sq0")
    .set_start_position(Position::try_from(8)?)
    .set_end_position(Position::try_from(13)?)
    .set_score(Score::try_from(21)?)
    .build()?;

assert_eq!(record.score().map(u16::from), Some(21));
source§

impl<const N: u8> Record<N>
where Record<N>: BedN<6>,

source

pub fn strand(&self) -> Option<Strand>

Returns the feature strand (strand).

§Examples
use noodles_bed::{self as bed, record::Strand};
use noodles_core::Position;

let record = bed::Record::<6>::builder()
    .set_reference_sequence_name("sq0")
    .set_start_position(Position::try_from(8)?)
    .set_end_position(Position::try_from(13)?)
    .set_strand(Strand::Forward)
    .build()?;

assert_eq!(record.strand(), Some(Strand::Forward));
source§

impl<const N: u8> Record<N>
where Record<N>: BedN<7>,

source

pub fn thick_start(&self) -> Position

Returns the thick start position (thickStart).

§Examples
use noodles_bed as bed;
use noodles_core::Position;

let thick_start = Position::try_from(8)?;

let record = bed::Record::<7>::builder()
    .set_reference_sequence_name("sq0")
    .set_start_position(Position::try_from(8)?)
    .set_end_position(Position::try_from(13)?)
    .set_thick_start(thick_start)
    .build()?;

assert_eq!(record.thick_start(), thick_start);
source§

impl<const N: u8> Record<N>
where Record<N>: BedN<8>,

source

pub fn thick_end(&self) -> Position

Returns the thick end position (thickEnd).

§Examples
use noodles_bed as bed;
use noodles_core::Position;

let thick_end = Position::try_from(13)?;

let record = bed::Record::<8>::builder()
    .set_reference_sequence_name("sq0")
    .set_start_position(Position::try_from(8)?)
    .set_end_position(Position::try_from(13)?)
    .set_thick_end(thick_end)
    .build()?;

assert_eq!(record.thick_end(), thick_end);
source§

impl<const N: u8> Record<N>
where Record<N>: BedN<9>,

source

pub fn color(&self) -> Option<Color>

Returns the color (itemRgb).

§Examples
use noodles_bed::{self as bed, record::Color};
use noodles_core::Position;

let thick_end = Position::try_from(13)?;

let record = bed::Record::<9>::builder()
    .set_reference_sequence_name("sq0")
    .set_start_position(Position::try_from(8)?)
    .set_end_position(Position::try_from(13)?)
    .set_color(Color::RED)
    .build()?;

assert_eq!(record.color(), Some(Color::RED));
source§

impl<const N: u8> Record<N>
where Record<N>: BedN<12>,

source

pub fn blocks(&self) -> &[(usize, usize)]

Returns the blocks ([(blockStarts, blockSizes)]).

§Examples
use noodles_bed as bed;
use noodles_core::Position;

let blocks = vec![(0, 2)];

let record = bed::Record::<12>::builder()
    .set_reference_sequence_name("sq0")
    .set_start_position(Position::try_from(8)?)
    .set_end_position(Position::try_from(13)?)
    .set_blocks(blocks.clone())
    .build()?;

assert_eq!(record.blocks(), &blocks);

Trait Implementations§

source§

impl<const N: u8> Clone for Record<N>

source§

fn clone(&self) -> Record<N>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<const N: u8> Debug for Record<N>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Display for Record<12>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Display for Record<3>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Display for Record<4>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Display for Record<5>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Display for Record<6>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Display for Record<7>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Display for Record<8>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Display for Record<9>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl FromStr for Record<12>

§

type Err = ParseError

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Record<12>, <Record<12> as FromStr>::Err>

Parses a string s to return a value of this type. Read more
source§

impl FromStr for Record<3>

§

type Err = ParseError

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Record<3>, <Record<3> as FromStr>::Err>

Parses a string s to return a value of this type. Read more
source§

impl FromStr for Record<4>

§

type Err = ParseError

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Record<4>, <Record<4> as FromStr>::Err>

Parses a string s to return a value of this type. Read more
source§

impl FromStr for Record<5>

§

type Err = ParseError

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Record<5>, <Record<5> as FromStr>::Err>

Parses a string s to return a value of this type. Read more
source§

impl FromStr for Record<6>

§

type Err = ParseError

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Record<6>, <Record<6> as FromStr>::Err>

Parses a string s to return a value of this type. Read more
source§

impl FromStr for Record<7>

§

type Err = ParseError

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Record<7>, <Record<7> as FromStr>::Err>

Parses a string s to return a value of this type. Read more
source§

impl FromStr for Record<8>

§

type Err = ParseError

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Record<8>, <Record<8> as FromStr>::Err>

Parses a string s to return a value of this type. Read more
source§

impl FromStr for Record<9>

§

type Err = ParseError

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Record<9>, <Record<9> as FromStr>::Err>

Parses a string s to return a value of this type. Read more
source§

impl<const N: u8> PartialEq for Record<N>

source§

fn eq(&self, other: &Record<N>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl BedN<12> for Record<12>

source§

impl BedN<3> for Record<12>

source§

impl BedN<3> for Record<3>

source§

impl BedN<3> for Record<4>

source§

impl BedN<3> for Record<5>

source§

impl BedN<3> for Record<6>

source§

impl BedN<3> for Record<7>

source§

impl BedN<3> for Record<8>

source§

impl BedN<3> for Record<9>

source§

impl BedN<4> for Record<12>

source§

impl BedN<4> for Record<4>

source§

impl BedN<4> for Record<5>

source§

impl BedN<4> for Record<6>

source§

impl BedN<4> for Record<7>

source§

impl BedN<4> for Record<8>

source§

impl BedN<4> for Record<9>

source§

impl BedN<5> for Record<12>

source§

impl BedN<5> for Record<5>

source§

impl BedN<5> for Record<6>

source§

impl BedN<5> for Record<7>

source§

impl BedN<5> for Record<8>

source§

impl BedN<5> for Record<9>

source§

impl BedN<6> for Record<12>

source§

impl BedN<6> for Record<6>

source§

impl BedN<6> for Record<7>

source§

impl BedN<6> for Record<8>

source§

impl BedN<6> for Record<9>

source§

impl BedN<7> for Record<12>

source§

impl BedN<7> for Record<7>

source§

impl BedN<7> for Record<8>

source§

impl BedN<7> for Record<9>

source§

impl BedN<8> for Record<12>

source§

impl BedN<8> for Record<8>

source§

impl BedN<8> for Record<9>

source§

impl BedN<9> for Record<12>

source§

impl BedN<9> for Record<9>

source§

impl<const N: u8> Eq for Record<N>

source§

impl<const N: u8> StructuralPartialEq for Record<N>

Auto Trait Implementations§

§

impl<const N: u8> Freeze for Record<N>

§

impl<const N: u8> RefUnwindSafe for Record<N>

§

impl<const N: u8> Send for Record<N>

§

impl<const N: u8> Sync for Record<N>

§

impl<const N: u8> Unpin for Record<N>

§

impl<const N: u8> UnwindSafe for Record<N>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

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

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more