From 2c04f38ce2887919819c0159944b11ef60f9a4e0 Mon Sep 17 00:00:00 2001 From: Benjamin Rombaut Date: Mon, 25 Nov 2024 11:25:05 +0100 Subject: [PATCH] fix metacluster bug with test --- src/flowsom/main.py | 2 +- tests/models/test_FlowSOMModel.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/flowsom/main.py b/src/flowsom/main.py index 87f2fcf..3bfa6b1 100644 --- a/src/flowsom/main.py +++ b/src/flowsom/main.py @@ -288,7 +288,7 @@ def metacluster(self, n_clusters=None): """ if n_clusters is None: n_clusters = self.n_clusters - self.model.set_n_clusters(n_clusters) + self.model.set_n_clusters(n_clusters) self.model.metacluster_model.fit_predict(self.model.codes) return self diff --git a/tests/models/test_FlowSOMModel.py b/tests/models/test_FlowSOMModel.py index dacee07..5c80ce4 100644 --- a/tests/models/test_FlowSOMModel.py +++ b/tests/models/test_FlowSOMModel.py @@ -1,5 +1,6 @@ from sklearn.metrics import v_measure_score +from flowsom.main import FlowSOM from flowsom.models import FlowSOMEstimator @@ -33,3 +34,9 @@ def test_reproducibility_seed(X): y_pred_2 = fsom_2.fit_predict(X) assert all(y_pred_1 == y_pred_2) + +def test_metacluster(X): + fsom = FlowSOM(X, n_clusters=10) + assert 10 == fsom.model.metacluster_model.n_clusters + fsom.metacluster(n_clusters=5) + assert 5 == fsom.model.metacluster_model.n_clusters \ No newline at end of file