-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prototype of bedtools map working with multiple operators.
- New `TsvConfig` type for e.g. missing data string, with `BED_TSV` definition. - Fixed issues with `left_overlaps()`. - New `DatumType` enum for data types. - New `IntoDatumType` trait for conversion. - Fix to `median()`. - `Operation.run()` method for operations. - New AI-generated more helpful errors. - `to_tsv()` now with `TsvConfig` - lazy static dep. added. - Better parsing error messages. - New join data iterators (mostly for error checking.
- Loading branch information
Showing
15 changed files
with
685 additions
and
322 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,72 @@ | ||
//! Data container implementations. | ||
//! | ||
use crate::traits::DataContainer; | ||
use crate::traits::{DataContainer, IntoDatumType}; | ||
|
||
pub mod operations; | ||
pub mod vec; | ||
|
||
/// These are core supported data types stored in an `enum`, to | ||
/// unify the types that come out of standard operations like | ||
/// `select()`. | ||
#[derive(Debug, Clone)] | ||
pub enum DatumType { | ||
Float32(f32), | ||
Float64(f64), | ||
String(String), | ||
Integer32(i32), | ||
Integer64(i64), | ||
Unsigned32(u32), | ||
Unsigned64(u64), | ||
NoValue, | ||
} | ||
|
||
impl IntoDatumType for f64 { | ||
fn into_data_type(self) -> DatumType { | ||
DatumType::Float64(self) | ||
} | ||
} | ||
impl IntoDatumType for i64 { | ||
fn into_data_type(self) -> DatumType { | ||
DatumType::Integer64(self) | ||
} | ||
} | ||
impl IntoDatumType for String { | ||
fn into_data_type(self) -> DatumType { | ||
DatumType::String(self) | ||
} | ||
} | ||
|
||
impl IntoDatumType for f32 { | ||
fn into_data_type(self) -> DatumType { | ||
DatumType::Float32(self) | ||
} | ||
} | ||
|
||
impl IntoDatumType for i32 { | ||
fn into_data_type(self) -> DatumType { | ||
DatumType::Integer32(self) | ||
} | ||
} | ||
|
||
impl IntoDatumType for u32 { | ||
fn into_data_type(self) -> DatumType { | ||
DatumType::Unsigned32(self) | ||
} | ||
} | ||
|
||
impl IntoDatumType for u64 { | ||
fn into_data_type(self) -> DatumType { | ||
DatumType::Unsigned64(self) | ||
} | ||
} | ||
|
||
// Conversion from field types to `DatumType` | ||
impl<T: IntoDatumType> From<T> for DatumType { | ||
fn from(item: T) -> Self { | ||
item.into_data_type() | ||
} | ||
} | ||
|
||
impl<U> DataContainer for Vec<U> {} | ||
impl DataContainer for () {} |
Oops, something went wrong.