Skip to content

Commit

Permalink
Update association count labels (#854)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinschaper authored Oct 17, 2024
1 parent 43c3200 commit 97496f8
Show file tree
Hide file tree
Showing 13 changed files with 157 additions and 151 deletions.
4 changes: 2 additions & 2 deletions backend/src/monarch_py/implementations/solr/solr_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ def parse_association_counts(query_result: SolrQueryResult, entity: str) -> Asso
if k.endswith(subject_query):
original_query = k.replace(f" {subject_query}", "").lstrip("(").rstrip(")")
agm = get_association_type_mapping_by_query_string(original_query)
label = agm.object_label
label = agm.subject_label
elif k.endswith(object_query):
original_query = k.replace(f" {object_query}", "").lstrip("(").rstrip(")")
agm = get_association_type_mapping_by_query_string(original_query)
label = agm.subject_label
label = agm.object_label
# always use forward for symmetric association types
else:
raise ValueError(f"Unexpected facet query when building association counts: {k}")
Expand Down
22 changes: 11 additions & 11 deletions backend/src/monarch_py/utils/association_type_mappings.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
- subject_label: Disease to Phenotype
object_label: Phenotype to Disease
object_label: Disease to Phenotype
category: "biolink:DiseaseToPhenotypicFeatureAssociation"
- subject_label: Gene to Phenotype
object_label: Phenotype to Gene
object_label: Gene to Phenotype
category: "biolink:GeneToPhenotypicFeatureAssociation"
- subject_label: Interactions
object_label: Interactions
symmetric: true
category: "biolink:PairwiseGeneToGeneInteraction"
- subject_label: Gene to Pathway
object_label: Pathway to Gene
object_label: Gene to Pathway
category: "biolink:GeneToPathwayAssociation"
- subject_label: Gene Expression
object_label: Gene Expression
Expand All @@ -19,22 +19,22 @@
symmetric: true
category: "biolink:GeneToGeneHomologyAssociation"
- subject_label: Chemical to Pathway
object_label: Pathway to Chemical
object_label: Chemical to Pathway
category: "biolink:ChemicalToPathwayAssociation"
- subject_label: Gene to Molecular Function
object_label: Molecular Function to Gene
object_label: Gene to Molecular Function
category: "biolink:MacromolecularMachineToMolecularActivityAssociation"
- subject_label: Gene to Cellular Component
object_label: Cellular Component to Gene
object_label: Gene to Cellular Component
category: "biolink:MacromolecularMachineToCellularComponentAssociation"
- subject_label: Gene to Biological Process
object_label: Biological Process to Gene
object_label: Gene to Biological Process
category: "biolink:MacromolecularMachineToBiologicalProcessAssociation"
- subject_label: Causal Gene
object_label: Causal Disease
- subject_label: Causal Disease
object_label: Causal Gene
category: "biolink:CausalGeneToDiseaseAssociation"
- subject_label: Correlated Gene
object_label: Correlated Disease
- subject_label: Correlated Disease
object_label: Correlated Gene
category: "biolink:CorrelatedGeneToDiseaseAssociation"
- subject_label: Variant to Gene
object_label: Variant to Gene
Expand Down
2 changes: 1 addition & 1 deletion backend/tests/fixtures/association_counts.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def association_counts():
return {
"items": [
{
"label": "Phenotype to Disease",
"label": "Disease to Phenotype",
"count": 4115,
"category": "biolink:DiseaseToPhenotypicFeatureAssociation",
},
Expand Down
2 changes: 1 addition & 1 deletion backend/tests/fixtures/association_counts_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
def association_counts_response():
return {
"responseHeader": {
"QTime": 1,
"QTime": 0,
"params": {
"facet.query": [
'(category:"biolink:DiseaseToPhenotypicFeatureAssociation") AND (subject:"MONDO:0020121" OR subject_closure:"MONDO:0020121")',
Expand Down
2 changes: 1 addition & 1 deletion backend/tests/fixtures/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def node():
},
"association_counts": [
{
"label": "Phenotype to Disease",
"label": "Disease to Phenotype",
"count": 4115,
"category": "biolink:DiseaseToPhenotypicFeatureAssociation",
},
Expand Down
6 changes: 3 additions & 3 deletions backend/tests/fixtures/object_formatted.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion backend/tests/fixtures/search_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
def search_response():
return {
"responseHeader": {
"QTime": 2,
"QTime": 0,
"params": {
"mm": "100%",
"q": "fanconi",
Expand Down
2 changes: 1 addition & 1 deletion backend/tests/integration/test_solr_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def test_association_counts_for_disease():
disease_phenotype = [
ac for ac in association_counts.items if ac.category == "biolink:DiseaseToPhenotypicFeatureAssociation"
][0]
assert disease_phenotype.label == "Phenotype to Disease"
assert disease_phenotype.label == "Disease to Phenotype"


def test_association_counts_for_eds():
Expand Down
2 changes: 1 addition & 1 deletion frontend/fixtures/association-counts.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"items": [
{
"label": "Phenotype to Disease",
"label": "Disease to Phenotype",
"count": 4115,
"category": "biolink:DiseaseToPhenotypicFeatureAssociation"
},
Expand Down
2 changes: 1 addition & 1 deletion frontend/fixtures/node.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
},
"association_counts": [
{
"label": "Phenotype to Disease",
"label": "Disease to Phenotype",
"count": 4115,
"category": "biolink:DiseaseToPhenotypicFeatureAssociation"
},
Expand Down
8 changes: 4 additions & 4 deletions frontend/fixtures/phenotype-explorer-compare.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
Loading

0 comments on commit 97496f8

Please sign in to comment.