msasim 24.12.0__tar.gz → 24.13.0__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.12.0 → msasim-24.13.0}/PKG-INFO +1 -1
- {msasim-24.12.0 → msasim-24.13.0}/msasim/sailfish.py +7 -4
- {msasim-24.12.0 → msasim-24.13.0}/msasim.egg-info/PKG-INFO +1 -1
- {msasim-24.12.0 → msasim-24.13.0}/src/main.cpp +2 -0
- {msasim-24.12.0 → msasim-24.13.0}/src/modelFactory.cpp +25 -1
- {msasim-24.12.0 → msasim-24.13.0}/LICENSE +0 -0
- {msasim-24.12.0 → msasim-24.13.0}/README.md +0 -0
- {msasim-24.12.0 → msasim-24.13.0}/msasim/__init__.py +0 -0
- {msasim-24.12.0 → msasim-24.13.0}/msasim.egg-info/SOURCES.txt +0 -0
- {msasim-24.12.0 → msasim-24.13.0}/msasim.egg-info/dependency_links.txt +0 -0
- {msasim-24.12.0 → msasim-24.13.0}/msasim.egg-info/not-zip-safe +0 -0
- {msasim-24.12.0 → msasim-24.13.0}/msasim.egg-info/requires.txt +0 -0
- {msasim-24.12.0 → msasim-24.13.0}/msasim.egg-info/top_level.txt +0 -0
- {msasim-24.12.0 → msasim-24.13.0}/pyproject.toml +0 -0
- {msasim-24.12.0 → msasim-24.13.0}/setup.cfg +0 -0
- {msasim-24.12.0 → msasim-24.13.0}/setup.py +0 -0
- {msasim-24.12.0 → msasim-24.13.0}/src/rateMatrixSim.cpp +0 -0
|
@@ -462,15 +462,16 @@ class Simulator:
|
|
|
462
462
|
def set_replacement_model(
|
|
463
463
|
self,
|
|
464
464
|
model: _Sailfish.modelCode,
|
|
465
|
+
amino_model_file: pathlib.Path = None,
|
|
465
466
|
model_parameters: List = None,
|
|
466
467
|
gamma_parameters_alpha : float = 1.0,
|
|
467
|
-
|
|
468
|
+
gamma_parameters_categories: int = 1,
|
|
468
469
|
invariant_sites_proportion: float = 0.0
|
|
469
470
|
) -> None:
|
|
470
471
|
if not model:
|
|
471
472
|
raise ValueError(f"please provide a substitution model from the the following list: {_Sailfish.modelCode}")
|
|
472
|
-
if int(
|
|
473
|
-
raise ValueError(f"gamma_parameters_catergories has to be a positive int value: received value of {
|
|
473
|
+
if int(gamma_parameters_categories) != gamma_parameters_categories:
|
|
474
|
+
raise ValueError(f"gamma_parameters_catergories has to be a positive int value: received value of {gamma_parameters_categories}")
|
|
474
475
|
self._model_factory = _Sailfish.modelFactory(self._simProtocol._get_Sailfish_tree())
|
|
475
476
|
|
|
476
477
|
self._model_factory.set_alphabet(self._alphabet)
|
|
@@ -478,6 +479,8 @@ class Simulator:
|
|
|
478
479
|
if model_parameters:
|
|
479
480
|
raise ValueError(f"no model parameters are used in protein, recevied value of: {model_parameters}")
|
|
480
481
|
self._model_factory.set_replacement_model(model)
|
|
482
|
+
if model == MODEL_CODES.CUSTOM and amino_model_file:
|
|
483
|
+
self._model_factory.set_amino_replacement_model_file(str(amino_model_file))
|
|
481
484
|
else:
|
|
482
485
|
if model == MODEL_CODES.NUCJC and model_parameters:
|
|
483
486
|
raise ValueError(f"no model parameters in JC model, recevied value of: {model_parameters}")
|
|
@@ -489,7 +492,7 @@ class Simulator:
|
|
|
489
492
|
else:
|
|
490
493
|
self._model_factory.set_model_parameters(model_parameters)
|
|
491
494
|
|
|
492
|
-
self._model_factory.set_gamma_parameters(gamma_parameters_alpha,
|
|
495
|
+
self._model_factory.set_gamma_parameters(gamma_parameters_alpha, gamma_parameters_categories)
|
|
493
496
|
self._model_factory.set_invariant_sites_proportion(invariant_sites_proportion)
|
|
494
497
|
self._simulator.init_substitution_sim(self._model_factory)
|
|
495
498
|
|
|
@@ -113,6 +113,7 @@ PYBIND11_MODULE(_Sailfish, m) {
|
|
|
113
113
|
.value("EX_EHO_EXP_EXT", modelCode::EX_EHO_EXP_EXT)
|
|
114
114
|
.value("EX_EHO_EXP_HEL", modelCode::EX_EHO_EXP_HEL)
|
|
115
115
|
.value("EX_EHO_EXP_OTH", modelCode::EX_EHO_EXP_OTH)
|
|
116
|
+
.value("CUSTOM", modelCode::CUSTOM)
|
|
116
117
|
.export_values();
|
|
117
118
|
|
|
118
119
|
|
|
@@ -121,6 +122,7 @@ PYBIND11_MODULE(_Sailfish, m) {
|
|
|
121
122
|
.def(py::init<tree*>())
|
|
122
123
|
.def("set_alphabet", &modelFactory::setAlphabet)
|
|
123
124
|
.def("set_replacement_model" , &modelFactory::setReplacementModel)
|
|
125
|
+
.def("set_amino_replacement_model_file" , &modelFactory::setCustomAAModelFile)
|
|
124
126
|
.def("set_model_parameters" , &modelFactory::setModelParameters)
|
|
125
127
|
.def("set_gamma_parameters" , &modelFactory::setGammaParameters)
|
|
126
128
|
.def("set_invariant_sites_proportion", &modelFactory::setInvariantSitesProportion)
|
|
@@ -30,7 +30,7 @@ void modelFactory::setReplacementModel(modelCode model) {
|
|
|
30
30
|
_state = factoryState::PARAMETERS;
|
|
31
31
|
if (_alphabet == alphabetCode::AMINOACID) _state = factoryState::GAMMA;
|
|
32
32
|
if (_model == modelCode::AAJC || _model == modelCode::NUCJC) _state = factoryState::GAMMA;
|
|
33
|
-
|
|
33
|
+
if (_model == modelCode::CUSTOM) _state = factoryState::MODEL_FILE;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
void modelFactory::setModelParameters(std::vector<MDOUBLE> params) {
|
|
@@ -63,6 +63,15 @@ void modelFactory::setModelParameters(std::vector<MDOUBLE> params) {
|
|
|
63
63
|
_state = factoryState::GAMMA;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
void modelFactory::setCustomAAModelFile(const std::string &fileName) {
|
|
67
|
+
if (_state!=factoryState::MODEL_FILE) {
|
|
68
|
+
std::cout << "Please set the model to 'CUSTOM' before proceeding.\n";
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
_modelFilePath = fileName;
|
|
72
|
+
_state = factoryState::GAMMA;
|
|
73
|
+
}
|
|
74
|
+
|
|
66
75
|
void modelFactory::setGammaParameters(MDOUBLE alpha, size_t numCategories) {
|
|
67
76
|
if (_state!=factoryState::GAMMA) {
|
|
68
77
|
std::cout << "Please specify a model and its correct parameters before proceeding.\n";
|
|
@@ -184,6 +193,21 @@ std::shared_ptr<stochasticProcess> modelFactory::getStochasticProcess() {
|
|
|
184
193
|
case modelCode::EX_EHO_EXP_OTH:
|
|
185
194
|
repModel = std::make_unique<pupAll>(datMatrixHolder::EX_EHO_EXP_OTH);
|
|
186
195
|
break;
|
|
196
|
+
case modelCode::CUSTOM:
|
|
197
|
+
std::ifstream in(_modelFilePath);
|
|
198
|
+
if (!in.is_open()) throw std::runtime_error("Could not open file");
|
|
199
|
+
std::stringstream contents;
|
|
200
|
+
char buffer;
|
|
201
|
+
while (in.get(buffer)) {
|
|
202
|
+
if (buffer == '\"' || buffer == '\n') continue;
|
|
203
|
+
contents << buffer;
|
|
204
|
+
}
|
|
205
|
+
in.close();
|
|
206
|
+
const std::string &tmpstr = contents.str();
|
|
207
|
+
const char* cstr = tmpstr.c_str();
|
|
208
|
+
datMatrixString aminoFileString(cstr);
|
|
209
|
+
repModel = std::make_unique<pupAll>(aminoFileString);
|
|
210
|
+
break;
|
|
187
211
|
}
|
|
188
212
|
|
|
189
213
|
std::unique_ptr<pijAccelerator> pij;
|
|
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
|
|
File without changes
|
|
File without changes
|