Mercurial > repos > onnodg > cdhit_analysis
comparison tests/test_cdhit_analysis.py @ 1:ff68835adb2b draft
planemo upload for repository https://github.com/Onnodg/Naturalis_NLOOR/tree/main/NLOOR_scripts/process_clusters_tool commit d771f9fbfd42bcdeda1623d954550882a0863847-dirty
| author | onnodg |
|---|---|
| date | Mon, 20 Oct 2025 12:27:31 +0000 |
| parents | 00d56396b32a |
| children |
comparison
equal
deleted
inserted
replaced
| 0:00d56396b32a | 1:ff68835adb2b |
|---|---|
| 589 ca.main(args) | 589 ca.main(args) |
| 590 captured = capsys.readouterr() | 590 captured = capsys.readouterr() |
| 591 assert "Processing complete" in captured.out | 591 assert "Processing complete" in captured.out |
| 592 | 592 |
| 593 | 593 |
| 594 def test_16a_prepare_evalue_histogram_valid_data(self): | 594 def test_18a_prepare_evalue_histogram_valid_data(self): |
| 595 """ | 595 """ |
| 596 Test 16a: prepare_evalue_histogram returns correct counts/bins. | 596 Test 18a: prepare_evalue_histogram returns correct counts/bins. |
| 597 """ | 597 """ |
| 598 from Stage_1_translated.NLOOR_scripts.process_clusters_tool import cdhit_analysis as ca | 598 from Stage_1_translated.NLOOR_scripts.process_clusters_tool import cdhit_analysis as ca |
| 599 counts, bins = ca.prepare_evalue_histogram([1e-5, 1e-3, 0.5], []) | 599 counts, bins = ca.prepare_evalue_histogram([1e-5, 1e-3, 0.5], []) |
| 600 assert counts.sum() == 3 # 3 entries counted | 600 assert counts.sum() == 3 # 3 entries counted |
| 601 assert len(bins) == 51 # 50 bins => 51 edges | 601 assert len(bins) == 51 # 50 bins => 51 edges |
| 602 | 602 |
| 603 def test_16b_prepare_evalue_histogram_empty(self): | 603 def test_18b_prepare_evalue_histogram_empty(self): |
| 604 """ | 604 """ |
| 605 Test 16b: prepare_evalue_histogram with empty/invalid data returns (None, None). | 605 Test 18b: prepare_evalue_histogram with empty/invalid data returns (None, None). |
| 606 """ | 606 """ |
| 607 from Stage_1_translated.NLOOR_scripts.process_clusters_tool import cdhit_analysis as ca | 607 from Stage_1_translated.NLOOR_scripts.process_clusters_tool import cdhit_analysis as ca |
| 608 counts, bins = ca.prepare_evalue_histogram([0, None, "bad"], []) | 608 counts, bins = ca.prepare_evalue_histogram([0, None, "bad"], []) |
| 609 assert counts is None | 609 assert counts is None |
| 610 assert bins is None | 610 assert bins is None |
| 611 | 611 |
| 612 def test_16c_create_evalue_plot_creates_file_and_returns_data(self, tmp_path): | 612 def test_18c_create_evalue_plot_creates_file_and_returns_data(self, tmp_path): |
| 613 """ | 613 """ |
| 614 Test 16c: create_evalue_plot saves a PNG and returns numeric data. | 614 Test 18c: create_evalue_plot saves a PNG and returns numeric data. |
| 615 """ | 615 """ |
| 616 from Stage_1_translated.NLOOR_scripts.process_clusters_tool import cdhit_analysis as ca | 616 from Stage_1_translated.NLOOR_scripts.process_clusters_tool import cdhit_analysis as ca |
| 617 out = tmp_path / "eval.png" | 617 out = tmp_path / "eval.png" |
| 618 counts, bins = ca.create_evalue_plot_test([1e-5, 1e-3, 0.5], [], str(out)) | 618 counts, bins = ca.create_evalue_plot_test([1e-5, 1e-3, 0.5], [], str(out)) |
| 619 assert out.exists() | 619 assert out.exists() |
