|
11 | 11 | from malariagen_data import ag3 as _ag3 |
12 | 12 | from malariagen_data.anoph.cnv_frq import AnophelesCnvFrequencyAnalysis |
13 | 13 | from malariagen_data.util import compare_series_like |
| 14 | +from .test_frq import ( |
| 15 | + test_plot_frequencies_heatmap, |
| 16 | + test_plot_frequencies_time_series, |
| 17 | + test_plot_frequencies_time_series_with_taxa, |
| 18 | + test_plot_frequencies_time_series_with_areas, |
| 19 | + test_plot_frequencies_interactive_map, |
| 20 | +) |
14 | 21 |
|
15 | 22 |
|
16 | 23 | @pytest.fixture |
@@ -109,6 +116,8 @@ def test_gene_cnv_frequencies_with_str_cohorts( |
109 | 116 | # Run the function under test. |
110 | 117 | df_cnv = api.gene_cnv_frequencies(**params) |
111 | 118 |
|
| 119 | + test_plot_frequencies_heatmap(api, df_cnv) |
| 120 | + |
112 | 121 | # Figure out expected cohort labels. |
113 | 122 | df_samples = api.sample_metadata(sample_sets=sample_sets) |
114 | 123 | if "cohort_" + cohorts in df_samples: |
@@ -166,12 +175,14 @@ def test_gene_cnv_frequencies_with_min_cohort_size( |
166 | 175 | return |
167 | 176 |
|
168 | 177 | # Run the function under test. |
169 | | - df_snp = api.gene_cnv_frequencies(**params) |
| 178 | + df_cnv = api.gene_cnv_frequencies(**params) |
| 179 | + |
| 180 | + test_plot_frequencies_heatmap(api, df_cnv) |
170 | 181 |
|
171 | 182 | # Standard checks. |
172 | 183 | check_gene_cnv_frequencies( |
173 | 184 | api=api, |
174 | | - df=df_snp, |
| 185 | + df=df_cnv, |
175 | 186 | cohort_labels=cohort_labels, |
176 | 187 | region=region, |
177 | 188 | ) |
@@ -212,12 +223,14 @@ def test_gene_cnv_frequencies_with_str_cohorts_and_sample_query( |
212 | 223 | ) |
213 | 224 |
|
214 | 225 | # Run the function under test. |
215 | | - df_snp = api.gene_cnv_frequencies(**params) |
| 226 | + df_cnv = api.gene_cnv_frequencies(**params) |
| 227 | + |
| 228 | + test_plot_frequencies_heatmap(api, df_cnv) |
216 | 229 |
|
217 | 230 | # Standard checks. |
218 | 231 | check_gene_cnv_frequencies( |
219 | 232 | api=api, |
220 | | - df=df_snp, |
| 233 | + df=df_cnv, |
221 | 234 | cohort_labels=cohort_labels, |
222 | 235 | region=region, |
223 | 236 | ) |
@@ -268,12 +281,14 @@ def test_gene_cnv_frequencies_with_str_cohorts_and_sample_query_options( |
268 | 281 | ) |
269 | 282 |
|
270 | 283 | # Run the function under test. |
271 | | - df_snp = api.gene_cnv_frequencies(**params) |
| 284 | + df_cnv = api.gene_cnv_frequencies(**params) |
| 285 | + |
| 286 | + test_plot_frequencies_heatmap(api, df_cnv) |
272 | 287 |
|
273 | 288 | # Standard checks. |
274 | 289 | check_gene_cnv_frequencies( |
275 | 290 | api=api, |
276 | | - df=df_snp, |
| 291 | + df=df_cnv, |
277 | 292 | cohort_labels=cohort_labels, |
278 | 293 | region=region, |
279 | 294 | ) |
@@ -305,12 +320,14 @@ def test_gene_cnv_frequencies_with_dict_cohorts( |
305 | 320 | ) |
306 | 321 |
|
307 | 322 | # Run the function under test. |
308 | | - df_snp = api.gene_cnv_frequencies(**params) |
| 323 | + df_cnv = api.gene_cnv_frequencies(**params) |
| 324 | + |
| 325 | + test_plot_frequencies_heatmap(api, df_cnv) |
309 | 326 |
|
310 | 327 | # Standard checks. |
311 | 328 | check_gene_cnv_frequencies( |
312 | 329 | api=api, |
313 | | - df=df_snp, |
| 330 | + df=df_cnv, |
314 | 331 | cohort_labels=cohort_labels, |
315 | 332 | region=region, |
316 | 333 | ) |
@@ -350,6 +367,9 @@ def test_gene_cnv_frequencies_without_drop_invariant( |
350 | 367 | df_cnv_a = api.gene_cnv_frequencies(drop_invariant=True, **params) |
351 | 368 | df_cnv_b = api.gene_cnv_frequencies(drop_invariant=False, **params) |
352 | 369 |
|
| 370 | + test_plot_frequencies_heatmap(api, df_cnv_a) |
| 371 | + test_plot_frequencies_heatmap(api, df_cnv_b) |
| 372 | + |
353 | 373 | # Standard checks. |
354 | 374 | check_gene_cnv_frequencies( |
355 | 375 | api=api, |
@@ -418,6 +438,8 @@ def test_gene_cnv_frequencies_with_max_coverage_variance( |
418 | 438 | # checks. |
419 | 439 | df_cnv = api.gene_cnv_frequencies(**params) |
420 | 440 |
|
| 441 | + test_plot_frequencies_heatmap(api, df_cnv) |
| 442 | + |
421 | 443 | # Figure out expected cohort labels. |
422 | 444 | df_samples = api.sample_metadata(sample_sets=sample_sets) |
423 | 445 | if "cohort_" + cohorts in df_samples: |
@@ -711,6 +733,10 @@ def check_gene_cnv_frequencies_advanced( |
711 | 733 |
|
712 | 734 | # Check the result. |
713 | 735 | assert isinstance(ds, xr.Dataset) |
| 736 | + test_plot_frequencies_time_series(api, ds) |
| 737 | + test_plot_frequencies_time_series_with_taxa(api, ds) |
| 738 | + test_plot_frequencies_time_series_with_areas(api, ds) |
| 739 | + test_plot_frequencies_interactive_map(api, ds) |
714 | 740 | assert set(ds.dims) == {"cohorts", "variants"} |
715 | 741 |
|
716 | 742 | # Check variant variables. |
|
0 commit comments