msasim 24.10.4__tar.gz → 24.12.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.10.4 → msasim-24.12.0}/PKG-INFO +1 -1
- {msasim-24.10.4 → msasim-24.12.0}/msasim/sailfish.py +23 -6
- {msasim-24.10.4 → msasim-24.12.0}/msasim.egg-info/PKG-INFO +1 -1
- {msasim-24.10.4 → msasim-24.12.0}/setup.py +1 -1
- {msasim-24.10.4 → msasim-24.12.0}/src/main.cpp +3 -0
- {msasim-24.10.4 → msasim-24.12.0}/LICENSE +0 -0
- {msasim-24.10.4 → msasim-24.12.0}/README.md +0 -0
- {msasim-24.10.4 → msasim-24.12.0}/msasim/__init__.py +0 -0
- {msasim-24.10.4 → msasim-24.12.0}/msasim.egg-info/SOURCES.txt +0 -0
- {msasim-24.10.4 → msasim-24.12.0}/msasim.egg-info/dependency_links.txt +0 -0
- {msasim-24.10.4 → msasim-24.12.0}/msasim.egg-info/not-zip-safe +0 -0
- {msasim-24.10.4 → msasim-24.12.0}/msasim.egg-info/requires.txt +0 -0
- {msasim-24.10.4 → msasim-24.12.0}/msasim.egg-info/top_level.txt +0 -0
- {msasim-24.10.4 → msasim-24.12.0}/pyproject.toml +0 -0
- {msasim-24.10.4 → msasim-24.12.0}/setup.cfg +0 -0
- {msasim-24.10.4 → msasim-24.12.0}/src/modelFactory.cpp +0 -0
- {msasim-24.10.4 → msasim-24.12.0}/src/rateMatrixSim.cpp +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _Sailfish
|
|
2
|
-
import os, warnings, math, operator, time, profile
|
|
2
|
+
import os, warnings, math, operator, time, profile, tempfile, pathlib
|
|
3
3
|
from functools import reduce
|
|
4
4
|
from typing import List, Optional, Dict
|
|
5
5
|
from re import split
|
|
@@ -101,12 +101,9 @@ class ZipfDistribution(Distribution):
|
|
|
101
101
|
"""
|
|
102
102
|
self.p = p
|
|
103
103
|
self.truncation = truncation
|
|
104
|
-
HARMONIC = lambda n,s: sum([(i**-s) for i in range(1,n+1)])
|
|
105
|
-
PMF = lambda x: (x**-p)*(1.0/HARMONIC(truncation, p))
|
|
106
|
-
CDF = lambda x: HARMONIC(x, p) / HARMONIC(truncation, p)
|
|
107
|
-
norm_factor = CDF(truncation) - CDF(0)
|
|
108
104
|
|
|
109
|
-
|
|
105
|
+
norm_factor = sum([(i**-p) for i in range(1,truncation+1)])
|
|
106
|
+
probabilities = [(i**-p)/norm_factor for i in range(1, truncation+1)]
|
|
110
107
|
|
|
111
108
|
self.set_dist(probabilities)
|
|
112
109
|
|
|
@@ -537,6 +534,26 @@ class Simulator:
|
|
|
537
534
|
Msas.append(msa)
|
|
538
535
|
return Msas
|
|
539
536
|
|
|
537
|
+
def simulate_low_memory(self, output_file_path: pathlib.Path) -> Msa:
|
|
538
|
+
if self._simProtocol._is_insertion_rate_zero and self._simProtocol._is_deletion_rate_zero:
|
|
539
|
+
msa = Msa(sum(self.get_sequences_to_save()),
|
|
540
|
+
self._simProtocol.get_sequence_size(),
|
|
541
|
+
self.get_sequences_to_save())
|
|
542
|
+
else:
|
|
543
|
+
blocktree = self.gen_indels()
|
|
544
|
+
msa = Msa(blocktree._get_Sailfish_blocks(),
|
|
545
|
+
self._simProtocol._get_root(),
|
|
546
|
+
self.get_sequences_to_save())
|
|
547
|
+
|
|
548
|
+
# sim.init_substitution_sim(mFac)
|
|
549
|
+
if self._simulation_type != SIMULATION_TYPE.NOSUBS:
|
|
550
|
+
with tempfile.TemporaryDirectory() as tmpdirname:
|
|
551
|
+
self._simulator.gen_substitutions_to_dir(msa.get_length(), tmpdirname)
|
|
552
|
+
msa._msa.set_substitutions_folder(tmpdirname)
|
|
553
|
+
msa._msa.write_msa_from_dir(str(output_file_path))
|
|
554
|
+
|
|
555
|
+
|
|
556
|
+
|
|
540
557
|
def __call__(self) -> Msa:
|
|
541
558
|
return self.simulate(1)[0]
|
|
542
559
|
|
|
@@ -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}.0"
|
|
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.
|
|
@@ -134,6 +134,7 @@ PYBIND11_MODULE(_Sailfish, m) {
|
|
|
134
134
|
.def("run_sim", &Simulator::runSimulator)
|
|
135
135
|
.def("init_substitution_sim", &Simulator::initSubstitionSim)
|
|
136
136
|
.def("gen_substitutions", &Simulator::simulateSubstitutions)
|
|
137
|
+
.def("gen_substitutions_to_dir", &Simulator::simulateAndWriteSubstitutions)
|
|
137
138
|
.def("save_site_rates", &Simulator::setSaveRates)
|
|
138
139
|
.def("get_site_rates", &Simulator::getSiteRates)
|
|
139
140
|
.def("save_all_nodes_sequences", &Simulator::setSaveAllNodes)
|
|
@@ -148,9 +149,11 @@ PYBIND11_MODULE(_Sailfish, m) {
|
|
|
148
149
|
.def("length", &MSA::getMSAlength)
|
|
149
150
|
.def("num_sequences", &MSA::getNumberOfSequences)
|
|
150
151
|
.def("fill_substitutions", &MSA::fillSubstitutions)
|
|
152
|
+
.def("set_substitutions_folder", &MSA::setSubstitutionsFolder)
|
|
151
153
|
.def("print_msa", &MSA::printFullMsa)
|
|
152
154
|
.def("print_indels", &MSA::printIndels)
|
|
153
155
|
.def("write_msa", &MSA::writeFullMsa)
|
|
156
|
+
.def("write_msa_from_dir", &MSA::writeMsaFromDir)
|
|
154
157
|
.def("get_msa_string", &MSA::generateMsaString)
|
|
155
158
|
.def("get_msa", &MSA::getMSAVec);
|
|
156
159
|
|
|
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
|