Skip to main content

Locs

Struct Locs 

Source
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

Source

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”.

Source

pub fn spans(chr_ids: &[String], starts: &[i64], ends: &[i64]) -> Result<Self>

starts and ends given directly.

Source

pub fn from_starts( chr_ids: &[String], starts: &[i64], span: i64, ) -> Result<Self>

ends[i] = starts[i] + span.

Source

pub fn from_ends(chr_ids: &[String], ends: &[i64], span: i64) -> Result<Self>

starts[i] = ends[i] - span.

Source

pub fn centered(chr_ids: &[String], centers: &[i64], span: i64) -> Result<Self>

[c - span/2, c + (span + 1)/2).

Source

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.

Source

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.

Source

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.

Source

pub fn strand(&self, i: usize) -> Strand

Strand of locus i, forward when none were given.

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Trait Implementations§

Source§

impl Clone for Locs

Source§

fn clone(&self) -> Locs

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Locs

Source§

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

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

impl Default for Locs

Source§

fn default() -> Locs

Returns the “default value” for a type. Read more
Source§

impl PartialEq for Locs

Source§

fn eq(&self, other: &Locs) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

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> 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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.