pub struct StrandedRegionSet {
pub inner: RegionSet,
pub strands: Vec<Strand>,
}Expand description
A RegionSet paired with a parallel Vec<Strand>.
Follows the SortedRegionSet wrapper pattern: wraps a RegionSet and
adds strand information without modifying Region itself (which lives
in gtars-core). Strand-aware operations (promoters, reduce, setdiff)
are implemented as methods on this type.
Fields§
§inner: RegionSet§strands: Vec<Strand>Implementations§
Source§impl StrandedRegionSet
impl StrandedRegionSet
Sourcepub fn new(rs: RegionSet, strands: Vec<Strand>) -> Self
pub fn new(rs: RegionSet, strands: Vec<Strand>) -> Self
Create a new StrandedRegionSet from a RegionSet and parallel strand vector.
§Panics
Panics if strands.len() != rs.regions.len().
Sourcepub fn unstranded(rs: RegionSet) -> Self
pub fn unstranded(rs: RegionSet) -> Self
Wrap a RegionSet with all-Unstranded. Preserves existing behavior.
Sourcepub fn into_regionset(self) -> RegionSet
pub fn into_regionset(self) -> RegionSet
Consume into the inner RegionSet, dropping strand information.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Source§impl StrandedRegionSet
impl StrandedRegionSet
Sourcepub fn trim(&self, chrom_sizes: &HashMap<String, u32>) -> StrandedRegionSet
pub fn trim(&self, chrom_sizes: &HashMap<String, u32>) -> StrandedRegionSet
Clip regions to chromosome boundaries, preserving strand information.
Sourcepub fn promoters(&self, upstream: u32, downstream: u32) -> RegionSet
pub fn promoters(&self, upstream: u32, downstream: u32) -> RegionSet
Strand-aware promoter computation. Returns an unstranded RegionSet.
- Plus / Unstranded:
[start - upstream, start + downstream) - Minus:
[end - downstream, end + upstream)
Sourcepub fn promoters_stranded(
&self,
upstream: u32,
downstream: u32,
) -> StrandedRegionSet
pub fn promoters_stranded( &self, upstream: u32, downstream: u32, ) -> StrandedRegionSet
Like promoters() but preserves strand information, so a subsequent
strand-aware reduce() merges only same-strand promoters.
Sourcepub fn reduce(&self) -> StrandedRegionSet
pub fn reduce(&self) -> StrandedRegionSet
Strand-aware reduce: merge overlapping/adjacent intervals only within the same (chr, strand) group.
Sourcepub fn setdiff(&self, other: &StrandedRegionSet) -> StrandedRegionSet
pub fn setdiff(&self, other: &StrandedRegionSet) -> StrandedRegionSet
Strand-aware setdiff: subtract other from self, matching only
within the same (chr, strand) group.
Trait Implementations§
Source§impl Clone for StrandedRegionSet
impl Clone for StrandedRegionSet
Source§fn clone(&self) -> StrandedRegionSet
fn clone(&self) -> StrandedRegionSet
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'de> Deserialize<'de> for StrandedRegionSet
impl<'de> Deserialize<'de> for StrandedRegionSet
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for StrandedRegionSet
impl RefUnwindSafe for StrandedRegionSet
impl Send for StrandedRegionSet
impl Sync for StrandedRegionSet
impl Unpin for StrandedRegionSet
impl UnsafeUnpin for StrandedRegionSet
impl UnwindSafe for StrandedRegionSet
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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 moreimpl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.