diff --git a/backend/src/monarch_py/api/entity.py b/backend/src/monarch_py/api/entity.py index 83db75342..fb4002c14 100644 --- a/backend/src/monarch_py/api/entity.py +++ b/backend/src/monarch_py/api/entity.py @@ -81,6 +81,11 @@ def _association_table( title="Download the results as a file", examples=[True, False], ), + direct: bool = Query( + default=False, + title="Only return direct associations", + examples=[True, False], + ), ) -> Union[AssociationTableResults, str]: """ Retrieves association table data for a given entity and association type @@ -99,6 +104,7 @@ def _association_table( category=category, q=query, traverse_orthologs=traverse_orthologs, + direct=direct, sort=sort, offset=pagination.offset, limit=pagination.limit, diff --git a/backend/src/monarch_py/implementations/solr/solr_implementation.py b/backend/src/monarch_py/implementations/solr/solr_implementation.py index 4605aa942..a432af2bf 100644 --- a/backend/src/monarch_py/implementations/solr/solr_implementation.py +++ b/backend/src/monarch_py/implementations/solr/solr_implementation.py @@ -463,6 +463,7 @@ def get_association_table( entity: str, category: AssociationCategory, traverse_orthologs: bool = False, + direct: bool = False, q: Optional[str] = None, sort: Optional[List[str]] = None, offset: int = 0, @@ -480,6 +481,7 @@ def get_association_table( query = build_association_table_query( entity=entities, category=category.value, + direct=direct, q=q, sort=sort, offset=offset, diff --git a/backend/src/monarch_py/implementations/solr/solr_query_utils.py b/backend/src/monarch_py/implementations/solr/solr_query_utils.py index 690a84ab6..4eb684eec 100644 --- a/backend/src/monarch_py/implementations/solr/solr_query_utils.py +++ b/backend/src/monarch_py/implementations/solr/solr_query_utils.py @@ -75,7 +75,13 @@ def build_association_query( def build_association_table_query( - entity: List[str], category: str, q: Optional[str] = None, offset: int = 0, limit: int = 5, sort: List[str] = None + entity: List[str], + category: str, + direct: bool = False, + q: Optional[str] = None, + offset: int = 0, + limit: int = 5, + sort: List[str] = None, ) -> SolrQuery: if sort is None: sort = [ @@ -88,7 +94,7 @@ def build_association_table_query( ] query = build_association_query( - entity=entity, category=[category], q=q, sort=sort, offset=offset, limit=limit, direct=False + entity=entity, category=[category], q=q, sort=sort, offset=offset, limit=limit, direct=direct ) return query diff --git a/backend/tests/api/test_entity_router.py b/backend/tests/api/test_entity_router.py index 2ecc4f6c3..0b9cd6b11 100644 --- a/backend/tests/api/test_entity_router.py +++ b/backend/tests/api/test_entity_router.py @@ -25,6 +25,7 @@ def test_association_table(mock_get_assoc_table): category=AssociationCategory.DISEASE_TO_PHENOTYPIC_FEATURE_ASSOCIATION, q=None, traverse_orthologs=False, + direct=False, sort=None, offset=0, limit=20, diff --git a/backend/tests/fixtures/association_counts_response.py b/backend/tests/fixtures/association_counts_response.py index 39bd00b5e..fbc288d79 100644 --- a/backend/tests/fixtures/association_counts_response.py +++ b/backend/tests/fixtures/association_counts_response.py @@ -5,7 +5,7 @@ def association_counts_response(): return { "responseHeader": { - "QTime": 1, + "QTime": 2, "params": { "facet.query": [ '(category:"biolink:DiseaseToPhenotypicFeatureAssociation") AND (subject:"MONDO:0020121" OR subject_closure:"MONDO:0020121")', diff --git a/backend/tests/fixtures/association_table_response.py b/backend/tests/fixtures/association_table_response.py index 9894aa6bf..c98ca9ec8 100644 --- a/backend/tests/fixtures/association_table_response.py +++ b/backend/tests/fixtures/association_table_response.py @@ -5,7 +5,7 @@ def association_table_response(): return { "responseHeader": { - "QTime": 0, + "QTime": 1, "params": { "mm": "100%", "q": "*:*", diff --git a/backend/tests/fixtures/autocomplete_response.py b/backend/tests/fixtures/autocomplete_response.py index 4c068982d..2784ba9d8 100644 --- a/backend/tests/fixtures/autocomplete_response.py +++ b/backend/tests/fixtures/autocomplete_response.py @@ -5,7 +5,7 @@ def autocomplete_response(): return { "responseHeader": { - "QTime": 0, + "QTime": 1, "params": { "mm": "100%", "q": "fanc", diff --git a/backend/tests/fixtures/search_response.py b/backend/tests/fixtures/search_response.py index 0d5941576..4ec64a0a2 100644 --- a/backend/tests/fixtures/search_response.py +++ b/backend/tests/fixtures/search_response.py @@ -5,7 +5,7 @@ def search_response(): return { "responseHeader": { - "QTime": 0, + "QTime": 4, "params": { "mm": "100%", "q": "fanconi", diff --git a/frontend/fixtures/phenotype-explorer-compare.json b/frontend/fixtures/phenotype-explorer-compare.json index a000d4738..1b8f5d773 100644 --- a/frontend/fixtures/phenotype-explorer-compare.json +++ b/frontend/fixtures/phenotype-explorer-compare.json @@ -1,12 +1,12 @@ { "subject_termset": { - "MP:0010771": { - "id": "MP:0010771", - "label": "integument phenotype" - }, "MP:0002169": { "id": "MP:0002169", "label": "no abnormal phenotype detected" + }, + "MP:0010771": { + "id": "MP:0010771", + "label": "integument phenotype" } }, "object_termset": { @@ -77,8 +77,8 @@ "HP:0004325": { "match_source": "HP:0004325", "match_source_label": "Decreased body weight", - "match_target": "MP:0010771", - "match_target_label": "integument phenotype", + "match_target": "MP:0002169", + "match_target_label": "no abnormal phenotype detected", "score": 1.5518735174643892, "match_subsumer": null, "match_subsumer_label": null, @@ -86,7 +86,7 @@ "subject_id": "HP:0004325", "subject_label": null, "subject_source": null, - "object_id": "MP:0010771", + "object_id": "MP:0002169", "object_label": null, "object_source": null, "ancestor_id": "UPHENO:0001003", @@ -95,10 +95,10 @@ "object_information_content": null, "subject_information_content": null, "ancestor_information_content": 1.5518735174643892, - "jaccard_similarity": 0.24, + "jaccard_similarity": 0.23076923076923078, "cosine_similarity": null, "dice_similarity": null, - "phenodigm_score": 0.6102865263066631 + "phenodigm_score": 0.5984351743308522 }, "score_metric": "ancestor_information_content" } diff --git a/frontend/fixtures/phenotype-explorer-multi-compare.json b/frontend/fixtures/phenotype-explorer-multi-compare.json index 1c4cfc932..389fa8c1a 100644 --- a/frontend/fixtures/phenotype-explorer-multi-compare.json +++ b/frontend/fixtures/phenotype-explorer-multi-compare.json @@ -22,57 +22,57 @@ "has_phenotype_closure_label": [], "has_phenotype_count": null }, - "score": 8.60883472685004, + "score": 8.608834726850038, "similarity": { "subject_termset": { "HP:0001533": { "id": "HP:0001533", "label": "Slender build" }, - "HP:0002616": { "id": "HP:0002616", "label": "Aortic root aneurysm" }, - "HP:0001763": { "id": "HP:0001763", "label": "Pes planus" }, - "HP:0010749": { "id": "HP:0010749", "label": "Blepharochalasis" }, "HP:0002020": { "id": "HP:0002020", "label": "Gastroesophageal reflux" }, - "HP:0012450": { "id": "HP:0012450", "label": "Chronic constipation" }, + "HP:0002616": { "id": "HP:0002616", "label": "Aortic root aneurysm" }, "HP:0004944": { "id": "HP:0004944", "label": "Dilatation of the cerebral artery" - } + }, + "HP:0001763": { "id": "HP:0001763", "label": "Pes planus" }, + "HP:0012450": { "id": "HP:0012450", "label": "Chronic constipation" }, + "HP:0010749": { "id": "HP:0010749", "label": "Blepharochalasis" } }, "object_termset": { "MP:0011960": { "id": "MP:0011960", "label": "abnormal eye anterior chamber depth" }, - "MP:0002834": { "id": "MP:0002834", "label": "decreased heart weight" }, "MP:0008489": { "id": "MP:0008489", "label": "slow postnatal weight gain" }, - "MP:0003291": { - "id": "MP:0003291", - "label": "interstinal hyperperistalsis" - }, + "MP:0002834": { "id": "MP:0002834", "label": "decreased heart weight" }, + "MP:0001262": { "id": "MP:0001262", "label": "decreased body weight" }, "MP:0011962": { "id": "MP:0011962", "label": "increased cornea thickness" }, - "MP:0011965": { - "id": "MP:0011965", - "label": "decreased total retina thickness" - }, "MP:0003731": { "id": "MP:0003731", "label": "abnormal retina outer nuclear layer morphology" }, - "MP:0001262": { "id": "MP:0001262", "label": "decreased body weight" } + "MP:0003291": { + "id": "MP:0003291", + "label": "interstinal hyperperistalsis" + }, + "MP:0011965": { + "id": "MP:0011965", + "label": "decreased total retina thickness" + } }, "subject_best_matches": { "HP:0001533": { "match_source": "HP:0001533", "match_source_label": "Slender build", - "match_target": "MP:0001262", - "match_target_label": "decreased body weight", + "match_target": "MP:0008489", + "match_target_label": "slow postnatal weight gain", "score": 13.667892510789482, "match_subsumer": null, "match_subsumer_label": null, @@ -80,7 +80,7 @@ "subject_id": "HP:0001533", "subject_label": null, "subject_source": null, - "object_id": "MP:0001262", + "object_id": "MP:0008489", "object_label": null, "object_source": null, "ancestor_id": "UPHENO:0082794", @@ -89,18 +89,18 @@ "object_information_content": null, "subject_information_content": null, "ancestor_information_content": 13.667892510789482, - "jaccard_similarity": 0.40384615384615385, + "jaccard_similarity": 0.38333333333333336, "cosine_similarity": null, "dice_similarity": null, - "phenodigm_score": 2.34940967514501 + "phenodigm_score": 2.2889645684900053 }, "score_metric": "ancestor_information_content" }, "HP:0001763": { "match_source": "HP:0001763", "match_source_label": "Pes planus", - "match_target": "MP:0011962", - "match_target_label": "increased cornea thickness", + "match_target": "MP:0002834", + "match_target_label": "decreased heart weight", "score": 3.066606173373863, "match_subsumer": null, "match_subsumer_label": null, @@ -108,7 +108,7 @@ "subject_id": "HP:0001763", "subject_label": null, "subject_source": null, - "object_id": "MP:0011962", + "object_id": "MP:0002834", "object_label": null, "object_source": null, "ancestor_id": "UPHENO:0015280", @@ -117,10 +117,10 @@ "object_information_content": null, "subject_information_content": null, "ancestor_information_content": 3.066606173373863, - "jaccard_similarity": 0.16049382716049382, + "jaccard_similarity": 0.203125, "cosine_similarity": null, "dice_similarity": null, - "phenodigm_score": 0.7015492578278222 + "phenodigm_score": 0.7892429150563 }, "score_metric": "ancestor_information_content" }, @@ -211,8 +211,8 @@ "HP:0010749": { "match_source": "HP:0010749", "match_source_label": "Blepharochalasis", - "match_target": "MP:0011965", - "match_target_label": "decreased total retina thickness", + "match_target": "MP:0003731", + "match_target_label": "abnormal retina outer nuclear layer morphology", "score": 6.6792078240173165, "match_subsumer": null, "match_subsumer_label": null, @@ -220,7 +220,7 @@ "subject_id": "HP:0010749", "subject_label": null, "subject_source": null, - "object_id": "MP:0011965", + "object_id": "MP:0003731", "object_label": null, "object_source": null, "ancestor_id": "UPHENO:0087924", @@ -229,10 +229,10 @@ "object_information_content": null, "subject_information_content": null, "ancestor_information_content": 6.6792078240173165, - "jaccard_similarity": 0.24324324324324326, + "jaccard_similarity": 0.23076923076923078, "cosine_similarity": null, "dice_similarity": null, - "phenodigm_score": 1.2746262877446148 + "phenodigm_score": 1.2415134520802842 }, "score_metric": "ancestor_information_content" }, @@ -281,8 +281,8 @@ "object_id": "HP:0001533", "object_label": null, "object_source": null, - "ancestor_id": "UPHENO:0082794", - "ancestor_label": "Decreased multicellular organism mass", + "ancestor_id": "UPHENO:0054299", + "ancestor_label": "decreased multicellular organism mass", "ancestor_source": null, "object_information_content": null, "subject_information_content": null, @@ -325,8 +325,8 @@ "MP:0003291": { "match_source": "MP:0003291", "match_source_label": "interstinal hyperperistalsis", - "match_target": "HP:0012450", - "match_target_label": "Chronic constipation", + "match_target": "HP:0002020", + "match_target_label": "Gastroesophageal reflux", "score": 9.97713534604573, "match_subsumer": null, "match_subsumer_label": null, @@ -334,7 +334,7 @@ "subject_id": "MP:0003291", "subject_label": null, "subject_source": null, - "object_id": "HP:0012450", + "object_id": "HP:0002020", "object_label": null, "object_source": null, "ancestor_id": "UPHENO:0002443", @@ -343,10 +343,10 @@ "object_information_content": null, "subject_information_content": null, "ancestor_information_content": 9.97713534604573, - "jaccard_similarity": 0.4117647058823529, + "jaccard_similarity": 0.3684210526315789, "cosine_similarity": null, "dice_similarity": null, - "phenodigm_score": 2.026877450985369 + "phenodigm_score": 1.9172341292700534 }, "score_metric": "ancestor_information_content" }, @@ -393,8 +393,8 @@ "object_id": "HP:0001533", "object_label": null, "object_source": null, - "ancestor_id": "UPHENO:0054299", - "ancestor_label": "decreased multicellular organism mass", + "ancestor_id": "UPHENO:0082794", + "ancestor_label": "Decreased multicellular organism mass", "ancestor_source": null, "object_information_content": null, "subject_information_content": null, @@ -491,7 +491,7 @@ "score_metric": "ancestor_information_content" } }, - "average_score": 8.60883472685004, + "average_score": 8.608834726850038, "best_score": 13.667892510789482, "metric": "AncestorInformationContent" } @@ -522,16 +522,19 @@ "score": 7.343905449061466, "similarity": { "subject_termset": { - "HP:0001763": { "id": "HP:0001763", "label": "Pes planus" }, - "HP:0004944": { - "id": "HP:0004944", - "label": "Dilatation of the cerebral artery" + "HP:0002020": { + "id": "HP:0002020", + "label": "Gastroesophageal reflux" }, "HP:0001533": { "id": "HP:0001533", "label": "Slender build" }, - "HP:0012450": { "id": "HP:0012450", "label": "Chronic constipation" }, "HP:0010749": { "id": "HP:0010749", "label": "Blepharochalasis" }, "HP:0002616": { "id": "HP:0002616", "label": "Aortic root aneurysm" }, - "HP:0002020": { "id": "HP:0002020", "label": "Gastroesophageal reflux" } + "HP:0012450": { "id": "HP:0012450", "label": "Chronic constipation" }, + "HP:0004944": { + "id": "HP:0004944", + "label": "Dilatation of the cerebral artery" + }, + "HP:0001763": { "id": "HP:0001763", "label": "Pes planus" } }, "object_termset": { "MP:0004022": { @@ -539,37 +542,37 @@ "label": "abnormal cone electrophysiology" }, "MP:0002834": { "id": "MP:0002834", "label": "decreased heart weight" }, - "MP:0003026": { - "id": "MP:0003026", - "label": "decreased vasoconstriction" - }, - "MP:0004021": { - "id": "MP:0004021", - "label": "abnormal rod electrophysiology" - }, "MP:0006264": { "id": "MP:0006264", "label": "decreased systemic arterial systolic blood pressure" }, - "MP:0000230": { - "id": "MP:0000230", - "label": "abnormal systemic arterial blood pressure" - }, "MP:0000233": { "id": "MP:0000233", "label": "abnormal blood flow velocity" }, + "MP:0000272": { + "id": "MP:0000272", + "label": "abnormal aorta morphology" + }, + "MP:0000230": { + "id": "MP:0000230", + "label": "abnormal systemic arterial blood pressure" + }, "MP:0009862": { "id": "MP:0009862", "label": "abnormal aorta elastic tissue morphology" }, + "MP:0004021": { + "id": "MP:0004021", + "label": "abnormal rod electrophysiology" + }, "MP:0003070": { "id": "MP:0003070", "label": "increased vascular permeability" }, - "MP:0000272": { - "id": "MP:0000272", - "label": "abnormal aorta morphology" + "MP:0003026": { + "id": "MP:0003026", + "label": "decreased vasoconstriction" } }, "subject_best_matches": { @@ -688,8 +691,8 @@ "HP:0004944": { "match_source": "HP:0004944", "match_source_label": "Dilatation of the cerebral artery", - "match_target": "MP:0009862", - "match_target_label": "abnormal aorta elastic tissue morphology", + "match_target": "MP:0000272", + "match_target_label": "abnormal aorta morphology", "score": 9.101342047182207, "match_subsumer": null, "match_subsumer_label": null, @@ -697,7 +700,7 @@ "subject_id": "HP:0004944", "subject_label": null, "subject_source": null, - "object_id": "MP:0009862", + "object_id": "MP:0000272", "object_label": null, "object_source": null, "ancestor_id": "UPHENO:0087334", @@ -706,18 +709,18 @@ "object_information_content": null, "subject_information_content": null, "ancestor_information_content": 9.101342047182207, - "jaccard_similarity": 0.25757575757575757, + "jaccard_similarity": 0.2807017543859649, "cosine_similarity": null, "dice_similarity": null, - "phenodigm_score": 1.5311058332979641 + "phenodigm_score": 1.5983624995321914 }, "score_metric": "ancestor_information_content" }, "HP:0010749": { "match_source": "HP:0010749", "match_source_label": "Blepharochalasis", - "match_target": "MP:0004022", - "match_target_label": "abnormal cone electrophysiology", + "match_target": "MP:0004021", + "match_target_label": "abnormal rod electrophysiology", "score": 5.771757578540516, "match_subsumer": null, "match_subsumer_label": null, @@ -725,7 +728,7 @@ "subject_id": "HP:0010749", "subject_label": null, "subject_source": null, - "object_id": "MP:0004022", + "object_id": "MP:0004021", "object_label": null, "object_source": null, "ancestor_id": "UPHENO:0075997", @@ -744,8 +747,8 @@ "HP:0012450": { "match_source": "HP:0012450", "match_source_label": "Chronic constipation", - "match_target": "MP:0003070", - "match_target_label": "increased vascular permeability", + "match_target": "MP:0003026", + "match_target_label": "decreased vasoconstriction", "score": 5.132448071645384, "match_subsumer": null, "match_subsumer_label": null, @@ -753,7 +756,7 @@ "subject_id": "HP:0012450", "subject_label": null, "subject_source": null, - "object_id": "MP:0003070", + "object_id": "MP:0003026", "object_label": null, "object_source": null, "ancestor_id": "UPHENO:0002332", @@ -762,10 +765,10 @@ "object_information_content": null, "subject_information_content": null, "ancestor_information_content": 5.132448071645384, - "jaccard_similarity": 0.2926829268292683, + "jaccard_similarity": 0.2727272727272727, "cosine_similarity": null, "dice_similarity": null, - "phenodigm_score": 1.2256344982940082 + "phenodigm_score": 1.1831139273097055 }, "score_metric": "ancestor_information_content" } @@ -774,8 +777,8 @@ "MP:0000230": { "match_source": "MP:0000230", "match_source_label": "abnormal systemic arterial blood pressure", - "match_target": "HP:0002616", - "match_target_label": "Aortic root aneurysm", + "match_target": "HP:0004944", + "match_target_label": "Dilatation of the cerebral artery", "score": 7.3467487024345575, "match_subsumer": null, "match_subsumer_label": null, @@ -783,7 +786,7 @@ "subject_id": "MP:0000230", "subject_label": null, "subject_source": null, - "object_id": "HP:0002616", + "object_id": "HP:0004944", "object_label": null, "object_source": null, "ancestor_id": "UPHENO:0080362", @@ -792,18 +795,18 @@ "object_information_content": null, "subject_information_content": null, "ancestor_information_content": 7.3467487024345575, - "jaccard_similarity": 0.2558139534883721, + "jaccard_similarity": 0.19642857142857142, "cosine_similarity": null, "dice_similarity": null, - "phenodigm_score": 1.3709124081630277 + "phenodigm_score": 1.2012956972635551 }, "score_metric": "ancestor_information_content" }, "MP:0000233": { "match_source": "MP:0000233", "match_source_label": "abnormal blood flow velocity", - "match_target": "HP:0002616", - "match_target_label": "Aortic root aneurysm", + "match_target": "HP:0004944", + "match_target_label": "Dilatation of the cerebral artery", "score": 7.3467487024345575, "match_subsumer": null, "match_subsumer_label": null, @@ -811,7 +814,7 @@ "subject_id": "MP:0000233", "subject_label": null, "subject_source": null, - "object_id": "HP:0002616", + "object_id": "HP:0004944", "object_label": null, "object_source": null, "ancestor_id": "UPHENO:0080362", @@ -820,10 +823,10 @@ "object_information_content": null, "subject_information_content": null, "ancestor_information_content": 7.3467487024345575, - "jaccard_similarity": 0.23404255319148937, + "jaccard_similarity": 0.18333333333333332, "cosine_similarity": null, "dice_similarity": null, - "phenodigm_score": 1.311278698055469 + "phenodigm_score": 1.160561902174834 }, "score_metric": "ancestor_information_content" }, @@ -886,8 +889,8 @@ "MP:0003026": { "match_source": "MP:0003026", "match_source_label": "decreased vasoconstriction", - "match_target": "HP:0004944", - "match_target_label": "Dilatation of the cerebral artery", + "match_target": "HP:0002616", + "match_target_label": "Aortic root aneurysm", "score": 7.3467487024345575, "match_subsumer": null, "match_subsumer_label": null, @@ -895,7 +898,7 @@ "subject_id": "MP:0003026", "subject_label": null, "subject_source": null, - "object_id": "HP:0004944", + "object_id": "HP:0002616", "object_label": null, "object_source": null, "ancestor_id": "UPHENO:0080362", @@ -904,10 +907,10 @@ "object_information_content": null, "subject_information_content": null, "ancestor_information_content": 7.3467487024345575, - "jaccard_similarity": 0.17391304347826086, + "jaccard_similarity": 0.21428571428571427, "cosine_similarity": null, "dice_similarity": null, - "phenodigm_score": 1.1303519038380736 + "phenodigm_score": 1.2547124345358316 }, "score_metric": "ancestor_information_content" }, @@ -998,8 +1001,8 @@ "MP:0006264": { "match_source": "MP:0006264", "match_source_label": "decreased systemic arterial systolic blood pressure", - "match_target": "HP:0002616", - "match_target_label": "Aortic root aneurysm", + "match_target": "HP:0004944", + "match_target_label": "Dilatation of the cerebral artery", "score": 7.3467487024345575, "match_subsumer": null, "match_subsumer_label": null, @@ -1007,7 +1010,7 @@ "subject_id": "MP:0006264", "subject_label": null, "subject_source": null, - "object_id": "HP:0002616", + "object_id": "HP:0004944", "object_label": null, "object_source": null, "ancestor_id": "UPHENO:0080362", @@ -1016,10 +1019,10 @@ "object_information_content": null, "subject_information_content": null, "ancestor_information_content": 7.3467487024345575, - "jaccard_similarity": 0.24444444444444444, + "jaccard_similarity": 0.1896551724137931, "cosine_similarity": null, "dice_similarity": null, - "phenodigm_score": 1.340101453263729 + "phenodigm_score": 1.1804020043362502 }, "score_metric": "ancestor_information_content" }, diff --git a/frontend/fixtures/phenotype-explorer-search.json b/frontend/fixtures/phenotype-explorer-search.json index b203ef702..99ff9d3ce 100644 --- a/frontend/fixtures/phenotype-explorer-search.json +++ b/frontend/fixtures/phenotype-explorer-search.json @@ -97,8 +97,8 @@ } }, "object_termset": { - "HP:0012378": { "id": "HP:0012378", "label": "Fatigue" }, - "HP:0002104": { "id": "HP:0002104", "label": "Apnea" } + "HP:0002104": { "id": "HP:0002104", "label": "Apnea" }, + "HP:0012378": { "id": "HP:0012378", "label": "Fatigue" } }, "subject_best_matches": { "ZP:0018569": { @@ -302,18 +302,18 @@ "score": 7.011754466426716, "similarity": { "subject_termset": { - "ZP:0018568": { - "id": "ZP:0018568", - "label": "primitive hemopoiesis absent, abnormal" - }, "ZP:0018569": { "id": "ZP:0018569", "label": "myeloid cell development absent, abnormal" + }, + "ZP:0018568": { + "id": "ZP:0018568", + "label": "primitive hemopoiesis absent, abnormal" } }, "object_termset": { - "HP:0012378": { "id": "HP:0012378", "label": "Fatigue" }, - "HP:0002104": { "id": "HP:0002104", "label": "Apnea" } + "HP:0002104": { "id": "HP:0002104", "label": "Apnea" }, + "HP:0012378": { "id": "HP:0012378", "label": "Fatigue" } }, "subject_best_matches": { "ZP:0018568": { @@ -377,8 +377,8 @@ "HP:0002104": { "match_source": "HP:0002104", "match_source_label": "Apnea", - "match_target": "ZP:0018569", - "match_target_label": "myeloid cell development absent, abnormal", + "match_target": "ZP:0018568", + "match_target_label": "primitive hemopoiesis absent, abnormal", "score": 8.79057503056431, "match_subsumer": null, "match_subsumer_label": null, @@ -386,7 +386,7 @@ "subject_id": "HP:0002104", "subject_label": null, "subject_source": null, - "object_id": "ZP:0018569", + "object_id": "ZP:0018568", "object_label": null, "object_source": null, "ancestor_id": "UPHENO:0034024", @@ -618,8 +618,8 @@ "HP:0002104": { "match_source": "HP:0002104", "match_source_label": "Apnea", - "match_target": "ZP:0018568", - "match_target_label": "primitive hemopoiesis absent, abnormal", + "match_target": "ZP:0018569", + "match_target_label": "myeloid cell development absent, abnormal", "score": 8.79057503056431, "match_subsumer": null, "match_subsumer_label": null, @@ -627,7 +627,7 @@ "subject_id": "HP:0002104", "subject_label": null, "subject_source": null, - "object_id": "ZP:0018568", + "object_id": "ZP:0018569", "object_label": null, "object_source": null, "ancestor_id": "UPHENO:0034024", @@ -801,8 +801,8 @@ } }, "object_termset": { - "HP:0002104": { "id": "HP:0002104", "label": "Apnea" }, - "HP:0012378": { "id": "HP:0012378", "label": "Fatigue" } + "HP:0012378": { "id": "HP:0012378", "label": "Fatigue" }, + "HP:0002104": { "id": "HP:0002104", "label": "Apnea" } }, "subject_best_matches": { "ZP:0018568": { @@ -866,8 +866,8 @@ "HP:0002104": { "match_source": "HP:0002104", "match_source_label": "Apnea", - "match_target": "ZP:0018568", - "match_target_label": "primitive hemopoiesis absent, abnormal", + "match_target": "ZP:0018569", + "match_target_label": "myeloid cell development absent, abnormal", "score": 8.79057503056431, "match_subsumer": null, "match_subsumer_label": null, @@ -875,7 +875,7 @@ "subject_id": "HP:0002104", "subject_label": null, "subject_source": null, - "object_id": "ZP:0018568", + "object_id": "ZP:0018569", "object_label": null, "object_source": null, "ancestor_id": "UPHENO:0034024", @@ -894,8 +894,8 @@ "HP:0012378": { "match_source": "HP:0012378", "match_source_label": "Fatigue", - "match_target": "ZP:0018568", - "match_target_label": "primitive hemopoiesis absent, abnormal", + "match_target": "ZP:0018569", + "match_target_label": "myeloid cell development absent, abnormal", "score": 1.6752927740139332, "match_subsumer": null, "match_subsumer_label": null, @@ -903,7 +903,7 @@ "subject_id": "HP:0012378", "subject_label": null, "subject_source": null, - "object_id": "ZP:0018568", + "object_id": "ZP:0018569", "object_label": null, "object_source": null, "ancestor_id": "UPHENO:0001005", @@ -1039,18 +1039,18 @@ "score": 7.011754466426716, "similarity": { "subject_termset": { - "ZP:0018569": { - "id": "ZP:0018569", - "label": "myeloid cell development absent, abnormal" - }, "ZP:0018568": { "id": "ZP:0018568", "label": "primitive hemopoiesis absent, abnormal" + }, + "ZP:0018569": { + "id": "ZP:0018569", + "label": "myeloid cell development absent, abnormal" } }, "object_termset": { - "HP:0012378": { "id": "HP:0012378", "label": "Fatigue" }, - "HP:0002104": { "id": "HP:0002104", "label": "Apnea" } + "HP:0002104": { "id": "HP:0002104", "label": "Apnea" }, + "HP:0012378": { "id": "HP:0012378", "label": "Fatigue" } }, "subject_best_matches": { "ZP:0018568": { @@ -1452,8 +1452,8 @@ "HP:0012378": { "match_source": "HP:0012378", "match_source_label": "Fatigue", - "match_target": "ZP:0000945", - "match_target_label": "pigment cell quality, abnormal", + "match_target": "ZP:0100294", + "match_target_label": "visual perception absent, abnormal", "score": 1.6752927740139332, "match_subsumer": null, "match_subsumer_label": null, @@ -1461,7 +1461,7 @@ "subject_id": "HP:0012378", "subject_label": null, "subject_source": null, - "object_id": "ZP:0000945", + "object_id": "ZP:0100294", "object_label": null, "object_source": null, "ancestor_id": "UPHENO:0001005", @@ -1470,10 +1470,10 @@ "object_information_content": null, "subject_information_content": null, "ancestor_information_content": 1.6752927740139332, - "jaccard_similarity": 0.42105263157894735, + "jaccard_similarity": 0.4444444444444444, "cosine_similarity": null, "dice_similarity": null, - "phenodigm_score": 0.8398728660718605 + "phenodigm_score": 0.8628873427211774 }, "score_metric": "ancestor_information_content" } @@ -1568,13 +1568,13 @@ "score": 5.232933902289122, "similarity": { "subject_termset": { - "ZP:0001841": { - "id": "ZP:0001841", - "label": "visual behavior quality, abnormal" - }, "ZP:0015039": { "id": "ZP:0015039", "label": "visual behavior absent, abnormal" + }, + "ZP:0001841": { + "id": "ZP:0001841", + "label": "visual behavior quality, abnormal" } }, "object_termset": { @@ -1585,8 +1585,8 @@ "ZP:0001841": { "match_source": "ZP:0001841", "match_source_label": "visual behavior quality, abnormal", - "match_target": "HP:0012378", - "match_target_label": "Fatigue", + "match_target": "HP:0002104", + "match_target_label": "Apnea", "score": 1.6752927740139332, "match_subsumer": null, "match_subsumer_label": null, @@ -1594,7 +1594,7 @@ "subject_id": "ZP:0001841", "subject_label": null, "subject_source": null, - "object_id": "HP:0012378", + "object_id": "HP:0002104", "object_label": null, "object_source": null, "ancestor_id": "UPHENO:0001005", @@ -1603,10 +1603,10 @@ "object_information_content": null, "subject_information_content": null, "ancestor_information_content": 1.6752927740139332, - "jaccard_similarity": 0.47058823529411764, + "jaccard_similarity": 0.2962962962962963, "cosine_similarity": null, "dice_similarity": null, - "phenodigm_score": 0.8879037504843663 + "phenodigm_score": 0.7045445650576523 }, "score_metric": "ancestor_information_content" }, @@ -1931,8 +1931,8 @@ } }, "object_termset": { - "HP:0002104": { "id": "HP:0002104", "label": "Apnea" }, - "HP:0012378": { "id": "HP:0012378", "label": "Fatigue" } + "HP:0012378": { "id": "HP:0012378", "label": "Fatigue" }, + "HP:0002104": { "id": "HP:0002104", "label": "Apnea" } }, "subject_best_matches": { "ZP:0005756": { @@ -2435,8 +2435,8 @@ } }, "object_termset": { - "HP:0002104": { "id": "HP:0002104", "label": "Apnea" }, - "HP:0012378": { "id": "HP:0012378", "label": "Fatigue" } + "HP:0012378": { "id": "HP:0012378", "label": "Fatigue" }, + "HP:0002104": { "id": "HP:0002104", "label": "Apnea" } }, "subject_best_matches": { "ZP:0001432": { diff --git a/frontend/src/api/associations.ts b/frontend/src/api/associations.ts index 580a96850..13f199c11 100644 --- a/frontend/src/api/associations.ts +++ b/frontend/src/api/associations.ts @@ -9,6 +9,7 @@ export const getAssociations = async ( offset = 0, limit = 10, traverseOrthologs = false, + direct = "false", search?: string, sort: Sort = null, ) => { @@ -18,6 +19,7 @@ export const getAssociations = async ( limit, query: search || "", traverse_orthologs: !!traverseOrthologs, + direct: direct, sort: sort ? `${sort.key} ${sort.direction === "up" ? "asc" : "desc"}` : null, @@ -38,6 +40,7 @@ export const downloadAssociations = async ( nodeId = "", associationCategory = "", traverseOrthologs = false, + direct = "false", search?: string, sort: Sort = null, ) => { @@ -46,6 +49,7 @@ export const downloadAssociations = async ( limit: maxDownload, query: search || "", traverse_orthologs: !!traverseOrthologs, + direct: direct, sort: sort ? `${sort.key} ${sort.direction === "up" ? "asc" : "desc"}` : null, diff --git a/frontend/src/pages/node/AssociationsTable.vue b/frontend/src/pages/node/AssociationsTable.vue index 5c5c52595..602101610 100644 --- a/frontend/src/pages/node/AssociationsTable.vue +++ b/frontend/src/pages/node/AssociationsTable.vue @@ -131,6 +131,7 @@ type Props = { category: Option; /** include orthologs */ includeOrthologs: boolean; + direct: Option; /** selected association */ association?: DirectionalAssociation; }; @@ -288,12 +289,16 @@ const { if (!props.node.association_counts.length) throw Error("No association info available"); /** get association data */ + if (fresh) { + start.value = 0; + } const response = await getAssociations( props.node.id, props.category.id, start.value, perPage.value, props.includeOrthologs, + props.direct.id, search.value, sort.value, ); @@ -322,6 +327,7 @@ async function download() { props.node.id, props.category.id, props.includeOrthologs, + props.direct.id, search.value, sort.value, ); @@ -375,6 +381,10 @@ watch( () => props.includeOrthologs, async () => await queryAssociations(true), ); +watch( + () => props.direct, + async () => await queryAssociations(true), +); watch( [perPage, start, search, sort], async () => await queryAssociations(false), diff --git a/frontend/src/pages/node/SectionAssociations.vue b/frontend/src/pages/node/SectionAssociations.vue index 07a32ea61..9c1633ca0 100644 --- a/frontend/src/pages/node/SectionAssociations.vue +++ b/frontend/src/pages/node/SectionAssociations.vue @@ -15,14 +15,21 @@ - associations involving    - - + :options="categoryOptions" /> associations + involving  + + + @@ -98,6 +106,7 @@ const category = ref