Trait bedrs::traits::interval::StrandedOverlap

source ·
pub trait StrandedOverlap<C, T>: Coordinates<C, T>
where Self: Sized, C: ChromBounds, T: ValueBounds,
{ // Provided methods fn stranded_overlaps<I: Coordinates<C, T>>(&self, other: &I) -> bool { ... } fn stranded_overlaps_by<I: Coordinates<C, T>>( &self, other: &I, bases: T ) -> bool { ... } fn stranded_overlaps_by_exactly<I: Coordinates<C, T>>( &self, other: &I, bases: T ) -> bool { ... } fn stranded_overlap_size<I: Coordinates<C, T>>( &self, other: &I ) -> Option<T> { ... } fn stranded_starts<I: Coordinates<C, T>>(&self, other: &I) -> bool { ... } fn stranded_ends<I: Coordinates<C, T>>(&self, other: &I) -> bool { ... } fn stranded_equals<I: Coordinates<C, T>>(&self, other: &I) -> bool { ... } fn stranded_during<I: Coordinates<C, T>>(&self, other: &I) -> bool { ... } fn stranded_contains<I: Coordinates<C, T>>(&self, other: &I) -> bool { ... } fn stranded_contained_by<I: Coordinates<C, T>>(&self, other: &I) -> bool { ... } fn stranded_borders<I: Coordinates<C, T>>(&self, other: &I) -> bool { ... } }

Provided Methods§

source

fn stranded_overlaps<I: Coordinates<C, T>>(&self, other: &I) -> bool

Returns true if the current interval overlaps the other and both intervals are on the same chromosome and strand.

Considers all three of:

  1. The chromosome
  2. The strand
  3. The interval overlap
(Self)    |-------->
(Other)       |-------->

or

(Self)        <--------|
(Other)   <--------|
source

fn stranded_overlaps_by<I: Coordinates<C, T>>( &self, other: &I, bases: T ) -> bool

Returns true if the current interval overlaps the other by at least bases and both intervals are on the same chromosome and strand.

Considers all three of:

  1. The chromosome
  2. The strand
  3. The interval overlap
(Self)    |-------->
(Other)       |-------->

or

(Self)        <--------
(Other)   <--------
source

fn stranded_overlaps_by_exactly<I: Coordinates<C, T>>( &self, other: &I, bases: T ) -> bool

Returns true if the current interval overlaps the other by exactly bases and both intervals are on the same chromosome and strand.

source

fn stranded_overlap_size<I: Coordinates<C, T>>(&self, other: &I) -> Option<T>

Returns the size of the overlap between the current interval and the other if the intervals are on the same chromosome and strand.

source

fn stranded_starts<I: Coordinates<C, T>>(&self, other: &I) -> bool

Returns true if the current interval starts the other and both intervals are on the same strand

(Self)    |-------->
(Other)   |----------------->
§Example
use bedrs::{StrandedBed3, Strand, Coordinates, Overlap, StrandedOverlap};
let interval1 = StrandedBed3::new(1, 100, 200, Strand::Forward);
let interval2 = StrandedBed3::new(1, 100, 400, Strand::Forward);
let interval3 = StrandedBed3::new(1, 100, 400, Strand::Reverse);
assert!(interval1.stranded_starts(&interval2));
assert!(!interval1.stranded_starts(&interval3));
source

fn stranded_ends<I: Coordinates<C, T>>(&self, other: &I) -> bool

Returns true if the current interval ends the other and both intervals are on the same strand

(Self)             |-------->
(Other)   |----------------->
§Example
use bedrs::{StrandedBed3, Strand, Coordinates, Overlap, StrandedOverlap};
let interval1 = StrandedBed3::new(1, 300, 400, Strand::Forward);
let interval2 = StrandedBed3::new(1, 100, 400, Strand::Forward);
let interval3 = StrandedBed3::new(1, 100, 400, Strand::Reverse);
assert!(interval1.stranded_ends(&interval2));
assert!(!interval1.stranded_ends(&interval3));
source

fn stranded_equals<I: Coordinates<C, T>>(&self, other: &I) -> bool

Returns true if the current interval equals the other and they are on the same strand considers both the interval overlap and the chromosome.

(Self)    |-------->
(Other)   |-------->
§Example
use bedrs::{StrandedBed3, Strand, Coordinates, Overlap, StrandedOverlap};
let interval1 = StrandedBed3::new(1, 100, 200, Strand::Forward);
let interval2 = StrandedBed3::new(1, 100, 200, Strand::Forward);
let interval3 = StrandedBed3::new(1, 100, 200, Strand::Reverse);
assert!(interval1.stranded_equals(&interval2));
assert!(!interval1.stranded_equals(&interval3));
source

fn stranded_during<I: Coordinates<C, T>>(&self, other: &I) -> bool

Returns true if the current interval is during the other and both intervals are on the same strand -

(Self)      |---->
(Other)   |-------->
§Example
use bedrs::{StrandedBed3, Strand, Coordinates, Overlap, StrandedOverlap};
let interval1 = StrandedBed3::new(1, 150, 160, Strand::Forward);
let interval2 = StrandedBed3::new(1, 100, 200, Strand::Forward);
let interval3 = StrandedBed3::new(1, 100, 200, Strand::Reverse);
assert!(interval1.stranded_during(&interval2));
assert!(!interval1.stranded_during(&interval3));
source

fn stranded_contains<I: Coordinates<C, T>>(&self, other: &I) -> bool

Returns true if the current interval contains the other and both intervals are on the same strand -

(Self)    |-------->
(Other)     |---->
§Example
use bedrs::{StrandedBed3, Strand, Coordinates, Overlap, StrandedOverlap};

let interval1 = StrandedBed3::new(1, 100, 200, Strand::Forward);
let interval2 = StrandedBed3::new(1, 150, 160, Strand::Forward);
let interval3 = StrandedBed3::new(1, 150, 160, Strand::Reverse);

assert!(interval1.stranded_contains(&interval2));
assert!(!interval1.stranded_contains(&interval3));
source

fn stranded_contained_by<I: Coordinates<C, T>>(&self, other: &I) -> bool

Returns true if the current interval is contained by the other and both intervals are on the same strand -

(Self)      |---->
(Other)   |-------->

or
(Self)      <----|
(Other)   <--------|
§Example
use bedrs::{StrandedBed3, Strand, Coordinates, Overlap, StrandedOverlap};

let interval1 = StrandedBed3::new(1, 150, 160, Strand::Forward);
let interval2 = StrandedBed3::new(1, 100, 200, Strand::Forward);
let interval3 = StrandedBed3::new(1, 100, 200, Strand::Reverse);

assert!(interval1.stranded_contained_by(&interval2));
assert!(!interval1.stranded_contained_by(&interval3));
source

fn stranded_borders<I: Coordinates<C, T>>(&self, other: &I) -> bool

Returns true if the current interval borders the other and both intervals are on the same strand -

(Self)    |-------->
(Other)            |-------->

or
(Self)             <--------|
(Other)   <--------|
§Example
use bedrs::{StrandedBed3, Strand, Coordinates, Overlap, StrandedOverlap};

let interval1 = StrandedBed3::new(1, 100, 200, Strand::Forward);
let interval2 = StrandedBed3::new(1, 200, 300, Strand::Forward);
let interval3 = StrandedBed3::new(1, 200, 300, Strand::Reverse);

assert!(interval1.stranded_borders(&interval2));
assert!(!interval1.stranded_borders(&interval3));

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<I, C, T> StrandedOverlap<C, T> for I
where I: Coordinates<C, T>, C: ChromBounds, T: ValueBounds,