PGAP2 2.2__tar.gz → 2.3__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.
- {pgap2-2.2 → pgap2-2.3/PGAP2.egg-info}/PKG-INFO +1 -1
- {pgap2-2.2/PGAP2.egg-info → pgap2-2.3}/PKG-INFO +1 -1
- {pgap2-2.2 → pgap2-2.3}/pgap2/postprocess/stat.py +103 -21
- {pgap2-2.2 → pgap2-2.3}/pyproject.toml +1 -1
- pgap2-2.3/tests/test_post.py +95 -0
- pgap2-2.2/tests/test_post.py +0 -43
- {pgap2-2.2 → pgap2-2.3}/LICENSE +0 -0
- {pgap2-2.2 → pgap2-2.3}/MANIFEST.in +0 -0
- {pgap2-2.2 → pgap2-2.3}/PGAP2.egg-info/SOURCES.txt +0 -0
- {pgap2-2.2 → pgap2-2.3}/PGAP2.egg-info/dependency_links.txt +0 -0
- {pgap2-2.2 → pgap2-2.3}/PGAP2.egg-info/entry_points.txt +0 -0
- {pgap2-2.2 → pgap2-2.3}/PGAP2.egg-info/requires.txt +0 -0
- {pgap2-2.2 → pgap2-2.3}/PGAP2.egg-info/top_level.txt +0 -0
- {pgap2-2.2 → pgap2-2.3}/README.md +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/__init__.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/cli/__init__.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/cli/neighborhood.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/cli/partition.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/cli/partition_add.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/cli/partition_merge.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/cli/partition_minus.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/cli/postprocess.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/cli/preprocess.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/cli/sqlite_cmd.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/dependencies/draw_post_profile.r +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/dependencies/draw_post_stat.r +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/dependencies/draw_prep.r +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/dependencies/maskrc-svg.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/dependencies/run_fastbaps +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/lib/__init__.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/lib/basic.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/lib/panclust.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/lib/pangenome.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/lib/pangp.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/lib/phylogeny.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/lib/pklcheck.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/lib/species.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/lib/strain.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/lib/synteny.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/lib/tree.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/main.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/models/__init__.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/models/baps.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/models/base.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/models/gene_annotation.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/models/gene_cluster.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/models/gene_neighborhood.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/models/pav.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/models/phylogeny.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/models/preprocess.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/models/project.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/models/project_file.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/models/statistics.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/models/strain.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/models/tajimas_d.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/postprocess/__init__.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/postprocess/baps.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/postprocess/graph.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/postprocess/neighborhood.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/postprocess/profile.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/postprocess/reference_layout.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/postprocess/singletree.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/postprocess/tajimas_d.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/toy_input/287_91.fa +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/toy_input/287_91.gff +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/toy_input/AKU_12601.gff +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/toy_input/Readme_input.md +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/toy_input/SC_B67.gbk +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/utils/__init__.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/utils/alignment.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/utils/arrangement_detector.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/utils/data_loader.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/utils/draw.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/utils/gene_retriever.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/utils/generate_tree.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/utils/graph_utils.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/utils/neighborhood.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/utils/partition.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/utils/partition_add.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/utils/partition_merge.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/utils/partition_minus.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/utils/postprocess.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/utils/preprocess.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/utils/sqlite_builder.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/utils/supply.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/pgap2/utils/tools.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/setup.cfg +0 -0
- {pgap2-2.2 → pgap2-2.3}/tests/test_main.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/tests/test_pangenome.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/tests/test_prep.py +0 -0
- {pgap2-2.2 → pgap2-2.3}/tests/test_synteny.py +0 -0
|
@@ -55,6 +55,40 @@ def core_gene_model(x, C0, a, C_inf):
|
|
|
55
55
|
def pan_gene_model(x, k, gamma):
|
|
56
56
|
return k * x**gamma
|
|
57
57
|
|
|
58
|
+
#make sure that only finite values are used in the fitting process.
|
|
59
|
+
def _drop_invalid_fit_points(x_data, y_data):
|
|
60
|
+
x_data = np.asarray(x_data, dtype=float)
|
|
61
|
+
y_data = np.asarray(y_data, dtype=float)
|
|
62
|
+
valid_points = np.isfinite(x_data) & np.isfinite(y_data)
|
|
63
|
+
return x_data[valid_points], y_data[valid_points]
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def _get_core_fit_initial_params(core_gene_means):
|
|
67
|
+
if len(core_gene_means) == 0:
|
|
68
|
+
raise ValueError("No valid core gene points are available for curve fitting.")
|
|
69
|
+
C_inf = max(float(core_gene_means[-1]), 0.0)
|
|
70
|
+
C0 = max(float(core_gene_means[0]) - C_inf, 0.0)
|
|
71
|
+
return [C0, 0.05, C_inf]
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def _get_pan_fit_initial_params(pan_gene_means):
|
|
75
|
+
if len(pan_gene_means) == 0:
|
|
76
|
+
raise ValueError("No valid pan gene points are available for curve fitting.")
|
|
77
|
+
k = max(float(pan_gene_means[0]), 0.0)
|
|
78
|
+
return [k, 0.5]
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def _fit_pan_gene_loglog(x_data, pan_gene_means):
|
|
82
|
+
positive_points = (x_data > 0) & (pan_gene_means > 0)
|
|
83
|
+
if np.count_nonzero(positive_points) < 2:
|
|
84
|
+
raise RuntimeError(
|
|
85
|
+
"At least two positive points are required for log-log pan gene fitting.")
|
|
86
|
+
|
|
87
|
+
gamma, log_k = np.polyfit(
|
|
88
|
+
np.log(x_data[positive_points]), np.log(pan_gene_means[positive_points]), 1)
|
|
89
|
+
k = np.exp(log_k)
|
|
90
|
+
return np.asarray([k, gamma], dtype=float)
|
|
91
|
+
|
|
58
92
|
|
|
59
93
|
def stat_pan_core(sampling_list, pav, i_strain, strain_num):
|
|
60
94
|
core_list = []
|
|
@@ -122,7 +156,7 @@ def log_pan_genome_state(popt_pan, ofh):
|
|
|
122
156
|
|
|
123
157
|
def fit_rerefaction(pan_rarefaction, outdir):
|
|
124
158
|
|
|
125
|
-
x_data = pan_rarefaction[0]
|
|
159
|
+
x_data = np.asarray(pan_rarefaction[0], dtype=float)
|
|
126
160
|
core_gene_samples = pan_rarefaction[1]
|
|
127
161
|
pan_gene_samples = pan_rarefaction[2]
|
|
128
162
|
|
|
@@ -134,27 +168,75 @@ def fit_rerefaction(pan_rarefaction, outdir):
|
|
|
134
168
|
pan_gene_samples[i] = [
|
|
135
169
|
int(_) for _ in pan_gene_samples[i] if _ != 'NA']
|
|
136
170
|
|
|
137
|
-
core_gene_means =
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
171
|
+
core_gene_means = np.asarray(
|
|
172
|
+
[np.mean(samples) for samples in core_gene_samples], dtype=float)
|
|
173
|
+
pan_gene_means = np.asarray(
|
|
174
|
+
[np.mean(samples) for samples in pan_gene_samples], dtype=float)
|
|
175
|
+
|
|
176
|
+
core_x_data, core_gene_means = _drop_invalid_fit_points(
|
|
177
|
+
x_data, core_gene_means)
|
|
178
|
+
pan_x_data, pan_gene_means = _drop_invalid_fit_points(
|
|
179
|
+
x_data, pan_gene_means)
|
|
180
|
+
|
|
181
|
+
with open(file=f'{outdir}/postprocess.curve_fit.txt', mode='w') as ofh:
|
|
182
|
+
|
|
183
|
+
logger.info("Fitting core gene data.")
|
|
184
|
+
try:
|
|
185
|
+
popt_core, _ = curve_fit(
|
|
186
|
+
core_gene_model,
|
|
187
|
+
core_x_data,
|
|
188
|
+
core_gene_means,
|
|
189
|
+
p0=_get_core_fit_initial_params(core_gene_means),
|
|
190
|
+
bounds=([0, 0, 0], [np.inf, np.inf, np.inf]),
|
|
191
|
+
maxfev=10000,
|
|
192
|
+
)
|
|
193
|
+
logger.info(f"Optimal parameters for core genes: {popt_core}")
|
|
194
|
+
ofh.write(f'Optimal parameters for core genes: {popt_core}\n')
|
|
195
|
+
except (RuntimeError, ValueError) as err:
|
|
196
|
+
popt_core = None
|
|
197
|
+
logger.warning(f"Core gene curve fitting failed: {err}")
|
|
198
|
+
ofh.write('Optimal parameters for core genes: NA\n')
|
|
199
|
+
|
|
200
|
+
logger.info("Fitting pan gene data.")
|
|
201
|
+
try:
|
|
202
|
+
popt_pan, _ = curve_fit(
|
|
203
|
+
pan_gene_model,
|
|
204
|
+
pan_x_data,
|
|
205
|
+
pan_gene_means,
|
|
206
|
+
p0=_get_pan_fit_initial_params(pan_gene_means),
|
|
207
|
+
bounds=([0, 0], [np.inf, np.inf]),
|
|
208
|
+
maxfev=10000,
|
|
209
|
+
)
|
|
210
|
+
logger.info(f"Optimal parameters for pan genes: {popt_pan}")
|
|
211
|
+
ofh.write(f'Optimal parameters for pan genes: {popt_pan}\n')
|
|
212
|
+
except (RuntimeError, ValueError) as err:
|
|
213
|
+
logger.warning(
|
|
214
|
+
f"Pan gene curve fitting failed with curve_fit: {err}. Trying log-log fallback.")
|
|
215
|
+
try:
|
|
216
|
+
popt_pan = _fit_pan_gene_loglog(pan_x_data, pan_gene_means)
|
|
217
|
+
logger.info(
|
|
218
|
+
f"Optimal parameters for pan genes from log-log fallback: {popt_pan}")
|
|
219
|
+
ofh.write(
|
|
220
|
+
f'Optimal parameters for pan genes: {popt_pan} (log-log fallback)\n')
|
|
221
|
+
except (RuntimeError, ValueError) as fallback_err:
|
|
222
|
+
popt_pan = None
|
|
223
|
+
logger.warning(
|
|
224
|
+
f"Pan gene log-log fallback fitting failed: {fallback_err}")
|
|
225
|
+
ofh.write('Optimal parameters for pan genes: NA\n')
|
|
226
|
+
|
|
227
|
+
if popt_core is None:
|
|
228
|
+
ofh.write('Core Gene Fit: NA\n')
|
|
229
|
+
else:
|
|
230
|
+
ofh.write(
|
|
231
|
+
f'Core Gene Fit: y={popt_core[0]:.3f}*exp(-{popt_core[1]:.3f}*x)+ {popt_core[2]:.3f}\n')
|
|
147
232
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
ofh.write(
|
|
156
|
-
f'Pan Gene Fit: y={popt_pan[0]:.3f}*x^{popt_pan[1]:.3f} \n')
|
|
157
|
-
log_pan_genome_state(popt_pan, ofh)
|
|
233
|
+
if popt_pan is None:
|
|
234
|
+
ofh.write('Pan Gene Fit: NA\n')
|
|
235
|
+
ofh.write('Pan-genome state: NA\n')
|
|
236
|
+
else:
|
|
237
|
+
ofh.write(
|
|
238
|
+
f'Pan Gene Fit: y={popt_pan[0]:.3f}*x^{popt_pan[1]:.3f} \n')
|
|
239
|
+
log_pan_genome_state(popt_pan, ofh)
|
|
158
240
|
|
|
159
241
|
# plt.figure(figsize=(8, 6))
|
|
160
242
|
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
import numpy as np
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@pytest.fixture
|
|
6
|
+
def test_basic():
|
|
7
|
+
basic_file = 'tests/output/basic.pkl'
|
|
8
|
+
from pgap2.lib.pklcheck import PklCheck
|
|
9
|
+
from pgap2.lib.basic import Basic
|
|
10
|
+
import pickle
|
|
11
|
+
|
|
12
|
+
with open(f'{basic_file}', 'rb') as fh:
|
|
13
|
+
previous: PklCheck = pickle.load(fh)
|
|
14
|
+
decode_status = previous.decode()
|
|
15
|
+
assert decode_status is True, "decode did not return True for matching parameters"
|
|
16
|
+
basic: Basic = previous.data_dump('basic')
|
|
17
|
+
assert isinstance(
|
|
18
|
+
basic, Basic), "Basic object was not created correctly"
|
|
19
|
+
return basic
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def test_get_pan_group(test_basic):
|
|
23
|
+
from pgap2.postprocess.stat import get_pan_group
|
|
24
|
+
basic = test_basic
|
|
25
|
+
outdir = 'tests/output'
|
|
26
|
+
basic.load_pav(file=f'{outdir}/pgap2.partition.gene_content.pav')
|
|
27
|
+
pan_group_freq, pan_para_stat = get_pan_group(basic.pav, outdir)
|
|
28
|
+
assert len(
|
|
29
|
+
pan_group_freq) == 3, "get_pan_group did not return the expected number of groups"
|
|
30
|
+
assert len(
|
|
31
|
+
pan_para_stat) == 5, "get_pan_group did not return the expected number of parameters"
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def test_rare(test_basic):
|
|
35
|
+
from pgap2.postprocess.stat import get_rarefaction, fit_rerefaction
|
|
36
|
+
basic = test_basic
|
|
37
|
+
outdir = 'tests/output/'
|
|
38
|
+
basic.load_pav(file=f'{outdir}/pgap2.partition.gene_content.pav')
|
|
39
|
+
pan_profile, new_clusters = get_rarefaction(
|
|
40
|
+
basic.pav, outdir, N=1)
|
|
41
|
+
assert len(
|
|
42
|
+
pan_profile) == 3, "get_rarefaction did not return the expected number of profiles"
|
|
43
|
+
assert len(
|
|
44
|
+
new_clusters) == 2, "get_rarefaction did not return the expected number of clusters"
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def test_fit_rarefaction_keeps_running_when_core_fit_fails(tmp_path, monkeypatch):
|
|
48
|
+
from pgap2.postprocess import stat
|
|
49
|
+
|
|
50
|
+
pan_profile = [
|
|
51
|
+
[1, 2, 3, 4],
|
|
52
|
+
[[3000], [2500], [2300], [2200]],
|
|
53
|
+
[[4000], [4500], [4800], [5100]],
|
|
54
|
+
]
|
|
55
|
+
original_curve_fit = stat.curve_fit
|
|
56
|
+
|
|
57
|
+
def fail_core_fit(model, *args, **kwargs):
|
|
58
|
+
if model is stat.core_gene_model:
|
|
59
|
+
raise RuntimeError("forced core failure")
|
|
60
|
+
return original_curve_fit(model, *args, **kwargs)
|
|
61
|
+
|
|
62
|
+
monkeypatch.setattr(stat, "curve_fit", fail_core_fit)
|
|
63
|
+
|
|
64
|
+
stat.fit_rerefaction(pan_profile, tmp_path)
|
|
65
|
+
|
|
66
|
+
content = (tmp_path / "postprocess.curve_fit.txt").read_text()
|
|
67
|
+
assert "Optimal parameters for core genes: NA" in content
|
|
68
|
+
assert "Pan Gene Fit: y=" in content
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def test_fit_rarefaction_uses_pan_loglog_fallback(tmp_path, monkeypatch):
|
|
72
|
+
from pgap2.postprocess import stat
|
|
73
|
+
|
|
74
|
+
pan_profile = [
|
|
75
|
+
[1, 2, 4, 8],
|
|
76
|
+
[[3000], [2500], [2300], [2200]],
|
|
77
|
+
[[1000], [1414], [2000], [2828]],
|
|
78
|
+
]
|
|
79
|
+
|
|
80
|
+
def fail_pan_fit(model, *args, **kwargs):
|
|
81
|
+
if model is stat.pan_gene_model:
|
|
82
|
+
raise RuntimeError("forced pan failure")
|
|
83
|
+
return (
|
|
84
|
+
np.asarray([800.0, 0.1, 2200.0], dtype=float),
|
|
85
|
+
np.eye(3),
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
monkeypatch.setattr(stat, "curve_fit", fail_pan_fit)
|
|
89
|
+
|
|
90
|
+
stat.fit_rerefaction(pan_profile, tmp_path)
|
|
91
|
+
|
|
92
|
+
content = (tmp_path / "postprocess.curve_fit.txt").read_text()
|
|
93
|
+
assert "Optimal parameters for pan genes:" in content
|
|
94
|
+
assert "log-log fallback" in content
|
|
95
|
+
assert "Pan Gene Fit: y=" in content
|
pgap2-2.2/tests/test_post.py
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import pytest
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
@pytest.fixture
|
|
5
|
-
def test_basic():
|
|
6
|
-
basic_file = 'tests/output/basic.pkl'
|
|
7
|
-
from pgap2.lib.pklcheck import PklCheck
|
|
8
|
-
from pgap2.lib.basic import Basic
|
|
9
|
-
import pickle
|
|
10
|
-
|
|
11
|
-
with open(f'{basic_file}', 'rb') as fh:
|
|
12
|
-
previous: PklCheck = pickle.load(fh)
|
|
13
|
-
decode_status = previous.decode()
|
|
14
|
-
assert decode_status is True, "decode did not return True for matching parameters"
|
|
15
|
-
basic: Basic = previous.data_dump('basic')
|
|
16
|
-
assert isinstance(
|
|
17
|
-
basic, Basic), "Basic object was not created correctly"
|
|
18
|
-
return basic
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def test_get_pan_group(test_basic):
|
|
22
|
-
from pgap2.postprocess.stat import get_pan_group
|
|
23
|
-
basic = test_basic
|
|
24
|
-
outdir = 'tests/output'
|
|
25
|
-
basic.load_pav(file=f'{outdir}/pgap2.partition.gene_content.pav')
|
|
26
|
-
pan_group_freq, pan_para_stat = get_pan_group(basic.pav, outdir)
|
|
27
|
-
assert len(
|
|
28
|
-
pan_group_freq) == 3, "get_pan_group did not return the expected number of groups"
|
|
29
|
-
assert len(
|
|
30
|
-
pan_para_stat) == 5, "get_pan_group did not return the expected number of parameters"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
def test_rare(test_basic):
|
|
34
|
-
from pgap2.postprocess.stat import get_rarefaction, fit_rerefaction
|
|
35
|
-
basic = test_basic
|
|
36
|
-
outdir = 'tests/output/'
|
|
37
|
-
basic.load_pav(file=f'{outdir}/pgap2.partition.gene_content.pav')
|
|
38
|
-
pan_profile, new_clusters = get_rarefaction(
|
|
39
|
-
basic.pav, outdir, N=1)
|
|
40
|
-
assert len(
|
|
41
|
-
pan_profile) == 3, "get_rarefaction did not return the expected number of profiles"
|
|
42
|
-
assert len(
|
|
43
|
-
new_clusters) == 2, "get_rarefaction did not return the expected number of clusters"
|
{pgap2-2.2 → pgap2-2.3}/LICENSE
RENAMED
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|