diff --git a/src/azul/plugins/metadata/hca/aggregate.py b/src/azul/plugins/metadata/hca/aggregate.py index 91dcf5504..9263e6780 100644 --- a/src/azul/plugins/metadata/hca/aggregate.py +++ b/src/azul/plugins/metadata/hca/aggregate.py @@ -71,7 +71,7 @@ def _transform_entity(self, entity: JSON) -> JSON: is_intermediate=entity['is_intermediate'], count=(fqid, 1), content_description=entity['content_description'], - matrix_cell_count=(fqid, entity['matrix_cell_count'])) + matrix_cell_count=(fqid, entity.get('matrix_cell_count'))) def _group_keys(self, entity) -> Tuple[Any]: return entity['file_format'], entity['is_intermediate'] diff --git a/src/azul/plugins/metadata/hca/transform.py b/src/azul/plugins/metadata/hca/transform.py index 7b2d5e01e..23a042194 100644 --- a/src/azul/plugins/metadata/hca/transform.py +++ b/src/azul/plugins/metadata/hca/transform.py @@ -767,7 +767,12 @@ def _file(self, file: api.File, related_files: Iterable[api.File] = ()) -> Mutab } if isinstance(file, api.SequenceFile) else { } ), - 'matrix_cell_count': getattr(file, 'matrix_cell_count', None), + **( + { + 'matrix_cell_count': file.matrix_cell_count + } if isinstance(file, api.AnalysisFile) else { + } + ), } @classmethod diff --git a/test/indexer/data/aaa96233-bf27-44c7-82df-b4dc15ad4d9d.2018-11-02T113344.698028Z.results.json b/test/indexer/data/aaa96233-bf27-44c7-82df-b4dc15ad4d9d.2018-11-02T113344.698028Z.results.json index d1c7404ba..66750d912 100644 --- a/test/indexer/data/aaa96233-bf27-44c7-82df-b4dc15ad4d9d.2018-11-02T113344.698028Z.results.json +++ b/test/indexer/data/aaa96233-bf27-44c7-82df-b4dc15ad4d9d.2018-11-02T113344.698028Z.results.json @@ -137,9 +137,7 @@ "_type": "file", "read_index": "read2", "lane_index": 9223372036854774784, - "lane_index_": null, - "matrix_cell_count": 9223372036854774784, - "matrix_cell_count_": null + "lane_index_": null }, { "related_files": [], @@ -164,9 +162,7 @@ "_type": "file", "read_index": "read1", "lane_index": 9223372036854774784, - "lane_index_": null, - "matrix_cell_count": 9223372036854774784, - "matrix_cell_count_": null + "lane_index_": null } ], "analysis_protocols": [], @@ -601,9 +597,7 @@ "_type": "file", "read_index": "read1", "lane_index": 9223372036854774784, - "lane_index_": null, - "matrix_cell_count": 9223372036854774784, - "matrix_cell_count_": null + "lane_index_": null } ], "analysis_protocols": [], @@ -837,9 +831,7 @@ "_type": "file", "read_index": "read2", "lane_index": 9223372036854774784, - "lane_index_": null, - "matrix_cell_count": 9223372036854774784, - "matrix_cell_count_": null + "lane_index_": null } ], "analysis_protocols": [], @@ -1073,9 +1065,7 @@ "_type": "file", "read_index": "read2", "lane_index": 9223372036854774784, - "lane_index_": null, - "matrix_cell_count": 9223372036854774784, - "matrix_cell_count_": null + "lane_index_": null }, { "related_files": [], @@ -1100,9 +1090,7 @@ "_type": "file", "read_index": "read1", "lane_index": 9223372036854774784, - "lane_index_": null, - "matrix_cell_count": 9223372036854774784, - "matrix_cell_count_": null + "lane_index_": null } ], "analysis_protocols": [], @@ -1336,9 +1324,7 @@ "_type": "file", "read_index": "read2", "lane_index": 9223372036854774784, - "lane_index_": null, - "matrix_cell_count": 9223372036854774784, - "matrix_cell_count_": null + "lane_index_": null }, { "related_files": [], @@ -1363,9 +1349,7 @@ "_type": "file", "read_index": "read1", "lane_index": 9223372036854774784, - "lane_index_": null, - "matrix_cell_count": 9223372036854774784, - "matrix_cell_count_": null + "lane_index_": null } ], "analysis_protocols": [], @@ -1676,9 +1660,7 @@ "_type": "file", "read_index": "read2", "lane_index": 9223372036854774784, - "lane_index_": null, - "matrix_cell_count": 9223372036854774784, - "matrix_cell_count_": null + "lane_index_": null }, { "related_files": [], @@ -1703,9 +1685,7 @@ "_type": "file", "read_index": "read1", "lane_index": 9223372036854774784, - "lane_index_": null, - "matrix_cell_count": 9223372036854774784, - "matrix_cell_count_": null + "lane_index_": null } ], "analysis_protocols": [], @@ -2196,9 +2176,7 @@ "_type": "file", "read_index": "read1", "lane_index": 9223372036854774784, - "lane_index_": null, - "matrix_cell_count": 9223372036854774784, - "matrix_cell_count_": null + "lane_index_": null } ], "analysis_protocols": [], @@ -2491,9 +2469,7 @@ "_type": "file", "read_index": "read2", "lane_index": 9223372036854774784, - "lane_index_": null, - "matrix_cell_count": 9223372036854774784, - "matrix_cell_count_": null + "lane_index_": null } ], "analysis_protocols": [], @@ -3276,9 +3252,7 @@ "_type": "file", "read_index": "read2", "lane_index": 9223372036854774784, - "lane_index_": null, - "matrix_cell_count": 9223372036854774784, - "matrix_cell_count_": null + "lane_index_": null }, { "related_files": [], @@ -3303,9 +3277,7 @@ "_type": "file", "read_index": "read1", "lane_index": 9223372036854774784, - "lane_index_": null, - "matrix_cell_count": 9223372036854774784, - "matrix_cell_count_": null + "lane_index_": null } ], "analysis_protocols": [],