msasim 24.9.0__tar.gz → 24.9.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of msasim might be problematic. Click here for more details.
- {msasim-24.9.0 → msasim-24.9.2}/PKG-INFO +1 -1
- {msasim-24.9.0 → msasim-24.9.2}/msasim/sailfish.py +4 -2
- {msasim-24.9.0 → msasim-24.9.2}/msasim.egg-info/PKG-INFO +1 -1
- {msasim-24.9.0 → msasim-24.9.2}/setup.py +1 -1
- {msasim-24.9.0 → msasim-24.9.2}/src/main.cpp +1 -0
- {msasim-24.9.0 → msasim-24.9.2}/src/modelFactory.cpp +1 -0
- {msasim-24.9.0 → msasim-24.9.2}/src/rateMatrixSim.cpp +12 -2
- {msasim-24.9.0 → msasim-24.9.2}/LICENSE +0 -0
- {msasim-24.9.0 → msasim-24.9.2}/README.md +0 -0
- {msasim-24.9.0 → msasim-24.9.2}/msasim/__init__.py +0 -0
- {msasim-24.9.0 → msasim-24.9.2}/msasim.egg-info/SOURCES.txt +0 -0
- {msasim-24.9.0 → msasim-24.9.2}/msasim.egg-info/dependency_links.txt +0 -0
- {msasim-24.9.0 → msasim-24.9.2}/msasim.egg-info/not-zip-safe +0 -0
- {msasim-24.9.0 → msasim-24.9.2}/msasim.egg-info/requires.txt +0 -0
- {msasim-24.9.0 → msasim-24.9.2}/msasim.egg-info/top_level.txt +0 -0
- {msasim-24.9.0 → msasim-24.9.2}/pyproject.toml +0 -0
- {msasim-24.9.0 → msasim-24.9.2}/setup.cfg +0 -0
|
@@ -467,7 +467,8 @@ class Simulator:
|
|
|
467
467
|
model: _Sailfish.modelCode,
|
|
468
468
|
model_parameters: List = None,
|
|
469
469
|
gamma_parameters_alpha : float = 1.0,
|
|
470
|
-
gamma_parameters_catergories: int = 1
|
|
470
|
+
gamma_parameters_catergories: int = 1,
|
|
471
|
+
invariant_sites_proportion: float = 0.0
|
|
471
472
|
) -> None:
|
|
472
473
|
if not model:
|
|
473
474
|
raise ValueError(f"please provide a substitution model from the the following list: {_Sailfish.modelCode}")
|
|
@@ -490,8 +491,9 @@ class Simulator:
|
|
|
490
491
|
raise ValueError(f"please provide a model parameters")
|
|
491
492
|
else:
|
|
492
493
|
self._model_factory.set_model_parameters(model_parameters)
|
|
493
|
-
|
|
494
|
+
|
|
494
495
|
self._model_factory.set_gamma_parameters(gamma_parameters_alpha, gamma_parameters_catergories)
|
|
496
|
+
self._model_factory.set_invariant_sites_proportion(invariant_sites_proportion)
|
|
495
497
|
self._simulator.init_substitution_sim(self._model_factory)
|
|
496
498
|
|
|
497
499
|
self._is_sub_model_init = True
|
|
@@ -9,7 +9,7 @@ from datetime import datetime
|
|
|
9
9
|
now = datetime.now()
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
__version__ = f"{now.year % 100}.{now.month+1}.
|
|
12
|
+
__version__ = f"{now.year % 100}.{now.month+1}.2"
|
|
13
13
|
|
|
14
14
|
# The main interface is through Pybind11Extension.
|
|
15
15
|
# * You can add cxx_std=11/14/17, and then build_ext can be removed.
|
|
@@ -123,6 +123,7 @@ PYBIND11_MODULE(_Sailfish, m) {
|
|
|
123
123
|
.def("set_replacement_model" , &modelFactory::setReplacementModel)
|
|
124
124
|
.def("set_model_parameters" , &modelFactory::setModelParameters)
|
|
125
125
|
.def("set_gamma_parameters" , &modelFactory::setGammaParameters)
|
|
126
|
+
.def("set_invariant_sites_proportion", &modelFactory::setInvariantSitesProportion)
|
|
126
127
|
.def("reset", &modelFactory::resetFactory);
|
|
127
128
|
|
|
128
129
|
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
// };
|
|
20
20
|
|
|
21
21
|
rateMatrixSim::rateMatrixSim(modelFactory& mFac, std::shared_ptr<std::vector<bool>> nodesToSave) :
|
|
22
|
-
_et(mFac.getTree()), _sp(mFac.getStochasticProcess()), _alph(mFac.getAlphabet()),
|
|
22
|
+
_et(mFac.getTree()), _sp(mFac.getStochasticProcess()), _alph(mFac.getAlphabet()),
|
|
23
|
+
_invariantSitesProportion(mFac.getInvariantSitesProportion()),
|
|
23
24
|
_cpijGam(), _rootSequence(mFac.getAlphabet()), _subManager(mFac.getTree()->getNodesNum()),
|
|
24
25
|
_nodesToSave(nodesToSave), _saveRates(false), _biased_coin(0,1) {
|
|
25
26
|
// _et = mFac.getTree();
|
|
@@ -34,8 +35,12 @@ rateMatrixSim::rateMatrixSim(modelFactory& mFac, std::shared_ptr<std::vector<boo
|
|
|
34
35
|
|
|
35
36
|
std::vector<MDOUBLE> rateProbs;
|
|
36
37
|
for (int j = 0 ; j < _sp->categories(); ++j) {
|
|
37
|
-
|
|
38
|
+
MDOUBLE currentRateProb = _sp->ratesProb(j);
|
|
39
|
+
currentRateProb = currentRateProb * (1.0 - _invariantSitesProportion);
|
|
40
|
+
rateProbs.push_back(currentRateProb);
|
|
38
41
|
}
|
|
42
|
+
if (_invariantSitesProportion > 0.0) rateProbs.push_back(_invariantSitesProportion);
|
|
43
|
+
|
|
39
44
|
_rateSampler = std::make_unique<DiscreteDistribution>(rateProbs);
|
|
40
45
|
|
|
41
46
|
std::vector<MDOUBLE> frequencies;
|
|
@@ -103,6 +108,10 @@ void rateMatrixSim::generate_substitution_log(int seqLength) {
|
|
|
103
108
|
for (int h = 0; h < seqLength; h++) {
|
|
104
109
|
int selectedRandomCategory = _rateSampler->drawSample() - 1;
|
|
105
110
|
_rateCategories[h] = selectedRandomCategory;
|
|
111
|
+
if (selectedRandomCategory == _sp->categories()) {
|
|
112
|
+
ratesVec[h] = 0.0;
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
106
115
|
ratesVec[h] = _sp->rates(selectedRandomCategory);
|
|
107
116
|
sumOfRatesAcrossSites += ratesVec[h];
|
|
108
117
|
}
|
|
@@ -149,6 +158,7 @@ void rateMatrixSim::mutateEntireSeq(tree::nodeP currentNode, int seqLength) {
|
|
|
149
158
|
|
|
150
159
|
for (size_t site = 0; site < seqLength; ++site) {
|
|
151
160
|
ALPHACHAR parentChar = _rootSequence[site];//_subManager.getCharacter(parentId, site, _rootSequence);
|
|
161
|
+
if (_rateCategories[site] == _sp->categories()) continue;
|
|
152
162
|
ALPHACHAR nextChar = _cpijGam.getRandomChar(_rateCategories[site], nodeId, parentChar);
|
|
153
163
|
if (nextChar != parentChar){
|
|
154
164
|
_subManager.handleEvent(nodeId, site, nextChar, _rateCategories, _sp.get(), _rootSequence);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|