tek2
|
Transposon class. More...
#include <transposon.hpp>
Public Types | |
using | param_type = TransposonParams |
Alias. | |
Public Member Functions | |
Transposon () noexcept=default | |
default constructor | |
Transposon (DNA< NUM_NONSYNONYMOUS_SITES > &&non, DNA< NUM_SYNONYMOUS_SITES > &&syn) noexcept | |
constructor | |
Transposon (const Transposon &)=default | |
copy constructor | |
Transposon (Transposon &&) noexcept=default | |
move constructor | |
template<class URBG > | |
void | mutate (URBG &engine) noexcept |
make one point mutation | |
void | speciate () noexcept |
modify species_ and NUM_SPECIES_ | |
void | indel () noexcept |
set has_indel_ | |
void | hyperactivate () noexcept |
set is_hyperactive_ | |
double | activity () const noexcept |
\(a_i\); count nonsynonymous mutations and return the pre-calculated ACTIVITY_ | |
double | transposition_rate () const noexcept |
\(u_i = u_0 \times a_i\) | |
uint_fast32_t | operator- (const Transposon &other) const noexcept |
Hamming distance. | |
double | operator* (const Transposon &other) const noexcept |
interaction coefficient between species More... | |
bool | is_far_enough_from (const Transposon &other) const noexcept |
check if distance is large enough for speciation | |
const DNA< NUM_NONSYNONYMOUS_SITES > & | nonsynonymous_sites () const noexcept |
getter of nonsynonymous_sites_ | |
const DNA< NUM_SYNONYMOUS_SITES > & | synonymous_sites () const noexcept |
getter of synonymous_sites_ | |
bool | has_indel () const noexcept |
getter of has_indel_ | |
uint_fast32_t | species () const noexcept |
getter of species_ | |
double | dn () const noexcept |
nonsynonymous substitution per nonsynonymous site | |
double | ds () const noexcept |
synonymous substitution per synonymous site | |
std::ostream & | write_summary (std::ostream &) const |
write summary | |
std::ostream & | write_fasta (std::ostream &) const |
write sequqnce with header in FASTA format | |
std::ostream & | write_metadata (std::ostream &) const |
write metadata for FASTA header | |
std::ostream & | write_sequence (std::ostream &) const |
write sequence | |
Static Public Member Functions | |
static bool | can_speciate () noexcept |
check if speciation is allowed under the condition | |
static void | INTERACTION_COEFS_clear () noexcept |
clear INTERACTION_COEFS_ | |
static void | INTERACTION_COEFS_emplace (uint_fast32_t x, uint_fast32_t y, double coef) noexcept |
setter of INTERACTION_COEFS_ | |
static double | INTERACTION_COEFS_get (uint_fast32_t x, uint_fast32_t y) |
getter of INTERACTION_COEFS_ | |
static std::unordered_map< uint_fast64_t, double > | INTERACTION_COEFS () noexcept |
getter of INTERACTION_COEFS_ | |
static void | write_activity (std::ostream &, double alpha, unsigned int beta) |
calculate and write activity for the given alpha and beta | |
static void | param (const param_type &p) |
Set PARAM_. | |
static const param_type & | param () |
Get PARAM_. | |
static void | initialize () |
Set PARAM_ with default values;. | |
Static Public Attributes | |
static constexpr uint_fast32_t | NUM_SYNONYMOUS_SITES = LENGTH / 3u |
number of synonymous sites | |
static constexpr uint_fast32_t | NUM_NONSYNONYMOUS_SITES = LENGTH - NUM_SYNONYMOUS_SITES |
number of nonsynonymous sites | |
static constexpr double | MAX_TRANSPOSITION_RATE = 0.01 |
\(u_0\), maximum transposition rate | |
static constexpr double | OVER_SYNONYMOUS_SITES = 1.0 / NUM_SYNONYMOUS_SITES |
resiprocal of synonymous sites | |
static constexpr double | OVER_NONSYNONYMOUS_SITES = 1.0 / NUM_NONSYNONYMOUS_SITES |
resiprocal of nonsynonymous sites | |
Static Private Member Functions | |
static double | calc_activity (uint_fast32_t num_mutations) |
Private Attributes | |
DNA< NUM_NONSYNONYMOUS_SITES > | nonsynonymous_sites_ |
nonsynonymous sites | |
DNA< NUM_SYNONYMOUS_SITES > | synonymous_sites_ |
synonymous sites | |
bool | has_indel_ = false |
activity is zero if this is true | |
bool | is_hyperactive_ = false |
activity is doubled if this is true | |
uint_fast32_t | species_ = 0 |
transposon species | |
Static Private Attributes | |
static param_type | PARAM_ |
Parameters shared among instances. | |
static double | THRESHOLD_ = 0.0 |
1 - TransposonParams::ALPHA | |
static std::array< double, NUM_NONSYNONYMOUS_SITES > | ACTIVITY_ |
pre-calculated activity values | |
static std::atomic_uint_fast32_t | NUM_SPECIES_ {1u} |
number of species; incremented by speciation | |
static std::unordered_map< uint_fast64_t, double > | INTERACTION_COEFS_ |
interaction coefficients between species | |
Friends | |
std::ostream & | operator<< (std::ostream &, const Transposon &) |
shortcut for Transposon::write_summary() | |
Transposon class.
|
staticprivate |
\[ a = \left(\frac {1 - d - \alpha} {1 - \alpha} \right)^\beta \]
|
inlinenoexcept |
interaction coefficient between species
\[ I(d) = \begin{cases} 1 & d < d_l \\ \frac {d_u - d}{d_u - d_l} & d_l \le d < d_u \\ 0 & d_u \le d \end{cases} \]