Skip to content

Commit

Permalink
fix!: ConceptMapping.coding.code should be a CURIE (#390)
Browse files Browse the repository at this point in the history
close #383

* Use `concept_id` as the CURIE
  • Loading branch information
korikuzma authored Dec 31, 2024
1 parent f6f200f commit 82b75d3
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 73 deletions.
5 changes: 2 additions & 3 deletions src/gene/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ def _create_concept_mapping(
``NamespacePrefix``
:return: Concept mapping for identifier
"""
source, source_id = concept_id.split(":")
source = concept_id.split(":")[0]

try:
source = NamespacePrefix(source)
Expand All @@ -424,10 +424,9 @@ def _create_concept_mapping(
raise ValueError(err_msg) from e

system = NAMESPACE_TO_SYSTEM_URI.get(source, source)
code_ = concept_id.upper() if source == NamespacePrefix.HGNC else source_id

return ConceptMapping(
coding=Coding(code=code(code_), system=system), relation=relation
coding=Coding(code=code(concept_id), system=system), relation=relation
)

gene_obj = MappableConcept(
Expand Down
31 changes: 17 additions & 14 deletions src/gene/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,92 +347,95 @@ class NormalizeService(BaseNormalizationService):
"mappings": [
{
"coding": {
"code": "HGNC:1097",
"code": "hgnc:1097",
"system": "https://www.genenames.org",
},
"relation": "exactMatch",
},
{
"coding": {
"code": "673",
"code": "ncbigene:673",
"system": "https://www.ncbi.nlm.nih.gov/gene/",
},
"relation": "relatedMatch",
},
{
"coding": {
"code": "ENSG00000157764",
"code": "ensembl:ENSG00000157764",
"system": "https://www.ensembl.org",
},
"relation": "relatedMatch",
},
{
"coding": {
"code": "1943",
"code": "iuphar:1943",
"system": "https://www.guidetopharmacology.org",
},
"relation": "relatedMatch",
},
{
"coding": {"code": "119066", "system": "orphanet"},
"coding": {"code": "orphanet:119066", "system": "orphanet"},
"relation": "relatedMatch",
},
{
"coding": {
"code": "BRAF",
"code": "cosmic:BRAF",
"system": "https://cancer.sanger.ac.uk/cosmic",
},
"relation": "relatedMatch",
},
{
"coding": {
"code": "2284096",
"code": "pubmed:2284096",
"system": "https://pubmed.ncbi.nlm.nih.gov",
},
"relation": "relatedMatch",
},
{
"coding": {
"code": "uc003vwc.5",
"code": "ucsc:uc003vwc.5",
"system": "https://genome.ucsc.edu",
},
"relation": "relatedMatch",
},
{
"coding": {
"code": "164757",
"code": "omim:164757",
"system": "https://www.omim.org",
},
"relation": "relatedMatch",
},
{
"coding": {
"code": "NM_004333",
"code": "refseq:NM_004333",
"system": "https://www.ncbi.nlm.nih.gov/refseq/",
},
"relation": "relatedMatch",
},
{
"coding": {
"code": "P15056",
"code": "uniprot:P15056",
"system": "https://www.uniprot.org",
},
"relation": "relatedMatch",
},
{
"coding": {
"code": "M95712",
"code": "ena.embl:M95712",
"system": "https://www.ebi.ac.uk/ena/",
},
"relation": "relatedMatch",
},
{
"coding": {"code": "OTTHUMG00000157457", "system": "vega"},
"coding": {
"code": "vega:OTTHUMG00000157457",
"system": "vega",
},
"relation": "relatedMatch",
},
{
"coding": {
"code": "1565476",
"code": "pubmed:1565476",
"system": "https://pubmed.ncbi.nlm.nih.gov",
},
"relation": "relatedMatch",
Expand Down
Loading

0 comments on commit 82b75d3

Please sign in to comment.