Skip to content

Commit 87a7389

Browse files
committed
Refine term_info_parse_object queries to align with XMI criteria and enhance TransgeneExpressionHere schema documentation
1 parent ad837a9 commit 87a7389

1 file changed

Lines changed: 21 additions & 6 deletions

File tree

src/vfbquery/vfb_queries.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,12 @@ def term_info_parse_object(results, short_form):
819819
q = SimilarMorphologyToPartOf_to_schema(termInfo["Name"], {"short_form": vfbTerm.term.core.short_form})
820820
queries.append(q)
821821

822-
if termInfo["SuperTypes"] and contains_all_tags(termInfo["SuperTypes"], ["Individual", "Expression_pattern", "NBLASTexp"]):
822+
# SimilarMorphologyToPartOfexp query - reverse NBLASTexp
823+
# Matches XMI criteria: (Individual + Expression_pattern + NBLASTexp) OR (Individual + Expression_pattern_fragment + NBLASTexp)
824+
if termInfo["SuperTypes"] and contains_all_tags(termInfo["SuperTypes"], ["Individual", "NBLASTexp"]) and (
825+
"Expression_pattern" in termInfo["SuperTypes"] or
826+
"Expression_pattern_fragment" in termInfo["SuperTypes"]
827+
):
823828
q = SimilarMorphologyToPartOfexp_to_schema(termInfo["Name"], {"short_form": vfbTerm.term.core.short_form})
824829
queries.append(q)
825830

@@ -858,7 +863,10 @@ def term_info_parse_object(results, short_form):
858863
queries.append(q)
859864

860865
# Transgene expression query
861-
if termInfo["SuperTypes"] and contains_all_tags(termInfo["SuperTypes"], ["Class", "Nervous_system", "Anatomy"]):
866+
# Matches XMI criteria: (Class + Nervous_system + Anatomy) OR (Class + Nervous_system + Neuron)
867+
if termInfo["SuperTypes"] and contains_all_tags(termInfo["SuperTypes"], ["Class", "Nervous_system"]) and (
868+
"Anatomy" in termInfo["SuperTypes"] or "Neuron" in termInfo["SuperTypes"]
869+
):
862870
q = TransgeneExpressionHere_to_schema(termInfo["Name"], {"short_form": vfbTerm.term.core.short_form})
863871
queries.append(q)
864872

@@ -1280,7 +1288,7 @@ def TractsNervesInnervatingHere_to_schema(name, take_default):
12801288
label = f"Tracts/nerves innervating {name}"
12811289
function = "get_tracts_nerves_innervating_here"
12821290
takes = {
1283-
"short_form": {"$and": ["Class", "Synaptic_neuropil"]},
1291+
"short_form": {"$or": [{"$and": ["Class", "Synaptic_neuropil"]}, {"$and": ["Class", "Synaptic_neuropil_domain"]}]},
12841292
"default": take_default,
12851293
}
12861294
preview = 5
@@ -1330,7 +1338,7 @@ def ImagesNeurons_to_schema(name, take_default):
13301338
label = f"Images of neurons with some part in {name}"
13311339
function = "get_images_neurons"
13321340
takes = {
1333-
"short_form": {"$and": ["Class", "Synaptic_neuropil"]},
1341+
"short_form": {"$or": [{"$and": ["Class", "Synaptic_neuropil"]}, {"$and": ["Class", "Synaptic_neuropil_domain"]}]},
13341342
"default": take_default,
13351343
}
13361344
preview = 5
@@ -1531,7 +1539,7 @@ def SimilarMorphologyToPartOf_to_schema(name, take_default):
15311539

15321540
def SimilarMorphologyToPartOfexp_to_schema(name, take_default):
15331541
"""Schema for SimilarMorphologyToPartOfexp (reverse NBLASTexp) query."""
1534-
return Query(query="SimilarMorphologyToPartOfexp", label=f"Similar morphology to part of {name}", function="get_similar_morphology_part_of_exp", takes={"short_form": {"$and": ["Individual", "Expression_pattern", "NBLASTexp"]}, "default": take_default}, preview=5, preview_columns=["id", "name", "score", "tags"])
1542+
return Query(query="SimilarMorphologyToPartOfexp", label=f"Similar morphology to part of {name}", function="get_similar_morphology_part_of_exp", takes={"short_form": {"$or": [{"$and": ["Individual", "Expression_pattern", "NBLASTexp"]}, {"$and": ["Individual", "Expression_pattern_fragment", "NBLASTexp"]}]}, "default": take_default}, preview=5, preview_columns=["id", "name", "score", "tags"])
15351543

15361544

15371545
def SimilarMorphologyToNB_to_schema(name, take_default):
@@ -1580,7 +1588,14 @@ def TermsForPub_to_schema(name, take_default):
15801588

15811589

15821590
def TransgeneExpressionHere_to_schema(name, take_default):
1583-
"""Schema for TransgeneExpressionHere query."""
1591+
"""Schema for TransgeneExpressionHere query.
1592+
1593+
Matching criteria from XMI:
1594+
- Class + Nervous_system + Anatomy
1595+
- Class + Nervous_system + Neuron
1596+
1597+
Query chain: Multi-step Owlery and Neo4j queries
1598+
"""
15841599
return Query(query="TransgeneExpressionHere", label=f"Transgene expression in {name}", function="get_transgene_expression_here", takes={"short_form": {"$and": ["Class", "Nervous_system", "Anatomy"]}, "default": take_default}, preview=5, preview_columns=["id", "name", "tags"])
15851600

15861601

0 commit comments

Comments
 (0)