#[non_exhaustive]pub struct ModConfig {
pub base: AllowedAGCTN,
pub is_strand_plus: bool,
pub mod_code: ModChar,
pub win: Vec<NonZeroU32>,
pub mod_range: Vec<OrdPair<F32Bw0and1>>,
}Expand description
Configuration for modification generation in simulated BAM files.
Also refer to SimulationConfig to see how this struct can be used,
and ModConfigBuilder to see how it can be built as shown below.
§Example
Configure modification for cytosines on plus strand. Here, 2Cs have probabilities randomly chosen b/w 0.4-0.8, 3Cs have probabilities b/w 0.5-0.7, 2Cs have …, 3Cs have …, … repeated forever. This can be passed as an input to a routine sometime later and applied on a given sequence.
use nanalogue_core::Error;
use nanalogue_core::simulate_mod_bam::ModConfigBuilder;
let mod_config_c = ModConfigBuilder::default()
.base('C')
.is_strand_plus(true)
.mod_code("m".into())
.win(vec![2, 3])
.mod_range(vec![(0.4, 0.8), (0.5, 0.7)]).build()?;Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.base: AllowedAGCTNBase that is modified (A, C, G, T, or N)
is_strand_plus: boolWhether this is on the plus strand
mod_code: ModCharModification code (character or numeric)
win: Vec<NonZeroU32>Vector of window sizes for modification density variation.
e.g. if you want reads with a window of 100 bases with each
modified with a probability in the range 0.4-0.6 and the next
200 modified in the range 0.1-0.2 (and this two window config
repeating forever), you need to set this win array to
[100, 200] and the mod range array to [[0.4, 0.6], [0.1, 0.2]]
(Remembering to adjust the datatypes of the inputs suitably
i.e. use NonZeroU32 etc.)
NOTE: “bases” in the above description refer to bases of interest
set in the base field i.e. 100 bases with base set to “T” mean
100 thymidines specifically.
mod_range: Vec<OrdPair<F32Bw0and1>>Vector of modification density range e.g. [[0.4, 0.6], [0.1, 0.2]].
Also see description of win above.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ModConfig
impl<'de> Deserialize<'de> for ModConfig
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>,
impl StructuralPartialEq for ModConfig
Auto Trait Implementations§
impl Freeze for ModConfig
impl RefUnwindSafe for ModConfig
impl Send for ModConfig
impl Sync for ModConfig
impl Unpin for ModConfig
impl UnwindSafe for ModConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> Key for Twhere
T: Clone,
impl<T> Key for Twhere
T: Clone,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt 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.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.