sai-pg 1.0.0__py3-none-any.whl → 1.0.1__py3-none-any.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.
- sai/utils/generators/chunk_generator.py +1 -7
- sai/utils/generators/window_generator.py +5 -4
- sai/utils/utils.py +7 -1
- {sai_pg-1.0.0.dist-info → sai_pg-1.0.1.dist-info}/METADATA +1 -1
- {sai_pg-1.0.0.dist-info → sai_pg-1.0.1.dist-info}/RECORD +9 -9
- {sai_pg-1.0.0.dist-info → sai_pg-1.0.1.dist-info}/WHEEL +0 -0
- {sai_pg-1.0.0.dist-info → sai_pg-1.0.1.dist-info}/entry_points.txt +0 -0
- {sai_pg-1.0.0.dist-info → sai_pg-1.0.1.dist-info}/licenses/LICENSE +0 -0
- {sai_pg-1.0.0.dist-info → sai_pg-1.0.1.dist-info}/top_level.txt +0 -0
@@ -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
|
-
|
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
|
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
|
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
|
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
|
170
|
+
sub_pos = tgt_pos[(tgt_pos >= start) & (tgt_pos <= end)]
|
170
171
|
|
171
172
|
yield {
|
172
173
|
"chr_name": self.chr_name,
|
sai/utils/utils.py
CHANGED
@@ -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
|
-
|
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]:
|
@@ -10,11 +10,11 @@ sai/stats/__init__.py,sha256=ZLPiBk86c9R8ZFx9y5VF7Up2v4JS8WsEMfsVNlj7nXY,724
|
|
10
10
|
sai/stats/features.py,sha256=7CI9i3csVH9sXryWGB0uLSJB6BbM9gJtA1IPN2EeT0k,11844
|
11
11
|
sai/utils/__init__.py,sha256=B3ZcC1ALSWieGHPiqXKBFQRTrnlTX4TaHc3tCx9fj0w,782
|
12
12
|
sai/utils/genomic_dataclasses.py,sha256=HBYp2dehdW_y3Pd6Un8XFMnN1Odg1EiZb9ci1syIibU,1443
|
13
|
-
sai/utils/utils.py,sha256=
|
13
|
+
sai/utils/utils.py,sha256=omWRgtc_n4FlbANbkg-Zx1hRoNgXNn14GuAZq4gD7dI,23358
|
14
14
|
sai/utils/generators/__init__.py,sha256=hpE4PUQIOZQXzdpSx7dEllecDoOfxIWXNu1-WHa_VcM,858
|
15
|
-
sai/utils/generators/chunk_generator.py,sha256=
|
15
|
+
sai/utils/generators/chunk_generator.py,sha256=1qFTcduHIaRwxuEhxRNlCRbGJbPzN3A0waMjTi52UII,4319
|
16
16
|
sai/utils/generators/data_generator.py,sha256=bVz9KPjJSL4becTsVZ-zH4i40y5UDA0JJOtzbwf5n84,1635
|
17
|
-
sai/utils/generators/window_generator.py,sha256
|
17
|
+
sai/utils/generators/window_generator.py,sha256=-3FJtdBaHMiGk85e_vyPWDYkbdCfqS2IdD_hTgpgMZg,9099
|
18
18
|
sai/utils/multiprocessing/__init__.py,sha256=mI_iVjOJschKjIcneo99utCMVjR0K3UpEjA_PMcmLm4,790
|
19
19
|
sai/utils/multiprocessing/mp_manager.py,sha256=xbgje4Fi4U9WD7eqMlUkTLKLQ9aNV_hIG7nTYvniGFk,10263
|
20
20
|
sai/utils/multiprocessing/mp_pool.py,sha256=wqgp7E7fU2MXKsv7d8kpIp40SLjqS8voxbB_FkVwczA,2273
|
@@ -22,9 +22,9 @@ sai/utils/preprocessors/__init__.py,sha256=q25uXnq4jTrIVBbl1HFv3ZgEV0d79fCMp4tTZ
|
|
22
22
|
sai/utils/preprocessors/chunk_preprocessor.py,sha256=mNmc22PmIRZZjYoyktxKSRGSGzN_e1Cyi392VxTbtWc,5204
|
23
23
|
sai/utils/preprocessors/data_preprocessor.py,sha256=XSQN_kXUfyCtIpqIf7TcqWIPcSk8kynHPH-KY9gh5VY,3595
|
24
24
|
sai/utils/preprocessors/feature_preprocessor.py,sha256=Kmc7VsO9YJcbFwWk-Jha5Rzq7gZou1pwYh93Wpd9r5o,7143
|
25
|
-
sai_pg-1.0.
|
26
|
-
sai_pg-1.0.
|
27
|
-
sai_pg-1.0.
|
28
|
-
sai_pg-1.0.
|
29
|
-
sai_pg-1.0.
|
30
|
-
sai_pg-1.0.
|
25
|
+
sai_pg-1.0.1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
26
|
+
sai_pg-1.0.1.dist-info/METADATA,sha256=zHMDzO-qsymZICEJSGn0H8o14qkrIAFoCim5sBhHlq0,1789
|
27
|
+
sai_pg-1.0.1.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
28
|
+
sai_pg-1.0.1.dist-info/entry_points.txt,sha256=uK34frE2UhEDNa5ISbGOtjF2HGAXF5uG_EgMocesEPs,42
|
29
|
+
sai_pg-1.0.1.dist-info/top_level.txt,sha256=Kvf-0z0sZYQbLuM6ta183EOzD37k3VZbRH-h7HXntR0,4
|
30
|
+
sai_pg-1.0.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|