Skip to content

Commit 1f0bde5

Browse files
committed
Added new calc for MuxSamp classifications
1 parent 51df665 commit 1f0bde5

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

src/igvfd/mappings/multiplexed_sample.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"hash": "ae51100e0549fa55ecdd094b717c1449",
3-
"index_name": "multiplexed_sample_ae51100e",
2+
"hash": "9d95f96aa3b29510bc4fa431d3d8c90e",
3+
"index_name": "multiplexed_sample_9d95f96a",
44
"item_type": "multiplexed_sample",
55
"mapping": {
66
"dynamic_templates": [

src/igvfd/tests/test_types_sample.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,9 @@ def test_classifications(testapp, primary_cell, technical_sample, whole_organism
119119
assert res.json.get('classifications') == ['tissue']
120120
res = testapp.get(in_vitro_cell_line['@id'])
121121
assert res.json.get('classifications') == ['cell line']
122+
# This fixutre has one cell line and one tissue
122123
res = testapp.get(multiplexed_sample['@id'])
123-
assert res.json.get('classifications') == ['multiplexed sample']
124+
assert res.json.get('classifications') == ['cell line', 'tissue', 'multiplexed sample']
124125

125126

126127
def test_sorted_fractions(testapp, primary_cell, tissue, in_vitro_cell_line):

src/igvfd/types/sample.py

+13-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@
1111
)
1212

1313

14-
def collect_multiplexed_samples_prop(request, multiplexed_samples, property_name):
14+
def collect_multiplexed_samples_prop(request, multiplexed_samples, property_name, skip_calculated=True):
1515
property_set = set()
1616
for sample in multiplexed_samples:
17-
sample_props = request.embed(sample, '@@object?skip_calculated=true')
17+
# If to get a specific calculated property
18+
if skip_calculated is False:
19+
sample_props = request.embed(sample, f'@@object_with_select_calculated_properties?field={property_name}')
20+
# If to get non-calculated properties
21+
else:
22+
sample_props = request.embed(sample, '@@object?skip_calculated=true')
1823
property_contents = sample_props.get(property_name, None)
1924
if property_contents:
2025
if type(property_contents) == list:
@@ -1059,5 +1064,9 @@ def institutional_certificates(self, request, multiplexed_samples):
10591064
'notSubmittable': True,
10601065
}
10611066
)
1062-
def classifications(self):
1063-
return [self.item_type.replace('_', ' ')]
1067+
def classifications(self, request, multiplexed_samples):
1068+
# Get unique properties of individual samples' item types
1069+
sample_classfications = collect_multiplexed_samples_prop(
1070+
request, multiplexed_samples, 'classifications', skip_calculated=False)
1071+
self_classification = [self.item_type.replace('_', ' ')]
1072+
return sample_classfications + self_classification

0 commit comments

Comments
 (0)