Skip to content

Commit

Permalink
Put JGI proposal ID in jgi_portal_study_identifiers slot on Study
Browse files Browse the repository at this point in the history
  • Loading branch information
pkalita-lbl committed Nov 14, 2024
1 parent 001f54f commit 7c8719f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
20 changes: 17 additions & 3 deletions nmdc_runtime/site/translation/submission_portal_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,20 @@ def _get_gold_study_identifiers(

return [self._ensure_curie(gold_study_id, default_prefix="gold")]

def _get_jgi_study_identifiers(
self, metadata_submission: JSON_OBJECT
) -> Union[List[str], None]:
"""Construct a JGI proposal CURIE from the multiomics from data
:param metadata_submission: submission portal entry
:return: JGI proposal CURIE
"""
jgi_study_id = get_in(["multiOmicsForm", "JGIStudyId"], metadata_submission)
if not jgi_study_id:
return None

return [self._ensure_curie(jgi_study_id, default_prefix="jgi.proposal")]

def _get_quantity_value(
self, raw_value: Optional[str], unit: Optional[str] = None
) -> Union[nmdc.QuantityValue, None]:
Expand Down Expand Up @@ -410,9 +424,6 @@ def _translate_study(
:return: nmdc:Study object
"""
return nmdc.Study(
alternative_identifiers=self._get_from(
metadata_submission, ["multiOmicsForm", "JGIStudyId"]
),
alternative_names=self._get_from(
metadata_submission, ["multiOmicsForm", "alternativeNames"]
),
Expand All @@ -436,6 +447,9 @@ def _translate_study(
insdc_bioproject_identifiers=self._get_from(
metadata_submission, ["multiOmicsForm", "NCBIBioProjectId"]
),
jgi_portal_study_identifiers=self._get_jgi_study_identifiers(
metadata_submission
),
name=self._get_from(metadata_submission, ["studyForm", "studyName"]),
notes=self._get_from(metadata_submission, ["studyForm", "notes"]),
principal_investigator=self._get_pi(metadata_submission),
Expand Down
8 changes: 6 additions & 2 deletions tests/test_data/test_submission_portal_translator_data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ input:
multiOmicsForm:
alternativeNames: []
studyNumber: ''
GOLDStudyId: ''
JGIStudyId: ''
GOLDStudyId: 'Gs0123456'
JGIStudyId: '123456'
NCBIBioProjectId: ''
omicsProcessingTypes:
- mg
Expand Down Expand Up @@ -991,6 +991,10 @@ output:
- Principal Investigator
- Funding acquisition
type: nmdc:CreditAssociation
gold_study_identifiers:
- gold:Gs0123456
jgi_portal_study_identifiers:
- jgi.proposal:123456
---
input:
metadata_submission:
Expand Down

0 comments on commit 7c8719f

Please sign in to comment.