Skip to content

Commit

Permalink
Concatenate organism_age in manifests with value and unit (#2571, PR #…
Browse files Browse the repository at this point in the history
  • Loading branch information
amarjandu committed Mar 10, 2021
2 parents c4bb50e + 79f71c8 commit 905b700
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
9 changes: 5 additions & 4 deletions src/azul/plugins/metadata/hca/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ def service_config(self) -> ServiceConfig:
"specimenOrgan": "contents.specimens.organ",
"specimenOrganPart": "contents.specimens.organ_part",
"organismAge": "contents.donors.organism_age",
# FIXME: Remove organismAgeValue facet
# https://github.com/DataBiosphere/azul/issues/2824
"organismAgeValue": "contents.donors.organism_age_value",
"organismAgeUnit": "contents.donors.organism_age_unit",
"organismAgeRange": "contents.donors.organism_age_range",
Expand Down Expand Up @@ -251,10 +253,7 @@ def service_config(self) -> ServiceConfig:
"donor_organism.genus_species": "genus_species",
"donor_organism.development_stage": "development_stage",
"donor_organism.diseases": "diseases",
# FIXME: Adapt organism_age to manifest format
# https://github.com/DataBiosphere/azul/issues/2571
"donor_organism.organism_age": "organism_age_value",
"donor_organism.organism_age_unit": "organism_age_unit"
"donor_organism.organism_age": "organism_age"
},
"contents.cell_lines": {
"cell_line.provenance.document_id": "document_id",
Expand Down Expand Up @@ -308,6 +307,8 @@ def service_config(self) -> ServiceConfig:
"genusSpecies",
"organismAge",
"organismAgeUnit",
# FIXME: Remove organismAgeValue facet
# https://github.com/DataBiosphere/azul/issues/2824
"organismAgeValue",
"biologicalSex",
"sampleDisease",
Expand Down
5 changes: 5 additions & 0 deletions src/azul/service/manifest_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@
MutableManifestConfig,
RepositoryPlugin,
)
from azul.plugins.metadata.hca.transform import (
value_and_unit,
)
from azul.service import (
Filters,
)
Expand Down Expand Up @@ -537,6 +540,8 @@ def _extract_fields(self,
def convert(field_name, field_value):
if field_name == 'drs_path':
return self.repository_plugin.drs_uri(field_value)
elif field_name == 'organism_age':
return value_and_unit.to_index(field_value)
elif field_value is None:
return ''
else:
Expand Down
10 changes: 2 additions & 8 deletions test/service/test_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,7 @@ def test_manifest(self):
('donor_organism.genus_species', '', 'Mus musculus'),
('donor_organism.development_stage', '', 'adult'),
('donor_organism.diseases', '', 'subcutaneous melanoma'),
# FIXME: Adapt organism_age to manifest format
# https://github.com/DataBiosphere/azul/issues/2571
('donor_organism.organism_age', '', '6-12'),
('donor_organism.organism_age_unit', '', 'week'),
('donor_organism.organism_age', '', '6-12 week'),
('cell_line.provenance.document_id', '', ''),
('cell_line.biomaterial_core.biomaterial_id', '', ''),
('organoid.provenance.document_id', '', ''),
Expand Down Expand Up @@ -499,7 +496,6 @@ def test_terra_bdbag_manifest(self):
'donor_organism__development_stage': 'adult',
'donor_organism__diseases': '',
'donor_organism__organism_age': '',
'donor_organism__organism_age_unit': '',
'cell_line__provenance__document_id': '',
'cell_line__biomaterial_core__biomaterial_id': '',
'organoid__provenance__document_id': '',
Expand Down Expand Up @@ -594,8 +590,7 @@ def test_terra_bdbag_manifest(self):
'donor_organism__genus_species': 'Australopithecus',
'donor_organism__development_stage': '',
'donor_organism__diseases': 'normal',
'donor_organism__organism_age': '38',
'donor_organism__organism_age_unit': 'year',
'donor_organism__organism_age': '38 year',
'cell_line__provenance__document_id': '',
'cell_line__biomaterial_core__biomaterial_id': '',
'organoid__provenance__document_id': '',
Expand Down Expand Up @@ -708,7 +703,6 @@ def sort_rows(rows: List[Dict[str, str]]) -> List[List[Tuple[str, str]]]:
'donor_organism__development_stage',
'donor_organism__diseases',
'donor_organism__organism_age',
'donor_organism__organism_age_unit',
'cell_line__provenance__document_id',
'cell_line__biomaterial_core__biomaterial_id',
'organoid__provenance__document_id',
Expand Down

0 comments on commit 905b700

Please sign in to comment.