Skip to content

Commit 7cb3427

Browse files
committed
change GatingResults 'sample' column name to 'sample_id', update a few related tests, & bump beta version
1 parent 1350796 commit 7cb3427

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/flowkit/_models/gating_results.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def __init__(self, results_dict, sample_id):
2121
@staticmethod
2222
def _get_pd_result_dict(res_dict, gate_name):
2323
return {
24-
'sample': res_dict['sample'],
24+
'sample_id': res_dict['sample'],
2525
'gate_path': res_dict['gate_path'],
2626
'parent': res_dict['parent'],
2727
'gate_name': gate_name,
@@ -60,7 +60,7 @@ def _process_results(self):
6060
df = pd.DataFrame(
6161
pd_list,
6262
columns=[
63-
'sample',
63+
'sample_id',
6464
'gate_path',
6565
'gate_name',
6666
'gate_type',
@@ -73,10 +73,10 @@ def _process_results(self):
7373
)
7474
df['level'] = df.gate_path.map(lambda x: len(x) - 1)
7575

76-
self.report = df.sort_values(['sample', 'level', 'gate_name'])
76+
self.report = df.sort_values(['sample_id', 'level', 'gate_name'])
7777

7878
def _filter_gate_report(self, gate_name, gate_path=None):
79-
results = self.report[(self.report['sample'] == self.sample_id) & (self.report['gate_name'] == gate_name)]
79+
results = self.report[(self.report['sample_id'] == self.sample_id) & (self.report['gate_name'] == gate_name)]
8080

8181
if gate_path is not None:
8282
results = results[results.gate_path == gate_path]
@@ -87,7 +87,7 @@ def _filter_gate_report(self, gate_name, gate_path=None):
8787

8888
def get_gate_membership(self, gate_name, gate_path=None):
8989
"""
90-
Retrieve a boolean array indicating gate membership for the events in the GatingResults sample.
90+
Retrieve a boolean array indicating gate membership for the Sample events in the GatingResults.
9191
Note, the same gate ID may be found in multiple gate paths, i.e. the gate ID can be ambiguous.
9292
In this case, specify the full gate path to retrieve gate indices.
9393
@@ -106,7 +106,7 @@ def get_gate_membership(self, gate_name, gate_path=None):
106106
gate_path = gate_paths[0]
107107

108108
# need to check for quadrant gates, as they need to be handled differently
109-
gate_data = self.report[(self.report['sample'] == self.sample_id) & (self.report.gate_name == gate_name)]
109+
gate_data = self.report[(self.report['sample_id'] == self.sample_id) & (self.report.gate_name == gate_name)]
110110
quad_parent_values = set(gate_data.quadrant_parent.to_list())
111111

112112
if len(quad_parent_values) == 1 and None in quad_parent_values:

src/flowkit/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
"""
22
FlowKit version
33
"""
4-
__version__ = "1.3.0b0"
4+
__version__ = "1.3.0b1"

tests/workspace_tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ def test_analyze_single_sample(self):
542542
wsp.analyze_samples(sample_id=sample_id)
543543
report = wsp.get_analysis_report(group_name=sample_grp)
544544

545-
self.assertEqual(report['sample'].nunique(), 1)
545+
self.assertEqual(report['sample_id'].nunique(), 1)
546546

547547
def test_parse_wsp_sample_without_gates(self):
548548
wsp_path = "data/8_color_data_set/8_color_ICS_sample_without_gates.wsp"
@@ -570,7 +570,7 @@ def test_parse_wsp_sample_without_gates(self):
570570
self.assertEqual(time_count, 257482)
571571

572572
report = wsp.get_analysis_report(group_name=sample_grp)
573-
self.assertEqual(2, len(report['sample'].unique()))
573+
self.assertEqual(2, len(report['sample_id'].unique()))
574574

575575
def test_extract_sample_data(self):
576576
wsp_path = "data/8_color_data_set/8_color_ICS.wsp"

0 commit comments

Comments
 (0)