pub struct Locs {
pub chr_ids: Vec<String>,
pub starts: Vec<i64>,
pub ends: Vec<i64>,
pub strands: Vec<Strand>,
}Expand description
A request’s regions, before they are resolved against a file.
Fields§
§chr_ids: Vec<String>§starts: Vec<i64>§ends: Vec<i64>§strands: Vec<Strand>One per locus, or empty for all-forward.
Implementations§
Source§impl Locs
impl Locs
Sourcepub fn parse(
chr_ids: &[String],
starts: &[i64],
ends: &[i64],
centers: &[i64],
span: Option<i64>,
) -> Result<Self>
pub fn parse( chr_ids: &[String], starts: &[i64], ends: &[i64], centers: &[i64], span: Option<i64>, ) -> Result<Self>
The runtime-dispatched form, for the Python layer.
Accepts one of: starts + ends with no span; or exactly one of
starts / ends / centers together with span. span of None
means no span was given, and so does Some(-1) — the Python layer has
no Option to pass and uses -1 as the sentinel. Anything below that is
refused: a caller reaching this from Rust with Some(-5) means
something, and silently reading it as “no span” is not it.
No loci at all is a request for nothing rather than a malformed one —
every reader handles an empty batch — and that is checked first, because
the tests below read an empty starts/ends as “not given”.
Sourcepub fn spans(chr_ids: &[String], starts: &[i64], ends: &[i64]) -> Result<Self>
pub fn spans(chr_ids: &[String], starts: &[i64], ends: &[i64]) -> Result<Self>
starts and ends given directly.
Sourcepub fn from_starts(
chr_ids: &[String],
starts: &[i64],
span: i64,
) -> Result<Self>
pub fn from_starts( chr_ids: &[String], starts: &[i64], span: i64, ) -> Result<Self>
ends[i] = starts[i] + span.
Sourcepub fn from_ends(chr_ids: &[String], ends: &[i64], span: i64) -> Result<Self>
pub fn from_ends(chr_ids: &[String], ends: &[i64], span: i64) -> Result<Self>
starts[i] = ends[i] - span.
Sourcepub fn centered(chr_ids: &[String], centers: &[i64], span: i64) -> Result<Self>
pub fn centered(chr_ids: &[String], centers: &[i64], span: i64) -> Result<Self>
[c - span/2, c + (span + 1)/2).
Sourcepub fn chromosomes(chr_ids: Vec<String>) -> Self
pub fn chromosomes(chr_ids: Vec<String>) -> Self
Chromosome names and nothing else.
What the whole-file calls take: they resolve the regions themselves from
the file’s chromosome sizes, so there are no coordinates to give.
Locs::parse refuses this shape — with no starts and no span there
is nothing for it to build — which is right for a request that names
windows and wrong for one that names chromosomes.
Sourcepub fn whole_chromosomes(map: &ChrMap, chr_ids: &[String]) -> Result<Self>
pub fn whole_chromosomes(map: &ChrMap, chr_ids: &[String]) -> Result<Self>
Every named chromosome end to end, for the read_all_* and iter_all_*
paths. An empty chr_ids means all of them, in the file’s order.
Sourcepub fn with_strands(self, strands: &[String]) -> Result<Self>
pub fn with_strands(self, strands: &[String]) -> Result<Self>
Empty leaves every locus forward, which is what a request that named no strand gets; anything else must be one entry per locus.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
impl StructuralPartialEq for Locs
Auto Trait Implementations§
impl Freeze for Locs
impl RefUnwindSafe for Locs
impl Send for Locs
impl Sync for Locs
impl Unpin for Locs
impl UnsafeUnpin for Locs
impl UnwindSafe for Locs
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more