msasim 24.10.4__cp38-cp38-macosx_11_0_arm64.whl → 24.12.0__cp38-cp38-macosx_11_0_arm64.whl

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.

Binary file
msasim/sailfish.py CHANGED
@@ -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
- probabilities = [PMF(i)/norm_factor for i in range(1, truncation+1)]
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
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: msasim
3
- Version: 24.10.4
3
+ Version: 24.12.0
4
4
  Summary: A fast MSA simulator
5
5
  Home-page: https://github.com/elyawy/Sailfish-backend
6
6
  Author: Elya Wygoda
@@ -0,0 +1,8 @@
1
+ _Sailfish.cpython-38-darwin.so,sha256=OHUmypNnIk1kN2jFIwkUl96MUzlKmmkNaiupSbgonsg,1076560
2
+ msasim-24.12.0.dist-info/RECORD,,
3
+ msasim-24.12.0.dist-info/LICENSE,sha256=p1Aa_mM2Nu6dG3XqMVU62Jhf04lNOwtXUrhhvhcDips,10312
4
+ msasim-24.12.0.dist-info/WHEEL,sha256=7_oe0rMIEoZOpgBhth1WRv0SCKz8pdiUZgyT0NjKRv8,107
5
+ msasim-24.12.0.dist-info/top_level.txt,sha256=NS1ILx5V94Yyh_M7yDrrqbBPu1TL_zJuxhsI90YEJVY,17
6
+ msasim-24.12.0.dist-info/METADATA,sha256=jVxAKL5akbzugkbsmgzPnFcQ2_kc84Pu18k0V4d1_bE,1468
7
+ msasim/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ msasim/sailfish.py,sha256=I45ufK0owZIsu7zOBN427rQ07RGl3Jll8mnGiCS0Ufo,25698
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.1.0)
2
+ Generator: setuptools (75.3.0)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp38-cp38-macosx_11_0_arm64
5
5
 
@@ -1,8 +0,0 @@
1
- _Sailfish.cpython-38-darwin.so,sha256=caVXqMAMaOwI6Dw1Xk6uOgP99ow40cFP56Mt4BdWaFw,1054112
2
- msasim/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- msasim/sailfish.py,sha256=xcSh3Q4fo-PiQVjYQgqcqCV3sJ-u32jdMhsJJAL9vHY,24896
4
- msasim-24.10.4.dist-info/RECORD,,
5
- msasim-24.10.4.dist-info/LICENSE,sha256=p1Aa_mM2Nu6dG3XqMVU62Jhf04lNOwtXUrhhvhcDips,10312
6
- msasim-24.10.4.dist-info/WHEEL,sha256=EiRgcuXdFyaNkKNNUWj3dZKym6WxDBm6glUi0Kcah-U,107
7
- msasim-24.10.4.dist-info/top_level.txt,sha256=NS1ILx5V94Yyh_M7yDrrqbBPu1TL_zJuxhsI90YEJVY,17
8
- msasim-24.10.4.dist-info/METADATA,sha256=lcUfw5rRfQ2FfAc8yEwU8I82UHWQp-r_WFW_PnsGP0U,1468