From 182a33d24798f7ab848ef900ca400192072a9d7d Mon Sep 17 00:00:00 2001 From: whitews Date: Wed, 26 Jun 2024 14:55:40 -0400 Subject: [PATCH] BUGFIX: typo in Matrix.fluorochromes attribute (closes #206), bump version --- ...t-tutorial-part02-transforms-module-matrix-class.ipynb | 2 +- src/flowkit/_models/gating_strategy.py | 2 +- src/flowkit/_models/transforms/_matrix.py | 8 ++++---- src/flowkit/_utils/gml_write.py | 2 +- src/flowkit/_utils/plot_utils.py | 4 ++-- src/flowkit/_utils/xml_utils.py | 6 +++--- src/flowkit/_version.py | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/notebooks/flowkit-tutorial-part02-transforms-module-matrix-class.ipynb b/docs/notebooks/flowkit-tutorial-part02-transforms-module-matrix-class.ipynb index d42821b9..11748504 100644 --- a/docs/notebooks/flowkit-tutorial-part02-transforms-module-matrix-class.ipynb +++ b/docs/notebooks/flowkit-tutorial-part02-transforms-module-matrix-class.ipynb @@ -3022,7 +3022,7 @@ " 'custom_spill', \n", " comp_df.values, # use new values\n", " comp_mat.detectors, # use old detectors\n", - " fluorochromes=comp_mat.fluorochomes # use old fluoros\n", + " fluorochromes=comp_mat.fluorochromes # use old fluoros\n", ")\n", "\n", "sample.apply_compensation(comp_mat_modified)\n", diff --git a/src/flowkit/_models/gating_strategy.py b/src/flowkit/_models/gating_strategy.py index 31489e3c..9cc9f2b7 100644 --- a/src/flowkit/_models/gating_strategy.py +++ b/src/flowkit/_models/gating_strategy.py @@ -666,7 +666,7 @@ def _preprocess_sample_events(self, sample, gate, cache_events=False): ) matrix = self.comp_matrices[dim.compensation_ref] try: - matrix_dim_idx = matrix.fluorochomes.index(dim_id) + matrix_dim_idx = matrix.fluorochromes.index(dim_id) except ValueError: raise ValueError("%s not found in list of matrix fluorochromes" % dim_id) detector = matrix.detectors[matrix_dim_idx] diff --git a/src/flowkit/_models/transforms/_matrix.py b/src/flowkit/_models/transforms/_matrix.py index e72d9394..934e2e06 100644 --- a/src/flowkit/_models/transforms/_matrix.py +++ b/src/flowkit/_models/transforms/_matrix.py @@ -72,7 +72,7 @@ def __init__( if fluorochromes is None: fluorochromes = ['' for _ in detectors] - self.fluorochomes = fluorochromes + self.fluorochromes = fluorochromes def __repr__(self): return ( @@ -91,7 +91,7 @@ def apply(self, sample): # matrix detectors sample_fluoro_labels = [sample.pnn_labels[i] for i in sample.fluoro_indices] if not set(self.detectors).issubset(sample_fluoro_labels): - raise FlowKitException("Detectors must be a subset of the Sample's fluorochomes") + raise FlowKitException("Detectors must be a subset of the Sample's fluorochromes") indices = [ sample.get_channel_index(d) for d in self.detectors @@ -115,7 +115,7 @@ def inverse(self, sample): # matrix detectors sample_fluoro_labels = [sample.pnn_labels[i] for i in sample.fluoro_indices] if not set(self.detectors).issubset(sample_fluoro_labels): - raise FlowKitException("Detectors must be a subset of the Sample's fluorochomes") + raise FlowKitException("Detectors must be a subset of the Sample's fluorochromes") indices = [ sample.get_channel_index(d) for d in self.detectors @@ -137,7 +137,7 @@ def as_dataframe(self, fluoro_labels=False): :return: pandas DataFrame """ if fluoro_labels: - labels = self.fluorochomes + labels = self.fluorochromes else: labels = self.detectors diff --git a/src/flowkit/_utils/gml_write.py b/src/flowkit/_utils/gml_write.py index aaa8746a..a5ee9bcb 100644 --- a/src/flowkit/_utils/gml_write.py +++ b/src/flowkit/_utils/gml_write.py @@ -22,7 +22,7 @@ def _add_matrix_to_gml(root, matrix, ns_map): fluoros_ml = etree.SubElement(xform_ml, "{%s}fluorochromes" % ns_map['transforms']) - for fluoro in matrix.fluorochomes: + for fluoro in matrix.fluorochromes: fluoro_ml = etree.SubElement(fluoros_ml, '{%s}fcs-dimension' % ns_map['data-type']) fluoro_ml.set('{%s}name' % ns_map['data-type'], fluoro) diff --git a/src/flowkit/_utils/plot_utils.py b/src/flowkit/_utils/plot_utils.py index 0a8ae7d2..cf738224 100644 --- a/src/flowkit/_utils/plot_utils.py +++ b/src/flowkit/_utils/plot_utils.py @@ -718,7 +718,7 @@ def plot_gate( # might be a label reference in the comp matrix matrix = gating_strategy.get_comp_matrix(dim_comp_refs[0]) try: - matrix_dim_idx = matrix.fluorochomes.index(dim_ids_ordered[0]) + matrix_dim_idx = matrix.fluorochromes.index(dim_ids_ordered[0]) except ValueError: raise ValueError("%s not found in list of matrix fluorochromes" % dim_ids_ordered[0]) detector = matrix.detectors[matrix_dim_idx] @@ -744,7 +744,7 @@ def plot_gate( # might be a label reference in the comp matrix matrix = gating_strategy.get_comp_matrix(dim_comp_refs[1]) try: - matrix_dim_idx = matrix.fluorochomes.index(dim_ids_ordered[1]) + matrix_dim_idx = matrix.fluorochromes.index(dim_ids_ordered[1]) except ValueError: raise ValueError("%s not found in list of matrix fluorochromes" % dim_ids_ordered[1]) detector = matrix.detectors[matrix_dim_idx] diff --git a/src/flowkit/_utils/xml_utils.py b/src/flowkit/_utils/xml_utils.py index 169c139d..09a6659f 100644 --- a/src/flowkit/_utils/xml_utils.py +++ b/src/flowkit/_utils/xml_utils.py @@ -376,7 +376,7 @@ def _parse_matrix_element( data_type_namespace ): matrix_id = find_attribute_value(matrix_element, xform_namespace, 'id') - fluorochomes = [] + fluorochromes = [] detectors = [] matrix = [] @@ -397,7 +397,7 @@ def _parse_matrix_element( raise ValueError( 'Dimension name not found (line %d)' % dim_el.sourceline ) - fluorochomes.append(label) + fluorochromes.append(label) detectors_el = matrix_element.find( '%s:detectors' % xform_namespace, @@ -444,7 +444,7 @@ def _parse_matrix_element( matrix = np.array(matrix) - return Matrix(matrix_id, matrix, detectors, fluorochomes) + return Matrix(matrix_id, matrix, detectors, fluorochromes) def _parse_fratio_element(transform_id, fratio_element, transform_namespace, data_type_namespace): diff --git a/src/flowkit/_version.py b/src/flowkit/_version.py index 8246bba9..665a061d 100644 --- a/src/flowkit/_version.py +++ b/src/flowkit/_version.py @@ -1,4 +1,4 @@ """ FlowKit version """ -__version__ = "1.1.1" +__version__ = "1.1.2"