@@ -1100,6 +1100,17 @@ def term_info_parse_object(results, short_form):
11001100 if contains_all_tags (termInfo ["SuperTypes" ], ["Class" ]):
11011101 q = SubclassesOf_to_schema (termInfo ["Name" ], {"short_form" : vfbTerm .term .core .short_form })
11021102 queries .append (q )
1103+
1104+ # NeuronsCapableOf query - inverse of a neuron's 'capable of' relationship,
1105+ # e.g. neurotransmitter-secretion GO terms (neurons capable of ACh/GABA/
1106+ # serotonin secretion). These GO process terms carry no distinguishing
1107+ # SuperType facet, so gate on the term being a subclass of GO_0007269
1108+ # 'neurotransmitter secretion' -- the shared parent of every such process.
1109+ if vfbTerm .parents and any (
1110+ getattr (p , 'short_form' , None ) == "GO_0007269" for p in vfbTerm .parents
1111+ ):
1112+ q = NeuronsCapableOf_to_schema (termInfo ["Name" ], {"short_form" : vfbTerm .term .core .short_form })
1113+ queries .append (q )
11031114
11041115 # NeuronClassesFasciculatingHere query - for tracts/nerves
11051116 # Matches XMI criteria: Class + Tract_or_nerve (VFB uses Neuron_projection_bundle type)
@@ -2024,6 +2035,33 @@ def LineageClonesIn_to_schema(name, take_default):
20242035 return Query (query = query , label = label , function = function , takes = takes , preview = preview , preview_columns = preview_columns )
20252036
20262037
2038+ def NeuronsCapableOf_to_schema (name , take_default ):
2039+ """
2040+ Schema for NeuronsCapableOf query.
2041+ Finds individual neurons capable of the specified process (e.g. a
2042+ neurotransmitter-secretion GO term) -- the inverse of a neuron's
2043+ 'capable of' (RO_0002215) relationship.
2044+
2045+ Applicability (gated in term_info_parse_object): the term is a subclass of
2046+ GO_0007269 'neurotransmitter secretion'. These GO terms carry no
2047+ distinguishing SuperType facet, so the shared parent is the signal.
2048+
2049+ Query chain: Owlery instances query -> process -> SOLR
2050+ OWL query: 'Neuron' that 'capable of' some '{short_form}' (returns instances)
2051+ """
2052+ query = "NeuronsCapableOf"
2053+ label = f"Neurons capable of { name } "
2054+ function = "get_neurons_capable_of"
2055+ takes = {
2056+ "short_form" : {"$and" : ["Class" ]},
2057+ "default" : take_default ,
2058+ }
2059+ preview = 5
2060+ preview_columns = ["id" , "label" , "tags" , "thumbnail" ]
2061+
2062+ return Query (query = query , label = label , function = function , takes = takes , preview = preview , preview_columns = preview_columns )
2063+
2064+
20272065def ImagesNeurons_to_schema (name , take_default ):
20282066 """
20292067 Schema for ImagesNeurons query.
@@ -4604,6 +4642,29 @@ def get_images_that_develop_from(short_form: str, return_dataframe=True, limit:
46044642 solr_field = 'anat_image_query' , query_by_label = False , query_instances = True )
46054643
46064644
4645+ @with_solr_cache ('neurons_capable_of' )
4646+ def get_neurons_capable_of (short_form : str , return_dataframe = True , limit : int = - 1 ):
4647+ """
4648+ Retrieves individual neurons capable of the specified process (e.g. a
4649+ neurotransmitter-secretion GO term) -- the inverse of a neuron's
4650+ 'capable of' (RO_0002215) relationship.
4651+
4652+ Query chain: Owlery instances -> process -> SOLR
4653+ OWL query: <FBbt_00005106> and <RO_0002215> some <$ID> (instances)
4654+ Where: FBbt_00005106 = neuron, RO_0002215 = capable of
4655+
4656+ Note: returns INSTANCES (individual neurons), like ImagesNeurons.
4657+
4658+ :param short_form: short form of the process/GO term (Class)
4659+ :param return_dataframe: Returns pandas dataframe if true, otherwise formatted dict
4660+ :param limit: maximum number of results (default -1, all)
4661+ :return: Individual neurons capable of the specified process
4662+ """
4663+ owl_query = f"<http://purl.obolibrary.org/obo/FBbt_00005106> and <http://purl.obolibrary.org/obo/RO_0002215> some <{ _short_form_to_iri (short_form )} >"
4664+ return _owlery_query_to_results (owl_query , short_form , return_dataframe , limit ,
4665+ solr_field = 'anat_image_query' , query_by_label = False , query_instances = True )
4666+
4667+
46074668def _short_form_to_iri (short_form : str ) -> str :
46084669 """
46094670 Convert a short form ID to its full IRI.
0 commit comments