Skip to content

Commit

Permalink
[r] Support for HCA data_use_restriction (#6131)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsotirho-ucsc committed May 6, 2024
1 parent 6066f81 commit 7e18d9f
Show file tree
Hide file tree
Showing 11 changed files with 524 additions and 27 deletions.
129 changes: 122 additions & 7 deletions lambdas/service/openapi.json

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions src/azul/plugins/metadata/hca/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ def _field_mapping(self) -> MetadataPlugin._FieldMapping:
'estimated_cell_count': 'projectEstimatedCellCount',
'is_tissue_atlas_project': 'isTissueAtlasProject',
'tissue_atlas': 'tissueAtlas',
'bionetwork_name': 'bionetworkName'
'bionetwork_name': 'bionetworkName',
'data_use_restriction': 'dataUseRestriction'
},
'sequencing_protocols': {
'instrument_manufacturer_model': 'instrumentManufacturerModel',
Expand Down Expand Up @@ -324,7 +325,8 @@ def facets(self) -> Sequence[str]:
'publicationTitle',
'isTissueAtlasProject',
'tissueAtlas',
'bionetworkName'
'bionetworkName',
'dataUseRestriction'
]

@property
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 @@ -686,7 +686,8 @@ def _project_types(cls) -> FieldTypes:
'is_tissue_atlas_project': null_bool,
'tissue_atlas': [tissue_atlas],
'bionetwork_name': [null_str],
'estimated_cell_count': null_int
'estimated_cell_count': null_int,
'data_use_restriction': null_str
}

def _project(self, project: api.Project) -> MutableJSON:
Expand Down Expand Up @@ -733,7 +734,8 @@ def _project(self, project: api.Project) -> MutableJSON:
for bionetwork in project.bionetworks),
'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
'estimated_cell_count': project.estimated_cell_count,
'data_use_restriction': project.data_use_restriction
}

@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 @@ -340,7 +340,8 @@ def make_projects(self, entry) -> MutableJSONs:
'estimatedCellCount': project['estimated_cell_count'],
'isTissueAtlasProject': project['is_tissue_atlas_project'],
'tissueAtlas': project.get('tissue_atlas'),
'bionetworkName': project['bionetwork_name']
'bionetworkName': project['bionetwork_name'],
'dataUseRestriction': project.get('data_use_restriction')
}
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 @@ -326,6 +326,7 @@ class Project(Entity):
supplementary_links: OrderedSet[str]
estimated_cell_count: Optional[int]
bionetworks: OrderedSet[Bionetwork]
data_use_restriction: Optional[str]

def __init__(self,
json: JSON,
Expand Down Expand Up @@ -354,6 +355,7 @@ def __init__(self,
self.bionetworks = OrderedSet(Bionetwork(**bionetwork)
for bionetwork in content.get('hca_bionetworks', ())
if bionetwork)
self.data_use_restriction = content.get('data_use_restriction')

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.

Loading

0 comments on commit 7e18d9f

Please sign in to comment.