pub struct Record<const N: u8> { /* private fields */ }
Expand description
A BED record.
Implementations§
source§impl<const N: u8> Record<N>
impl<const N: u8> Record<N>
sourcepub fn reference_sequence_name(&self) -> &str
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");
sourcepub fn start_position(&self) -> Position
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);
sourcepub fn end_position(&self) -> Position
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);
sourcepub fn optional_fields(&self) -> &OptionalFields
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>
impl<const N: u8> Record<N>
sourcepub fn name(&self) -> Option<&Name>
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>
impl<const N: u8> Record<N>
sourcepub fn score(&self) -> Option<Score>
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>
impl<const N: u8> Record<N>
sourcepub fn strand(&self) -> Option<Strand>
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>
impl<const N: u8> Record<N>
sourcepub fn thick_start(&self) -> Position
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>
impl<const N: u8> Record<N>
sourcepub fn thick_end(&self) -> Position
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>
impl<const N: u8> Record<N>
sourcepub fn color(&self) -> Option<Color>
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>
impl<const N: u8> Record<N>
sourcepub fn blocks(&self) -> &[(usize, usize)]
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> PartialEq for Record<N>
impl<const N: u8> PartialEq for Record<N>
impl BedN<12> for Record<12>
impl BedN<3> for Record<12>
impl BedN<3> for Record<3>
impl BedN<3> for Record<4>
impl BedN<3> for Record<5>
impl BedN<3> for Record<6>
impl BedN<3> for Record<7>
impl BedN<3> for Record<8>
impl BedN<3> for Record<9>
impl BedN<4> for Record<12>
impl BedN<4> for Record<4>
impl BedN<4> for Record<5>
impl BedN<4> for Record<6>
impl BedN<4> for Record<7>
impl BedN<4> for Record<8>
impl BedN<4> for Record<9>
impl BedN<5> for Record<12>
impl BedN<5> for Record<5>
impl BedN<5> for Record<6>
impl BedN<5> for Record<7>
impl BedN<5> for Record<8>
impl BedN<5> for Record<9>
impl BedN<6> for Record<12>
impl BedN<6> for Record<6>
impl BedN<6> for Record<7>
impl BedN<6> for Record<8>
impl BedN<6> for Record<9>
impl BedN<7> for Record<12>
impl BedN<7> for Record<7>
impl BedN<7> for Record<8>
impl BedN<7> for Record<9>
impl BedN<8> for Record<12>
impl BedN<8> for Record<8>
impl BedN<8> for Record<9>
impl BedN<9> for Record<12>
impl BedN<9> for Record<9>
impl<const N: u8> Eq for Record<N>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.