Skip to content

Commit 83fc59b

Browse files
authored
IGVF-1074-matrix-content-summary (#561)
1 parent bce34f9 commit 83fc59b

File tree

4 files changed

+24
-15
lines changed

4 files changed

+24
-15
lines changed

src/igvfd/mappings/matrix_file.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"hash": "b767a0bcf0eef30b08783183aec26a58",
3-
"index_name": "matrix_file_b767a0bc",
2+
"hash": "a79f62652a66ba16923ef19aab86eb29",
3+
"index_name": "matrix_file_a79f6265",
44
"item_type": "matrix_file",
55
"mapping": {
66
"dynamic_templates": [

src/igvfd/tests/fixtures/schemas/matrix_file.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ def matrix_file(testapp, lab, award, analysis_set_with_sample, reference_file):
66
item = {
77
'award': award['@id'],
88
'lab': lab['@id'],
9-
'md5sum': 'b64eed10-78b9-4674-95e5-dae39f35f132',
9+
'md5sum': '01b08bb5485ac730df19af55ba4bb01c',
1010
'file_format': 'hdf5',
1111
'file_set': analysis_set_with_sample['@id'],
1212
'file_size': 8491803,
13-
'content_type': 'parse gene count matrix',
13+
'content_type': 'sparse gene count matrix',
1414
'reference_files': [
1515
reference_file['@id']
1616
],

src/igvfd/tests/test_types_file.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ def test_types_file_s3_uri_non_submittable(testapp, analysis_set_with_sample, aw
7373
def test_types_aligment_file_content_summary(testapp, alignment_file):
7474
res = testapp.get(alignment_file['@id'])
7575
assert res.json.get('content_summary') == 'unfiltered alignments'
76-
77-
res = testapp.patch_json(
76+
testapp.patch_json(
7877
alignment_file['@id'],
7978
{
8079
'redacted': True,
@@ -88,8 +87,7 @@ def test_types_aligment_file_content_summary(testapp, alignment_file):
8887
def test_types_signal_file_content_summary(testapp, signal_file):
8988
res = testapp.get(signal_file['@id'])
9089
assert res.json.get('content_summary') == 'plus strand signal of all reads'
91-
92-
res = testapp.patch_json(
90+
testapp.patch_json(
9391
signal_file['@id'],
9492
{
9593
'filtered': True,
@@ -99,3 +97,18 @@ def test_types_signal_file_content_summary(testapp, signal_file):
9997
)
10098
res = testapp.get(signal_file['@id'])
10199
assert res.json.get('content_summary') == 'filtered normalized unstranded signal of all reads'
100+
101+
102+
def test_types_matrix_file_content_summary(testapp, matrix_file):
103+
res = testapp.get(matrix_file['@id'])
104+
assert res.json.get('content_summary') == 'cell by gene sparse gene count matrix'
105+
testapp.patch_json(
106+
matrix_file['@id'],
107+
{
108+
'dimension1': 'variant',
109+
'dimension2': 'treatment',
110+
'content_type': 'transcriptome annotations'
111+
}
112+
)
113+
res = testapp.get(matrix_file['@id'])
114+
assert res.json.get('content_summary') == 'variant by treatment transcriptome annotations'

src/igvfd/types/file.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
'hdf5': '.h5',
6363
'idat': '.idat',
6464
'PWM': '.pwm',
65+
'mtx': '.mtx',
6566
'rcc': '.rcc',
6667
'sra': '.sra',
6768
'tagAlign': '.tagAlign.gz',
@@ -331,13 +332,8 @@ def unique_keys(self, properties):
331332
'notSubmittable': True
332333
}
333334
)
334-
def content_summary(self, request, content_type, file_format):
335-
phrases = [
336-
file_format,
337-
content_type
338-
]
339-
non_empty_phrases = [x for x in phrases if x != '']
340-
return ' '.join(non_empty_phrases)
335+
def content_summary(self, request, dimension1, dimension2, content_type):
336+
return f'{dimension1} by {dimension2} {content_type}'
341337

342338

343339
@collection(

0 commit comments

Comments
 (0)