bedrs
bedtools-like functionality for interval sets in rust
Summary
I wanted some bedtools-like functionality in rust and I made this tool to both learn how to implement genomic arithmetic as well as get more comfortable with generics and traits in rust.
This library will eventually be focused towards genome-specific arithmetic
and focuses around a base Coordinates trait which includes functions to
retrieve <chr, start, stop>.
This is a work in progress and is subject to heavy changes.
If you want a more robust interval library I recommend the following:
This library is heavily inspired from those above.
Usage
The main benefit of this library is that it is trait-based.
So you can define your own types - but if they implement the
Coordinates trait they can use the other functions within the
library.
Coordinates Trait
The library centers around the Coordinates trait.
This is so that if you would like to implement your own interval type
you will only need to implement the Coordinates trait for your type
and you can use all the functionality of the library.
// define a custom interval struct for testing
Interval Types
There are some base interval types provided however, which you can use for reference or directly for your use case.
Base Interval
This is a straightforward singular interval type.
It still implements the chr() method, but will return the
default of its generic type.
use ;
let a = new;
let b = new;
assert!;
Genomic Interval
This is the bread and butter of genomic arithmetic.
It is a 3-attribute struct of [chr, start, stop].
use ;
// Initializing two intervals on the same Chr
let a = new;
let b = new;
assert!;
// Initializing two intervals on different Chr
let a = new;
let b = new;
assert!;