sai-pg 1.0.0__tar.gz → 1.0.1__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.
Files changed (37) hide show
  1. {sai_pg-1.0.0/sai_pg.egg-info → sai_pg-1.0.1}/PKG-INFO +1 -1
  2. {sai_pg-1.0.0 → sai_pg-1.0.1}/sai/utils/generators/chunk_generator.py +1 -7
  3. {sai_pg-1.0.0 → sai_pg-1.0.1}/sai/utils/generators/window_generator.py +5 -4
  4. {sai_pg-1.0.0 → sai_pg-1.0.1}/sai/utils/utils.py +7 -1
  5. {sai_pg-1.0.0 → sai_pg-1.0.1/sai_pg.egg-info}/PKG-INFO +1 -1
  6. {sai_pg-1.0.0 → sai_pg-1.0.1}/setup.py +1 -1
  7. {sai_pg-1.0.0 → sai_pg-1.0.1}/LICENSE +0 -0
  8. {sai_pg-1.0.0 → sai_pg-1.0.1}/README.md +0 -0
  9. {sai_pg-1.0.0 → sai_pg-1.0.1}/sai/__init__.py +0 -0
  10. {sai_pg-1.0.0 → sai_pg-1.0.1}/sai/__main__.py +0 -0
  11. {sai_pg-1.0.0 → sai_pg-1.0.1}/sai/parsers/__init__.py +0 -0
  12. {sai_pg-1.0.0 → sai_pg-1.0.1}/sai/parsers/argument_validation.py +0 -0
  13. {sai_pg-1.0.0 → sai_pg-1.0.1}/sai/parsers/outlier_parser.py +0 -0
  14. {sai_pg-1.0.0 → sai_pg-1.0.1}/sai/parsers/plot_parser.py +0 -0
  15. {sai_pg-1.0.0 → sai_pg-1.0.1}/sai/parsers/score_parser.py +0 -0
  16. {sai_pg-1.0.0 → sai_pg-1.0.1}/sai/sai.py +0 -0
  17. {sai_pg-1.0.0 → sai_pg-1.0.1}/sai/stats/__init__.py +0 -0
  18. {sai_pg-1.0.0 → sai_pg-1.0.1}/sai/stats/features.py +0 -0
  19. {sai_pg-1.0.0 → sai_pg-1.0.1}/sai/utils/__init__.py +0 -0
  20. {sai_pg-1.0.0 → sai_pg-1.0.1}/sai/utils/generators/__init__.py +0 -0
  21. {sai_pg-1.0.0 → sai_pg-1.0.1}/sai/utils/generators/data_generator.py +0 -0
  22. {sai_pg-1.0.0 → sai_pg-1.0.1}/sai/utils/genomic_dataclasses.py +0 -0
  23. {sai_pg-1.0.0 → sai_pg-1.0.1}/sai/utils/multiprocessing/__init__.py +0 -0
  24. {sai_pg-1.0.0 → sai_pg-1.0.1}/sai/utils/multiprocessing/mp_manager.py +0 -0
  25. {sai_pg-1.0.0 → sai_pg-1.0.1}/sai/utils/multiprocessing/mp_pool.py +0 -0
  26. {sai_pg-1.0.0 → sai_pg-1.0.1}/sai/utils/preprocessors/__init__.py +0 -0
  27. {sai_pg-1.0.0 → sai_pg-1.0.1}/sai/utils/preprocessors/chunk_preprocessor.py +0 -0
  28. {sai_pg-1.0.0 → sai_pg-1.0.1}/sai/utils/preprocessors/data_preprocessor.py +0 -0
  29. {sai_pg-1.0.0 → sai_pg-1.0.1}/sai/utils/preprocessors/feature_preprocessor.py +0 -0
  30. {sai_pg-1.0.0 → sai_pg-1.0.1}/sai_pg.egg-info/SOURCES.txt +0 -0
  31. {sai_pg-1.0.0 → sai_pg-1.0.1}/sai_pg.egg-info/dependency_links.txt +0 -0
  32. {sai_pg-1.0.0 → sai_pg-1.0.1}/sai_pg.egg-info/entry_points.txt +0 -0
  33. {sai_pg-1.0.0 → sai_pg-1.0.1}/sai_pg.egg-info/requires.txt +0 -0
  34. {sai_pg-1.0.0 → sai_pg-1.0.1}/sai_pg.egg-info/top_level.txt +0 -0
  35. {sai_pg-1.0.0 → sai_pg-1.0.1}/setup.cfg +0 -0
  36. {sai_pg-1.0.0 → sai_pg-1.0.1}/tests/test___main__.py +0 -0
  37. {sai_pg-1.0.0 → sai_pg-1.0.1}/tests/test_sai.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sai-pg
3
- Version: 1.0.0
3
+ Version: 1.0.1
4
4
  Summary: A Python Package for Statistics for Adaptive Introgression
5
5
  Home-page: https://github.com/xin-huang/sai
6
6
  Author: Xin Huang
@@ -131,18 +131,12 @@ class ChunkGenerator(DataGenerator):
131
131
  remainder = len(windows) % num_chunks
132
132
  result = []
133
133
  start_idx = 0
134
- prev_end = None
135
134
 
136
135
  for i in range(num_chunks):
137
136
  end_idx = start_idx + avg + (1 if i < remainder else 0)
138
137
  sub = windows[start_idx:end_idx]
139
138
  if sub:
140
- min_start = sub[0][0]
141
- max_end = sub[-1][1]
142
- if (prev_end is not None) and (min_start < prev_end):
143
- min_start = prev_end + 1
144
- result.append((min_start, max_end))
145
- prev_end = max_end
139
+ result.append((sub[0][0], sub[-1][1]))
146
140
  start_idx = end_idx
147
141
 
148
142
  return result
@@ -125,6 +125,7 @@ class WindowGenerator(DataGenerator):
125
125
  ),
126
126
  window_size=self.win_len,
127
127
  step_size=self.win_step,
128
+ start=start,
128
129
  )
129
130
  for tgt_pop in self.tgt_samples
130
131
  }
@@ -152,21 +153,21 @@ class WindowGenerator(DataGenerator):
152
153
  for start, end in self.tgt_windows[tgt_pop]:
153
154
  ref_gts = self.ref_data[ref_pop].GT[
154
155
  (self.ref_data[ref_pop].POS >= start)
155
- & (self.ref_data[ref_pop].POS < end)
156
+ & (self.ref_data[ref_pop].POS <= end)
156
157
  ]
157
158
  tgt_gts = self.tgt_data[tgt_pop].GT[
158
159
  (self.tgt_data[tgt_pop].POS >= start)
159
- & (self.tgt_data[tgt_pop].POS < end)
160
+ & (self.tgt_data[tgt_pop].POS <= end)
160
161
  ]
161
162
  src_gts_list = [
162
163
  self.src_data[src_pop].GT[
163
164
  (self.src_data[src_pop].POS >= start)
164
- & (self.src_data[src_pop].POS < end)
165
+ & (self.src_data[src_pop].POS <= end)
165
166
  ]
166
167
  for src_pop in src_comb
167
168
  ]
168
169
 
169
- sub_pos = tgt_pos[(tgt_pos >= start) & (tgt_pos < end)]
170
+ sub_pos = tgt_pos[(tgt_pos >= start) & (tgt_pos <= end)]
170
171
 
171
172
  yield {
172
173
  "chr_name": self.chr_name,
@@ -608,6 +608,7 @@ def split_genome(
608
608
  pos: np.ndarray,
609
609
  window_size: int,
610
610
  step_size: int,
611
+ start: int = None,
611
612
  ) -> list[tuple]:
612
613
  """
613
614
  Creates sliding windows along the genome based on variant positions.
@@ -620,6 +621,9 @@ def split_genome(
620
621
  Length of each sliding window.
621
622
  step_size : int
622
623
  Step size of the sliding windows.
624
+ start: int, optional
625
+ Minimum starting coordinate for the first window. The first window will start
626
+ no smaller than this value. Default is None.
623
627
 
624
628
  Returns
625
629
  -------
@@ -644,7 +648,9 @@ def split_genome(
644
648
 
645
649
  window_positions = []
646
650
  win_start = (pos[0] + step_size) // step_size * step_size - window_size + 1
647
- win_start = max(win_start, 1)
651
+ if start is None:
652
+ start = 1
653
+ win_start = max(win_start, start)
648
654
 
649
655
  # Create windows based on step size and window size
650
656
  while win_start <= pos[-1]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sai-pg
3
- Version: 1.0.0
3
+ Version: 1.0.1
4
4
  Summary: A Python Package for Statistics for Adaptive Introgression
5
5
  Home-page: https://github.com/xin-huang/sai
6
6
  Author: Xin Huang
@@ -32,7 +32,7 @@ with open(os.path.join(HERE, "README.md")) as fid:
32
32
  setup(
33
33
  name="sai-pg",
34
34
  python_requires="==3.9.19",
35
- version="1.0.0",
35
+ version="1.0.1",
36
36
  description="A Python Package for Statistics for Adaptive Introgression",
37
37
  long_description=README,
38
38
  long_description_content_type="text/markdown",
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