Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#3486_Standardising Orphanet to ORPHA #864

Merged
merged 1 commit into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion annotation/regexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class DbRegexes:
NIHMS = DbRefRegex(db="NIHMS", prefixes="NIHMS", link="https://www.ncbi.nlm.nih.gov/pubmed/?term=NIHMS${1}")
# smallest OMIM starts with a 1, so there's no 0 padding there, expect min length
OMIM = DbRefRegex(db="OMIM", prefixes=["OMIM", "MIM"], link=OntologyService.URLS[OntologyService.OMIM], min_length=OntologyService.EXPECTED_LENGTHS[OntologyService.OMIM], expected_length=OntologyService.EXPECTED_LENGTHS[OntologyService.OMIM])
ORPHA = DbRefRegex(db="Orphanet", prefixes=["ORPHANET", "ORPHA"], link=OntologyService.URLS[OntologyService.ORPHANET], expected_length=OntologyService.EXPECTED_LENGTHS[OntologyService.ORPHANET])
ORPHA = DbRefRegex(db="ORPHA", prefixes=["ORPHANET", "ORPHA"], link=OntologyService.URLS[OntologyService.ORPHANET], expected_length=OntologyService.EXPECTED_LENGTHS[OntologyService.ORPHANET])
PUBMED_CENTRAL = DbRefRegex(db="PMCID", prefixes=["PMCID", "PubMedCentral", "PMC"], link="https://www.ncbi.nlm.nih.gov/pmc/articles/${1}", match_type=MatchType.OPT_ALPHA_MAN_NUMERIC)
PUBMED = DbRefRegex(db="PMID", prefixes=["PubMed", "PMID"], link="https://www.ncbi.nlm.nih.gov/pubmed/${1}")
SNP = DbRefRegex(db="SNP", prefixes="rs", link="https://www.ncbi.nlm.nih.gov/snp/${1}", match_type=MatchType.SIMPLE_NUMBERS)
Expand Down
15 changes: 15 additions & 0 deletions classification/management/commands/fix_orphanet_revalidation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from django.core.management.base import BaseCommand
from classification.models import Classification
from library.guardian_utils import admin_bot


class Command(BaseCommand):

def handle(self, *args, **options):
user = admin_bot()
search_term_orpha = "ORPHANET"
classifications = Classification.objects.filter(evidence__search_terms__icontains=search_term_orpha)
print(f"Found {classifications.count()} classifications with '{search_term_orpha}' in literature")
for classification in classifications:
classification.revalidate(user=user)
self.stdout.write(self.style.SUCCESS("Revalidation complete for Orphanet classifications."))
20 changes: 20 additions & 0 deletions classification/migrations/0105_fix_orphanet_revalidation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 4.2.2 on 2023-08-14 23:42
from django.db import migrations
from manual.operations.manual_operations import ManualOperation


def _test_fix_orphanet_revalidation(apps):
Classification = apps.get_model("classification", "Classification")
search_term_orpha = "ORPHANET"
return Classification.objects.filter(evidence__search_terms__icontains=search_term_orpha).exists()

class Migration(migrations.Migration):

dependencies = [
('classification', '0104_discordancereport_admin_note'),
]

operations = [
ManualOperation(task_id=ManualOperation.task_id_manage(["fix_orphanet_revalidation"]),
test=_test_fix_orphanet_revalidation)
]
18 changes: 18 additions & 0 deletions ontology/migrations/0026_alter_ontologyterm_ontology_service.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.2 on 2023-08-14 23:52

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('ontology', '0025_alter_ontologyterm_ontology_service'),
]

operations = [
migrations.AlterField(
model_name='ontologyterm',
name='ontology_service',
field=models.CharField(choices=[('MONDO', 'MONDO'), ('OMIM', 'OMIM'), ('HP', 'HP'), ('HGNC', 'HGNC'), ('DOID', 'DOID'), ('ORPHA', 'ORPHA'), ('MedGen', 'MedGen')], max_length=10),
),
]
6 changes: 3 additions & 3 deletions ontology/models/models_ontology.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class OntologyService(models.TextChoices):
HGNC = "HGNC", "HGNC"

DOID = "DOID", "DOID"
ORPHANET = "Orphanet", "Orphanet"
ORPHANET = "ORPHA", "ORPHA"
MEDGEN = "MedGen", "MedGen"

EXPECTED_LENGTHS: Dict[str, int] = Constant({
Expand Down Expand Up @@ -257,8 +257,8 @@ def normalize(dirty_id: str) -> 'OntologyIdNormalized':
raise ValueError(f"Can not convert {dirty_id} to a proper id")

prefix = parts[0].strip().upper()
if prefix == "ORPHANET": # Orphanet is the one ontology (so far) where the standard is sentance case
prefix = "Orphanet"
if prefix == "ORPHA": # Orphanet is the one ontology (so far) where the standard is sentance case
prefix = "ORPHA"
elif prefix.upper() == "MIM":
prefix = "OMIM"
elif prefix.upper() == "MEDGEN":
Expand Down
2 changes: 1 addition & 1 deletion ontology/models/ontology_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def validate_ontology(term: OntologyTerm, preview_proxy: Optional[PreviewProxyMo
return SearchResult(preview, messages=messages)


ONTOLOGY_TERM_PATTERN = re.compile(r"^((MONDO|OMIM|MIM|HPO|HP|DOID|ORPHANET)\s*:\s*[0-9]+)|(MEDGEN\s*:\s*\w{0,2}[0-9]+)$", re.IGNORECASE)
ONTOLOGY_TERM_PATTERN = re.compile(r"^((MONDO|OMIM|MIM|HPO|HP|DOID|ORPHA)\s*:\s*[0-9]+)|(MEDGEN\s*:\s*\w{0,2}[0-9]+)$", re.IGNORECASE)

@search_receiver(
search_type=OntologyTerm,
Expand Down
Loading