Struct noodles_core::region::Region
source · pub struct Region { /* private fields */ }
Expand description
A genomic region.
A genomic region describes a region on a reference sequence. It consists of reference sequence name and an interval.
They are represented in text as reference-sequence-name[:start[-end]]
, where the start and
end positions are 1-based, inclusive. If no end position is given, it is assumed to span from
the start to the end of the reference sequence. If no interval is given, it is assumed to span
the entirety of the reference sequence.
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) -> &BStr
pub fn name(&self) -> &BStr
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 StructuralPartialEq for Region
Auto Trait Implementations§
impl Freeze for Region
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