RegionSet

Struct RegionSet 

Source
pub struct RegionSet {
    pub regions: Vec<Region>,
    pub header: Option<String>,
    pub path: Option<PathBuf>,
}
Expand description

RegionSet struct, the representation of the interval region set file, such as bed file.

Fields§

§regions: Vec<Region>§header: Option<String>§path: Option<PathBuf>

Implementations§

Source§

impl RegionSet

Source

pub fn to_bed<T: AsRef<Path>>(&self, path: T) -> Result<()>

Save a regionset to disk as bed file

§Arguments
  • path: the path to the file to dump to
Source

pub fn to_bed_gz<T: AsRef<Path>>(&self, path: T) -> Result<()>

Save a regionset to disk as bed.gz file

§Arguments
  • path: the path to the file to dump to
Source

pub fn identifier(&self) -> String

Calculate identifier for RegionSet

This function doesn’t sort file, and identifer is based on unsorted first 3 columns.

§Returns

String containing RegionSet identifier

Source

pub fn file_digest(&self) -> String

Source

pub fn iter_chroms(&self) -> impl Iterator<Item = &String>

Iterate unique chromosomes located in RegionSet

Source

pub fn iter_chr_regions<'a>( &'a self, chr: &'a str, ) -> impl Iterator<Item = &'a Region>

Iterate through regions located on specific Chromosome in RegionSet

§Arguments
  • chr: chromosome name
Source

pub fn sort(&mut self)

Sort bed file based on first 3 columns. Sorting is happening inside the object, where original order will be overwritten

Source

pub fn is_empty(&self) -> bool

Is regionSet empty?

Source

pub fn region_widths(&self) -> Result<Vec<u32>>

Calculate all regions width

Source

pub fn mean_region_width(&self) -> f64

Calculate mean region width for whole RegionSet

Source

pub fn calc_mid_points(&self) -> HashMap<String, Vec<u32>>

Calculate middle point for each region, and return hashmap with midpoints for each chromosome

Source

pub fn len(&self) -> usize

Get number of regions in RegionSet

Returns: number of regions

Source

pub fn get_max_end_per_chr(&self) -> HashMap<String, u32>

Get the furthest region location for each region

Source

pub fn nucleotides_length(&self) -> u32

Get total nucleotide count

Trait Implementations§

Source§

impl Clone for RegionSet

Source§

fn clone(&self) -> RegionSet

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for RegionSet

Source§

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

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

impl Display for RegionSet

Source§

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

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

impl From<&[u8]> for RegionSet

Source§

fn from(value: &[u8]) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<Region>> for RegionSet

Source§

fn from(regions: Vec<Region>) -> Self

Converts to this type from the input type.
Source§

impl<'a> IntoIterator for &'a RegionSet

Source§

type Item = &'a Region

The type of the elements being iterated over.
Source§

type IntoIter = RegionSetIterator<'a>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl TryFrom<&Path> for RegionSet

Source§

fn try_from(value: &Path) -> Result<Self>

Create a new RegionSet from a bed file.

§Arguments:
  • value: path to bed file on disk.
Source§

type Error = Error

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

impl TryFrom<&str> for RegionSet

Source§

type Error = Error

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

fn try_from(value: &str) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<PathBuf> for RegionSet

Source§

type Error = Error

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

fn try_from(value: PathBuf) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<String> for RegionSet

Source§

type Error = Error

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

fn try_from(value: String) -> Result<Self>

Performs the conversion.

Auto Trait Implementations§

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

Source§

type Output = T

Should always be Self
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.