Struct noodles_core::region::Region
source · pub struct Region { /* private fields */ }
Expand description
A genomic region.
Implementations§
source§impl Region
impl Region
sourcepub fn new<N, I>(name: N, interval: I) -> Self
pub fn new<N, I>(name: N, interval: I) -> Self
Creates a region.
Positions are assumed to be 1-based.
§Examples
use noodles_core::{Region, Position};
let start = Position::try_from(5)?;
let end = Position::try_from(8)?;
let region = Region::new("sq0", start..=end);
sourcepub fn name(&self) -> &[u8] ⓘ
pub fn name(&self) -> &[u8] ⓘ
Returns the reference name of the region.
§Examples
use noodles_core::{Position, Region};
let start = Position::try_from(5)?;
let end = Position::try_from(8)?;
let region = Region::new("sq0", start..=end);
assert_eq!(region.name(), b"sq0");
sourcepub fn start(&self) -> Bound<Position>
pub fn start(&self) -> Bound<Position>
Returns the start position of the region (1-based).
§Examples
use noodles_core::{Position, Region};
let start = Position::try_from(5)?;
let region = Region::new("sq0", start..);
assert_eq!(region.start(), Bound::Included(start));
sourcepub fn end(&self) -> Bound<Position>
pub fn end(&self) -> Bound<Position>
Returns the end position of the region (1-based).
§Examples
use noodles_core::{Position, Region};
let end = Position::try_from(8)?;
let region = Region::new("sq0", ..=end);
assert_eq!(region.end(), Bound::Included(end));
sourcepub fn interval(&self) -> Interval
pub fn interval(&self) -> Interval
Returns the start and end positions as an interval.
§Examples
use noodles_core::{region::Interval, Position, Region};
let start = Position::try_from(5)?;
let end = Position::try_from(8)?;
let region = Region::new("sq0", start..=end);
assert_eq!(region.interval(), Interval::from(start..=end));
Trait Implementations§
source§impl PartialEq for Region
impl PartialEq for Region
impl Eq for Region
impl StructuralEq for Region
impl StructuralPartialEq for Region
Auto Trait Implementations§
impl RefUnwindSafe for Region
impl Send for Region
impl Sync for Region
impl Unpin for Region
impl UnwindSafe for Region
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