Skip to content

Commit

Permalink
[r a] Support for HCA duos_id (#6196)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsotirho-ucsc committed Feb 10, 2025
1 parent 32e8167 commit fedc9c9
Show file tree
Hide file tree
Showing 12 changed files with 275 additions and 84 deletions.
2 changes: 1 addition & 1 deletion lambdas/service/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
# changes and reset the minor version to zero. Otherwise, increment only
# the minor version for backwards compatible changes. A backwards
# compatible change is one that does not require updates to clients.
'version': '12.2',
'version': '12.3',
'description': fd(f'''
# Overview
Expand Down
131 changes: 123 additions & 8 deletions lambdas/service/openapi.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/azul/plugins/metadata/hca/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ def _field_mapping(self) -> MetadataPlugin._FieldMapping:
'is_tissue_atlas_project': 'isTissueAtlasProject',
'tissue_atlas': 'tissueAtlas',
'bionetwork_name': 'bionetworkName',
'data_use_restriction': 'dataUseRestriction'
'data_use_restriction': 'dataUseRestriction',
'duos_id': 'duosId'
},
'sequencing_protocols': {
'instrument_manufacturer_model': 'instrumentManufacturerModel',
Expand Down
6 changes: 4 additions & 2 deletions src/azul/plugins/metadata/hca/indexer/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,8 @@ def _project_types(cls) -> FieldTypes:
'tissue_atlas': [tissue_atlas],
'bionetwork_name': [null_str],
'estimated_cell_count': null_int,
'data_use_restriction': null_str
'data_use_restriction': null_str,
'duos_id': null_str
}

def _project(self, project: api.Project) -> MutableJSON:
Expand Down Expand Up @@ -721,7 +722,8 @@ def _project(self, project: api.Project) -> MutableJSON:
'tissue_atlas': list(map(self._tissue_atlas, project.bionetworks)),
'bionetwork_name': sorted(bionetwork.name for bionetwork in project.bionetworks),
'estimated_cell_count': project.estimated_cell_count,
'data_use_restriction': project.data_use_restriction
'data_use_restriction': project.data_use_restriction,
'duos_id': project.duos_id
}

@classmethod
Expand Down
3 changes: 2 additions & 1 deletion src/azul/plugins/metadata/hca/service/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,8 @@ def make_projects(self, entry) -> MutableJSONs:
'isTissueAtlasProject': project['is_tissue_atlas_project'],
'tissueAtlas': project.get('tissue_atlas'),
'bionetworkName': project['bionetwork_name'],
'dataUseRestriction': project.get('data_use_restriction')
'dataUseRestriction': project.get('data_use_restriction'),
'duosId': project.get('duos_id')
}
if self.entity_type == 'projects':
translated_project['projectDescription'] = project.get('project_description', [])
Expand Down
2 changes: 2 additions & 0 deletions src/humancellatlas/data/metadata/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ class Project(Entity):
estimated_cell_count: int | None
bionetworks: OrderedSet[Bionetwork]
data_use_restriction: str | None
duos_id: str | None

def __init__(self, json: JSON) -> None:
super().__init__(json)
Expand All @@ -339,6 +340,7 @@ def __init__(self, json: JSON) -> None:
for bionetwork in content.get('hca_bionetworks', ())
if bionetwork)
self.data_use_restriction = content.get('data_use_restriction')
self.duos_id = content.get('duos_id')

def _accessions(self, namespace: str) -> set[str]:
return {a.accession for a in self.accessions if a.namespace == namespace}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fedc9c9

Please sign in to comment.