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

Update multi-entity endpoint #385

Closed
wants to merge 10 commits into from
Closed

Update multi-entity endpoint #385

wants to merge 10 commits into from

Conversation

glass-ships
Copy link
Collaborator

@glass-ships glass-ships commented Oct 11, 2023

Addresses #365

  • Adds custom classes for multi-entity associations endpoint
  • Updates solr integration test to match new models
  • Run formatting on backend code

@netlify
Copy link

netlify bot commented Oct 11, 2023

Deploy Preview for monarch-app canceled.

Name Link
🔨 Latest commit d5aa1f7
🔍 Latest deploy log https://app.netlify.com/sites/monarch-app/deploys/653852cd3caa66000814a631

@glass-ships
Copy link
Collaborator Author

glass-ships commented Oct 11, 2023

@oneilsh i think i've got something that (at least technically) works -
could you check out this branch and give the following script a shot?

from monarch_py.implementations.solr.solr_implementation import SolrImplementation
from monarch_py.utils.utils import to_json

si = SolrImplementation()

results = si.get_multi_entity_associations(
    entity=["MONDO:0012933", "MONDO:0005439", "MANGO:0023456"], 
    counterpart_category=["biolink:Gene", "biolink:Disease"]
)

to_json(results, file="test_multi_endpoint.json")

note: i still need to add the extra entity_ fields after fetching the associations, as they're not returned from Solr when doing a get entity Done

@oneilsh
Copy link

oneilsh commented Oct 12, 2023

@glass-ships , the format looks good :) The data though is a bit suspect now - for that example the result for MONDO:0005439 doesn't link to any genes (but I think it should?), but also links to itself several times via a biolink:subclass_of predicate. Here's the full output:

{
    "offset_per_category": 0,
    "limit_per_category": 20,
    "entities": [
        {
            "entity_id": "MONDO:0012933",
            "entity_label": "breast-ovarian cancer, familial, susceptibility to, 2",
            "original_entity": null,
            "entity_namespace": "MONDO",
            "entity_category": "biolink:Disease",
            "entity_closure": [
                "MONDO:0012933",
                "MONDO:0020573",
                "BFO:0000002",
                "BFO:0000017",
                "BFO:0000020",
                "MONDO:0042489",
                "BFO:0000016",
                "BFO:0000001"
            ],
            "entity_closure_label": [
                "entity",
                "continuant",
                "disposition",
                "realizable entity",
                "specifically dependent continuant",
                "breast-ovarian cancer, familial, susceptibility to, 2",
                "inherited disease susceptibility",
                "disease susceptibility"
            ],
            "entity_taxon": null,
            "entity_taxon_label": null,
            "associated_categories": [
                {
                    "counterpart_category": "biolink:Gene",
                    "total": 1,
                    "associations": [
                        {
                            "id": "uuid:c2bbc324-5d8c-11ee-9b27-2b20ed86a9d9",
                            "category": "biolink:CorrelatedGeneToDiseaseAssociation",
                            "counterpart_id": "HGNC:1101",
                            "original_counterpart": "NCBIGene:675",
                            "counterpart_namespace": "HGNC",
                            "counterpart_category": "biolink:Gene",
                            "counterpart_closure": [],
                            "counterpart_label": "BRCA2",
                            "counterpart_closure_label": [],
                            "counterpart_taxon": "NCBITaxon:9606",
                            "counterpart_taxon_label": "Homo sapiens",
                            "predicate": "biolink:contributes_to",
                            "primary_knowledge_source": "infores:omim",
                            "aggregator_knowledge_source": [
                                "infores:monarchinitiative",
                                "infores:medgen"
                            ],
                            "negated": null,
                            "pathway": null,
                            "provided_by": "hpoa_gene_to_disease_edges",
                            "provided_by_link": {
                                "id": "hpoa_gene_to_disease",
                                "url": "https://monarch-initiative.github.io/monarch-ingest/Sources/hpoa/#gene_to_disease"
                            },
                            "publications": [],
                            "qualifiers": [],
                            "has_evidence": [],
                            "evidence_count": 2,
                            "frequency_qualifier": null,
                            "onset_qualifier": null,
                            "sex_qualifier": null,
                            "stage_qualifier": null,
                            "frequency_qualifier_label": null,
                            "frequency_qualifier_namespace": null,
                            "frequency_qualifier_category": null,
                            "frequency_qualifier_closure": [],
                            "frequency_qualifier_closure_label": [],
                            "onset_qualifier_label": null,
                            "onset_qualifier_namespace": null,
                            "onset_qualifier_category": null,
                            "onset_qualifier_closure": [],
                            "onset_qualifier_closure_label": [],
                            "sex_qualifier_label": null,
                            "sex_qualifier_namespace": null,
                            "sex_qualifier_category": null,
                            "sex_qualifier_closure": [],
                            "sex_qualifier_closure_label": [],
                            "stage_qualifier_label": null,
                            "stage_qualifier_namespace": null,
                            "stage_qualifier_category": null,
                            "stage_qualifier_closure": [],
                            "stage_qualifier_closure_label": []
                        }
                    ]
                },
                {
                    "counterpart_category": "biolink:Disease",
                    "total": 2,
                    "associations": [
                        {
                            "id": "urn:uuid:81c3d222-f94f-4e3f-b8a0-e624da4615fc",
                            "category": "biolink:Association",
                            "counterpart_id": "MONDO:0003582",
                            "original_counterpart": null,
                            "counterpart_namespace": "MONDO",
                            "counterpart_category": "biolink:Disease",
                            "counterpart_closure": [
                                "MONDO:0000001",
                                "MONDO:0000429",
                                "MONDO:0003582",
                                "MONDO:0020573",
                                "BFO:0000002",
                                "MONDO:0045024",
                                "BFO:0000017",
                                "BFO:0000020",
                                "MONDO:0023370",
                                "MONDO:0042489",
                                "MONDO:0021058",
                                "BFO:0000016",
                                "MONDO:0700096",
                                "MONDO:0002254",
                                "MONDO:0015356",
                                "MONDO:0000426",
                                "OGMS:0000031",
                                "MONDO:0003847",
                                "BFO:0000001"
                            ],
                            "counterpart_label": "hereditary breast ovarian cancer syndrome",
                            "counterpart_closure_label": [
                                "entity",
                                "continuant",
                                "disposition",
                                "realizable entity",
                                "specifically dependent continuant",
                                "disease",
                                "autosomal dominant disease",
                                "autosomal genetic disease",
                                "syndromic disease",
                                "hereditary breast ovarian cancer syndrome",
                                "hereditary disease",
                                "hereditary neoplastic syndrome",
                                "inherited disease susceptibility",
                                "neoplastic syndrome",
                                "neoplastic disease or syndrome",
                                "disease susceptibility",
                                "cancer or benign tumor",
                                "human disease",
                                "disease"
                            ],
                            "counterpart_taxon": null,
                            "counterpart_taxon_label": null,
                            "predicate": "biolink:related_to",
                            "primary_knowledge_source": "infores:mondo",
                            "aggregator_knowledge_source": [
                                "infores:phenio"
                            ],
                            "negated": null,
                            "pathway": null,
                            "provided_by": "phenio_edges",
                            "provided_by_link": {
                                "id": "phenio",
                                "url": "https://monarch-initiative.github.io/monarch-ingest/Sources/phenio/#"
                            },
                            "publications": [],
                            "qualifiers": [],
                            "has_evidence": [],
                            "evidence_count": 2,
                            "frequency_qualifier": null,
                            "onset_qualifier": null,
                            "sex_qualifier": null,
                            "stage_qualifier": null,
                            "frequency_qualifier_label": null,
                            "frequency_qualifier_namespace": null,
                            "frequency_qualifier_category": null,
                            "frequency_qualifier_closure": [],
                            "frequency_qualifier_closure_label": [],
                            "onset_qualifier_label": null,
                            "onset_qualifier_namespace": null,
                            "onset_qualifier_category": null,
                            "onset_qualifier_closure": [],
                            "onset_qualifier_closure_label": [],
                            "sex_qualifier_label": null,
                            "sex_qualifier_namespace": null,
                            "sex_qualifier_category": null,
                            "sex_qualifier_closure": [],
                            "sex_qualifier_closure_label": [],
                            "stage_qualifier_label": null,
                            "stage_qualifier_namespace": null,
                            "stage_qualifier_category": null,
                            "stage_qualifier_closure": [],
                            "stage_qualifier_closure_label": []
                        },
                        {
                            "id": "urn:uuid:d4886301-2118-45b0-8b95-5d76bbaeeb86",
                            "category": "biolink:Association",
                            "counterpart_id": "MONDO:0020573",
                            "original_counterpart": null,
                            "counterpart_namespace": "MONDO",
                            "counterpart_category": "biolink:Disease",
                            "counterpart_closure": [
                                "MONDO:0020573",
                                "BFO:0000002",
                                "BFO:0000017",
                                "BFO:0000020",
                                "MONDO:0042489",
                                "BFO:0000016",
                                "BFO:0000001"
                            ],
                            "counterpart_label": "inherited disease susceptibility",
                            "counterpart_closure_label": [
                                "entity",
                                "continuant",
                                "disposition",
                                "realizable entity",
                                "specifically dependent continuant",
                                "inherited disease susceptibility",
                                "disease susceptibility"
                            ],
                            "counterpart_taxon": null,
                            "counterpart_taxon_label": null,
                            "predicate": "biolink:subclass_of",
                            "primary_knowledge_source": "infores:mondo",
                            "aggregator_knowledge_source": [
                                "infores:phenio"
                            ],
                            "negated": null,
                            "pathway": null,
                            "provided_by": "phenio_edges",
                            "provided_by_link": {
                                "id": "phenio",
                                "url": "https://monarch-initiative.github.io/monarch-ingest/Sources/phenio/#"
                            },
                            "publications": [],
                            "qualifiers": [],
                            "has_evidence": [],
                            "evidence_count": 2,
                            "frequency_qualifier": null,
                            "onset_qualifier": null,
                            "sex_qualifier": null,
                            "stage_qualifier": null,
                            "frequency_qualifier_label": null,
                            "frequency_qualifier_namespace": null,
                            "frequency_qualifier_category": null,
                            "frequency_qualifier_closure": [],
                            "frequency_qualifier_closure_label": [],
                            "onset_qualifier_label": null,
                            "onset_qualifier_namespace": null,
                            "onset_qualifier_category": null,
                            "onset_qualifier_closure": [],
                            "onset_qualifier_closure_label": [],
                            "sex_qualifier_label": null,
                            "sex_qualifier_namespace": null,
                            "sex_qualifier_category": null,
                            "sex_qualifier_closure": [],
                            "sex_qualifier_closure_label": [],
                            "stage_qualifier_label": null,
                            "stage_qualifier_namespace": null,
                            "stage_qualifier_category": null,
                            "stage_qualifier_closure": [],
                            "stage_qualifier_closure_label": []
                        }
                    ]
                }
            ]
        },
        {
            "entity_id": "MONDO:0005439",
            "entity_label": "familial hypercholesterolemia",
            "original_entity": null,
            "entity_namespace": "MONDO",
            "entity_category": "biolink:Disease",
            "entity_closure": [
                "MONDO:0000001",
                "MONDO:0037748",
                "MONDO:0001336",
                "BFO:0000002",
                "BFO:0000017",
                "BFO:0000020",
                "MONDO:0002525",
                "MONDO:0005439",
                "BFO:0000016",
                "MONDO:0700096",
                "MONDO:0021187",
                "OGMS:0000031",
                "MONDO:0003847",
                "BFO:0000001",
                "MONDO:0019052",
                "MONDO:0005066"
            ],
            "entity_closure_label": [
                "entity",
                "continuant",
                "disposition",
                "realizable entity",
                "specifically dependent continuant",
                "disease",
                "familial hyperlipidemia",
                "inherited lipid metabolism disorder",
                "hereditary disease",
                "metabolic disease",
                "familial hypercholesterolemia",
                "inborn errors of metabolism",
                "hyperlipidemia",
                "hyperlipoproteinemia",
                "human disease",
                "disease"
            ],
            "entity_taxon": null,
            "entity_taxon_label": null,
            "associated_categories": [
                {
                    "counterpart_category": "biolink:Gene",
                    "total": 0,
                    "associations": []
                },
                {
                    "counterpart_category": "biolink:Disease",
                    "total": 7,
                    "associations": [
                        {
                            "id": "urn:uuid:943819e8-748c-4e5b-a7dd-0e7b22109a82",
                            "category": "biolink:Association",
                            "counterpart_id": "MONDO:0001336",
                            "original_counterpart": null,
                            "counterpart_namespace": "MONDO",
                            "counterpart_category": "biolink:Disease",
                            "counterpart_closure": [
                                "MONDO:0000001",
                                "MONDO:0001336",
                                "BFO:0000002",
                                "BFO:0000017",
                                "BFO:0000020",
                                "MONDO:0002525",
                                "BFO:0000016",
                                "MONDO:0700096",
                                "MONDO:0021187",
                                "OGMS:0000031",
                                "MONDO:0003847",
                                "BFO:0000001",
                                "MONDO:0019052",
                                "MONDO:0005066"
                            ],
                            "counterpart_label": "familial hyperlipidemia",
                            "counterpart_closure_label": [
                                "entity",
                                "continuant",
                                "disposition",
                                "realizable entity",
                                "specifically dependent continuant",
                                "disease",
                                "familial hyperlipidemia",
                                "inherited lipid metabolism disorder",
                                "hereditary disease",
                                "metabolic disease",
                                "inborn errors of metabolism",
                                "hyperlipidemia",
                                "human disease",
                                "disease"
                            ],
                            "counterpart_taxon": null,
                            "counterpart_taxon_label": null,
                            "predicate": "biolink:subclass_of",
                            "primary_knowledge_source": "infores:mondo",
                            "aggregator_knowledge_source": [
                                "infores:phenio"
                            ],
                            "negated": null,
                            "pathway": null,
                            "provided_by": "phenio_edges",
                            "provided_by_link": {
                                "id": "phenio",
                                "url": "https://monarch-initiative.github.io/monarch-ingest/Sources/phenio/#"
                            },
                            "publications": [],
                            "qualifiers": [],
                            "has_evidence": [],
                            "evidence_count": 2,
                            "frequency_qualifier": null,
                            "onset_qualifier": null,
                            "sex_qualifier": null,
                            "stage_qualifier": null,
                            "frequency_qualifier_label": null,
                            "frequency_qualifier_namespace": null,
                            "frequency_qualifier_category": null,
                            "frequency_qualifier_closure": [],
                            "frequency_qualifier_closure_label": [],
                            "onset_qualifier_label": null,
                            "onset_qualifier_namespace": null,
                            "onset_qualifier_category": null,
                            "onset_qualifier_closure": [],
                            "onset_qualifier_closure_label": [],
                            "sex_qualifier_label": null,
                            "sex_qualifier_namespace": null,
                            "sex_qualifier_category": null,
                            "sex_qualifier_closure": [],
                            "sex_qualifier_closure_label": [],
                            "stage_qualifier_label": null,
                            "stage_qualifier_namespace": null,
                            "stage_qualifier_category": null,
                            "stage_qualifier_closure": [],
                            "stage_qualifier_closure_label": []
                        },
                        {
                            "id": "urn:uuid:1bdf65e3-5d31-4e2a-b463-ab0994fc5590",
                            "category": "biolink:Association",
                            "counterpart_id": "MONDO:0005439",
                            "original_counterpart": null,
                            "counterpart_namespace": "MONDO",
                            "counterpart_category": "biolink:Disease",
                            "counterpart_closure": [
                                "MONDO:0000001",
                                "MONDO:0037748",
                                "MONDO:0001336",
                                "BFO:0000002",
                                "BFO:0000017",
                                "BFO:0000020",
                                "MONDO:0002525",
                                "MONDO:0005439",
                                "BFO:0000016",
                                "MONDO:0700096",
                                "MONDO:0021187",
                                "OGMS:0000031",
                                "MONDO:0003847",
                                "BFO:0000001",
                                "MONDO:0019052",
                                "MONDO:0005066"
                            ],
                            "counterpart_label": "familial hypercholesterolemia",
                            "counterpart_closure_label": [
                                "entity",
                                "continuant",
                                "disposition",
                                "realizable entity",
                                "specifically dependent continuant",
                                "disease",
                                "familial hyperlipidemia",
                                "inherited lipid metabolism disorder",
                                "hereditary disease",
                                "metabolic disease",
                                "familial hypercholesterolemia",
                                "inborn errors of metabolism",
                                "hyperlipidemia",
                                "hyperlipoproteinemia",
                                "human disease",
                                "disease"
                            ],
                            "counterpart_taxon": null,
                            "counterpart_taxon_label": null,
                            "predicate": "biolink:subclass_of",
                            "primary_knowledge_source": "infores:mondo",
                            "aggregator_knowledge_source": [
                                "infores:phenio"
                            ],
                            "negated": null,
                            "pathway": null,
                            "provided_by": "phenio_edges",
                            "provided_by_link": {
                                "id": "phenio",
                                "url": "https://monarch-initiative.github.io/monarch-ingest/Sources/phenio/#"
                            },
                            "publications": [],
                            "qualifiers": [],
                            "has_evidence": [],
                            "evidence_count": 2,
                            "frequency_qualifier": null,
                            "onset_qualifier": null,
                            "sex_qualifier": null,
                            "stage_qualifier": null,
                            "frequency_qualifier_label": null,
                            "frequency_qualifier_namespace": null,
                            "frequency_qualifier_category": null,
                            "frequency_qualifier_closure": [],
                            "frequency_qualifier_closure_label": [],
                            "onset_qualifier_label": null,
                            "onset_qualifier_namespace": null,
                            "onset_qualifier_category": null,
                            "onset_qualifier_closure": [],
                            "onset_qualifier_closure_label": [],
                            "sex_qualifier_label": null,
                            "sex_qualifier_namespace": null,
                            "sex_qualifier_category": null,
                            "sex_qualifier_closure": [],
                            "sex_qualifier_closure_label": [],
                            "stage_qualifier_label": null,
                            "stage_qualifier_namespace": null,
                            "stage_qualifier_category": null,
                            "stage_qualifier_closure": [],
                            "stage_qualifier_closure_label": []
                        },
                        {
                            "id": "urn:uuid:e0f7861b-8283-49c6-aa44-e41586a810ed",
                            "category": "biolink:Association",
                            "counterpart_id": "MONDO:0005439",
                            "original_counterpart": null,
                            "counterpart_namespace": "MONDO",
                            "counterpart_category": "biolink:Disease",
                            "counterpart_closure": [
                                "MONDO:0000001",
                                "MONDO:0037748",
                                "MONDO:0001336",
                                "BFO:0000002",
                                "BFO:0000017",
                                "BFO:0000020",
                                "MONDO:0002525",
                                "MONDO:0005439",
                                "BFO:0000016",
                                "MONDO:0700096",
                                "MONDO:0021187",
                                "OGMS:0000031",
                                "MONDO:0003847",
                                "BFO:0000001",
                                "MONDO:0019052",
                                "MONDO:0005066"
                            ],
                            "counterpart_label": "familial hypercholesterolemia",
                            "counterpart_closure_label": [
                                "entity",
                                "continuant",
                                "disposition",
                                "realizable entity",
                                "specifically dependent continuant",
                                "disease",
                                "familial hyperlipidemia",
                                "inherited lipid metabolism disorder",
                                "hereditary disease",
                                "metabolic disease",
                                "familial hypercholesterolemia",
                                "inborn errors of metabolism",
                                "hyperlipidemia",
                                "hyperlipoproteinemia",
                                "human disease",
                                "disease"
                            ],
                            "counterpart_taxon": null,
                            "counterpart_taxon_label": null,
                            "predicate": "biolink:subclass_of",
                            "primary_knowledge_source": "infores:mondo",
                            "aggregator_knowledge_source": [
                                "infores:phenio"
                            ],
                            "negated": null,
                            "pathway": null,
                            "provided_by": "phenio_edges",
                            "provided_by_link": {
                                "id": "phenio",
                                "url": "https://monarch-initiative.github.io/monarch-ingest/Sources/phenio/#"
                            },
                            "publications": [],
                            "qualifiers": [],
                            "has_evidence": [],
                            "evidence_count": 2,
                            "frequency_qualifier": null,
                            "onset_qualifier": null,
                            "sex_qualifier": null,
                            "stage_qualifier": null,
                            "frequency_qualifier_label": null,
                            "frequency_qualifier_namespace": null,
                            "frequency_qualifier_category": null,
                            "frequency_qualifier_closure": [],
                            "frequency_qualifier_closure_label": [],
                            "onset_qualifier_label": null,
                            "onset_qualifier_namespace": null,
                            "onset_qualifier_category": null,
                            "onset_qualifier_closure": [],
                            "onset_qualifier_closure_label": [],
                            "sex_qualifier_label": null,
                            "sex_qualifier_namespace": null,
                            "sex_qualifier_category": null,
                            "sex_qualifier_closure": [],
                            "sex_qualifier_closure_label": [],
                            "stage_qualifier_label": null,
                            "stage_qualifier_namespace": null,
                            "stage_qualifier_category": null,
                            "stage_qualifier_closure": [],
                            "stage_qualifier_closure_label": []
                        },
                        {
                            "id": "urn:uuid:e39a02a3-f696-4875-8fdc-8524cb14f921",
                            "category": "biolink:Association",
                            "counterpart_id": "MONDO:0005439",
                            "original_counterpart": null,
                            "counterpart_namespace": "MONDO",
                            "counterpart_category": "biolink:Disease",
                            "counterpart_closure": [
                                "MONDO:0000001",
                                "MONDO:0037748",
                                "MONDO:0001336",
                                "BFO:0000002",
                                "BFO:0000017",
                                "BFO:0000020",
                                "MONDO:0002525",
                                "MONDO:0005439",
                                "BFO:0000016",
                                "MONDO:0700096",
                                "MONDO:0021187",
                                "OGMS:0000031",
                                "MONDO:0003847",
                                "BFO:0000001",
                                "MONDO:0019052",
                                "MONDO:0005066"
                            ],
                            "counterpart_label": "familial hypercholesterolemia",
                            "counterpart_closure_label": [
                                "entity",
                                "continuant",
                                "disposition",
                                "realizable entity",
                                "specifically dependent continuant",
                                "disease",
                                "familial hyperlipidemia",
                                "inherited lipid metabolism disorder",
                                "hereditary disease",
                                "metabolic disease",
                                "familial hypercholesterolemia",
                                "inborn errors of metabolism",
                                "hyperlipidemia",
                                "hyperlipoproteinemia",
                                "human disease",
                                "disease"
                            ],
                            "counterpart_taxon": null,
                            "counterpart_taxon_label": null,
                            "predicate": "biolink:subclass_of",
                            "primary_knowledge_source": "infores:mondo",
                            "aggregator_knowledge_source": [
                                "infores:phenio"
                            ],
                            "negated": null,
                            "pathway": null,
                            "provided_by": "phenio_edges",
                            "provided_by_link": {
                                "id": "phenio",
                                "url": "https://monarch-initiative.github.io/monarch-ingest/Sources/phenio/#"
                            },
                            "publications": [],
                            "qualifiers": [],
                            "has_evidence": [],
                            "evidence_count": 2,
                            "frequency_qualifier": null,
                            "onset_qualifier": null,
                            "sex_qualifier": null,
                            "stage_qualifier": null,
                            "frequency_qualifier_label": null,
                            "frequency_qualifier_namespace": null,
                            "frequency_qualifier_category": null,
                            "frequency_qualifier_closure": [],
                            "frequency_qualifier_closure_label": [],
                            "onset_qualifier_label": null,
                            "onset_qualifier_namespace": null,
                            "onset_qualifier_category": null,
                            "onset_qualifier_closure": [],
                            "onset_qualifier_closure_label": [],
                            "sex_qualifier_label": null,
                            "sex_qualifier_namespace": null,
                            "sex_qualifier_category": null,
                            "sex_qualifier_closure": [],
                            "sex_qualifier_closure_label": [],
                            "stage_qualifier_label": null,
                            "stage_qualifier_namespace": null,
                            "stage_qualifier_category": null,
                            "stage_qualifier_closure": [],
                            "stage_qualifier_closure_label": []
                        },
                        {
                            "id": "urn:uuid:5fa7d3be-deb9-4dde-8c0c-6531f84caf4b",
                            "category": "biolink:Association",
                            "counterpart_id": "MONDO:0005439",
                            "original_counterpart": null,
                            "counterpart_namespace": "MONDO",
                            "counterpart_category": "biolink:Disease",
                            "counterpart_closure": [
                                "MONDO:0000001",
                                "MONDO:0037748",
                                "MONDO:0001336",
                                "BFO:0000002",
                                "BFO:0000017",
                                "BFO:0000020",
                                "MONDO:0002525",
                                "MONDO:0005439",
                                "BFO:0000016",
                                "MONDO:0700096",
                                "MONDO:0021187",
                                "OGMS:0000031",
                                "MONDO:0003847",
                                "BFO:0000001",
                                "MONDO:0019052",
                                "MONDO:0005066"
                            ],
                            "counterpart_label": "familial hypercholesterolemia",
                            "counterpart_closure_label": [
                                "entity",
                                "continuant",
                                "disposition",
                                "realizable entity",
                                "specifically dependent continuant",
                                "disease",
                                "familial hyperlipidemia",
                                "inherited lipid metabolism disorder",
                                "hereditary disease",
                                "metabolic disease",
                                "familial hypercholesterolemia",
                                "inborn errors of metabolism",
                                "hyperlipidemia",
                                "hyperlipoproteinemia",
                                "human disease",
                                "disease"
                            ],
                            "counterpart_taxon": null,
                            "counterpart_taxon_label": null,
                            "predicate": "biolink:subclass_of",
                            "primary_knowledge_source": "infores:mondo",
                            "aggregator_knowledge_source": [
                                "infores:phenio"
                            ],
                            "negated": null,
                            "pathway": null,
                            "provided_by": "phenio_edges",
                            "provided_by_link": {
                                "id": "phenio",
                                "url": "https://monarch-initiative.github.io/monarch-ingest/Sources/phenio/#"
                            },
                            "publications": [],
                            "qualifiers": [],
                            "has_evidence": [],
                            "evidence_count": 2,
                            "frequency_qualifier": null,
                            "onset_qualifier": null,
                            "sex_qualifier": null,
                            "stage_qualifier": null,
                            "frequency_qualifier_label": null,
                            "frequency_qualifier_namespace": null,
                            "frequency_qualifier_category": null,
                            "frequency_qualifier_closure": [],
                            "frequency_qualifier_closure_label": [],
                            "onset_qualifier_label": null,
                            "onset_qualifier_namespace": null,
                            "onset_qualifier_category": null,
                            "onset_qualifier_closure": [],
                            "onset_qualifier_closure_label": [],
                            "sex_qualifier_label": null,
                            "sex_qualifier_namespace": null,
                            "sex_qualifier_category": null,
                            "sex_qualifier_closure": [],
                            "sex_qualifier_closure_label": [],
                            "stage_qualifier_label": null,
                            "stage_qualifier_namespace": null,
                            "stage_qualifier_category": null,
                            "stage_qualifier_closure": [],
                            "stage_qualifier_closure_label": []
                        },
                        {
                            "id": "urn:uuid:c891ae85-fb87-497f-85aa-079c1397b545",
                            "category": "biolink:Association",
                            "counterpart_id": "MONDO:0005439",
                            "original_counterpart": null,
                            "counterpart_namespace": "MONDO",
                            "counterpart_category": "biolink:Disease",
                            "counterpart_closure": [
                                "MONDO:0000001",
                                "MONDO:0037748",
                                "MONDO:0001336",
                                "BFO:0000002",
                                "BFO:0000017",
                                "BFO:0000020",
                                "MONDO:0002525",
                                "MONDO:0005439",
                                "BFO:0000016",
                                "MONDO:0700096",
                                "MONDO:0021187",
                                "OGMS:0000031",
                                "MONDO:0003847",
                                "BFO:0000001",
                                "MONDO:0019052",
                                "MONDO:0005066"
                            ],
                            "counterpart_label": "familial hypercholesterolemia",
                            "counterpart_closure_label": [
                                "entity",
                                "continuant",
                                "disposition",
                                "realizable entity",
                                "specifically dependent continuant",
                                "disease",
                                "familial hyperlipidemia",
                                "inherited lipid metabolism disorder",
                                "hereditary disease",
                                "metabolic disease",
                                "familial hypercholesterolemia",
                                "inborn errors of metabolism",
                                "hyperlipidemia",
                                "hyperlipoproteinemia",
                                "human disease",
                                "disease"
                            ],
                            "counterpart_taxon": null,
                            "counterpart_taxon_label": null,
                            "predicate": "biolink:subclass_of",
                            "primary_knowledge_source": "infores:mondo",
                            "aggregator_knowledge_source": [
                                "infores:phenio"
                            ],
                            "negated": null,
                            "pathway": null,
                            "provided_by": "phenio_edges",
                            "provided_by_link": {
                                "id": "phenio",
                                "url": "https://monarch-initiative.github.io/monarch-ingest/Sources/phenio/#"
                            },
                            "publications": [],
                            "qualifiers": [],
                            "has_evidence": [],
                            "evidence_count": 2,
                            "frequency_qualifier": null,
                            "onset_qualifier": null,
                            "sex_qualifier": null,
                            "stage_qualifier": null,
                            "frequency_qualifier_label": null,
                            "frequency_qualifier_namespace": null,
                            "frequency_qualifier_category": null,
                            "frequency_qualifier_closure": [],
                            "frequency_qualifier_closure_label": [],
                            "onset_qualifier_label": null,
                            "onset_qualifier_namespace": null,
                            "onset_qualifier_category": null,
                            "onset_qualifier_closure": [],
                            "onset_qualifier_closure_label": [],
                            "sex_qualifier_label": null,
                            "sex_qualifier_namespace": null,
                            "sex_qualifier_category": null,
                            "sex_qualifier_closure": [],
                            "sex_qualifier_closure_label": [],
                            "stage_qualifier_label": null,
                            "stage_qualifier_namespace": null,
                            "stage_qualifier_category": null,
                            "stage_qualifier_closure": [],
                            "stage_qualifier_closure_label": []
                        },
                        {
                            "id": "urn:uuid:4f565ba1-7e84-43d8-a885-672d4e5cef70",
                            "category": "biolink:Association",
                            "counterpart_id": "MONDO:0037748",
                            "original_counterpart": null,
                            "counterpart_namespace": "MONDO",
                            "counterpart_category": "biolink:Disease",
                            "counterpart_closure": [
                                "MONDO:0000001",
                                "MONDO:0037748",
                                "BFO:0000002",
                                "BFO:0000017",
                                "BFO:0000020",
                                "BFO:0000016",
                                "MONDO:0700096",
                                "MONDO:0021187",
                                "OGMS:0000031",
                                "BFO:0000001",
                                "MONDO:0005066"
                            ],
                            "counterpart_label": "hyperlipoproteinemia",
                            "counterpart_closure_label": [
                                "entity",
                                "continuant",
                                "disposition",
                                "realizable entity",
                                "specifically dependent continuant",
                                "disease",
                                "metabolic disease",
                                "hyperlipidemia",
                                "hyperlipoproteinemia",
                                "human disease",
                                "disease"
                            ],
                            "counterpart_taxon": null,
                            "counterpart_taxon_label": null,
                            "predicate": "biolink:subclass_of",
                            "primary_knowledge_source": "infores:mondo",
                            "aggregator_knowledge_source": [
                                "infores:phenio"
                            ],
                            "negated": null,
                            "pathway": null,
                            "provided_by": "phenio_edges",
                            "provided_by_link": {
                                "id": "phenio",
                                "url": "https://monarch-initiative.github.io/monarch-ingest/Sources/phenio/#"
                            },
                            "publications": [],
                            "qualifiers": [],
                            "has_evidence": [],
                            "evidence_count": 2,
                            "frequency_qualifier": null,
                            "onset_qualifier": null,
                            "sex_qualifier": null,
                            "stage_qualifier": null,
                            "frequency_qualifier_label": null,
                            "frequency_qualifier_namespace": null,
                            "frequency_qualifier_category": null,
                            "frequency_qualifier_closure": [],
                            "frequency_qualifier_closure_label": [],
                            "onset_qualifier_label": null,
                            "onset_qualifier_namespace": null,
                            "onset_qualifier_category": null,
                            "onset_qualifier_closure": [],
                            "onset_qualifier_closure_label": [],
                            "sex_qualifier_label": null,
                            "sex_qualifier_namespace": null,
                            "sex_qualifier_category": null,
                            "sex_qualifier_closure": [],
                            "sex_qualifier_closure_label": [],
                            "stage_qualifier_label": null,
                            "stage_qualifier_namespace": null,
                            "stage_qualifier_category": null,
                            "stage_qualifier_closure": [],
                            "stage_qualifier_closure_label": []
                        }
                    ]
                }
            ]
        },
        {
            "entity_id": "MANGO:0023456",
            "entity_label": "Entity not found",
            "original_entity": null,
            "entity_namespace": null,
            "entity_category": null,
            "entity_closure": [],
            "entity_closure_label": [],
            "entity_taxon": null,
            "entity_taxon_label": null,
            "associated_categories": []
        }
    ]
}

@glass-ships
Copy link
Collaborator Author

to be honest i'm not exactly sure why that would be, but it does seem to line up with the previous output before these changes:

image

it's possible the logic isn't quite right, maybe @kevinschaper can take a look at the query builder / response parser to make sure they make sense, but the biology of things is outside my wheelhouse

@oneilsh
Copy link

oneilsh commented Oct 20, 2023

@kevinschaper when you get a moment can you dig into the logic on the association? I gather some predicates can be "reflexive" and allow self-association, but having it reported multiple times doesn't seem right ;)

@glass-ships glass-ships changed the title re-thinking approach to multi-entity endpoint Update multi-entity endpoint Oct 24, 2023
kevinschaper
kevinschaper previously approved these changes Oct 24, 2023
@kevinschaper
Copy link
Member

Oops, hold off on the merge. I do wonder if we need to have some extra filtering.

@kevinschaper
Copy link
Member

kevinschaper commented Oct 24, 2023

Not the most important part, and I suppose the model is kind of set, but I wonder if the entity prefix is necessary when the list is already named entities?

  "entities": [
    {
      "entity_id": "MONDO:0008243",
      "entity_label": "Pick disease",
      "original_entity": "OMIM:172700",
      "entity_namespace": "MONDO",
      "entity_category": "biolink:Disease",
      "entity_closure": [•],
      "entity_closure_label": [•],
      "entity_taxon": null,
      "entity_taxon_label": null,
      "associated_categories": [

--edit, ok, now I'm seeing the counterpart_ prefix within the collections, ok, never mind, this is good

@kevinschaper
Copy link
Member

it seems like directionality isn't captured/preserved.

If I query with

/v3/api/association/multi?entity=MONDO:0024238&counterpart_category=biolink%3AGene&counterpart_category=biolink:Disease&limit=20&offset=0

I get (paraphrased):

entity: cerebral degeneration
associations: 
  - subclass_of neurodegenerative disease
  - subclass_of brain disorder
  - subclass_of cerebral degeneration  (here's the weird self association)
  - subclass_of cerebral degeneration  (and another one)

The actual disease associations from MONDO:0024238 are:

subject_label predicate object_label
cerebral degeneration biolink:subclass_of neurodegenerative disease
cerebral degeneration biolink:subclass_of brain disorder
Pick disease biolink:subclass_of cerebral degeneration
corticobasal degeneration disorder biolink:subclass_of cerebral degeneration

I'm guessing that the bug part is that that it's getting the self side the bottom two associations, but I it definitely wouldn't be valid if it returned the other side and ended up with:

entity: cerebral degeneration
associations: 
  - subclass_of neurodegenerative disease
  - subclass_of brain disorder
  - subclass_of Pick disease
  - subclass_of corticobasal degeneration disorder

@kevinschaper
Copy link
Member

I don't know if it's a dealbreaker for this being a useful endpoint, but it would feel a lot more correct to return full associations rather than trying to just return the "other side" and having predicate/directionality challenges.

@glass-ships glass-ships self-assigned this Nov 8, 2023
@glass-ships glass-ships dismissed kevinschaper’s stale review November 8, 2023 19:57

not actually ready yet

@glass-ships
Copy link
Collaborator Author

@oneilsh would an acceptable approach to this be to return (in pseudo-model):

{
    this entity: ...
    counterpart entity: ...
    association: ...
}

where the association is just the edge as it exists in the KG?

That way the directionality of the edge is maintained and it's less misleading if this_entity is the object, rather than the subject, but the predicate is unchanged

(and even if the predicate is changed, it implies the existence of an edge in the kg that may not actually be there)

@sagehrke sagehrke requested a review from oneilsh December 19, 2023 21:53
@oneilsh
Copy link

oneilsh commented Jan 2, 2024

Closing for now, see note #365 (comment)

@oneilsh oneilsh closed this Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants