Skip to content

Commit 6fe0da0

Browse files
committed
Implement new Owlery-based queries and corresponding tests
- Added NeuronsSynaptic, NeuronsPresynapticHere, NeuronsPostsynapticHere, ComponentsOf, PartsOf, and SubclassesOf queries to vfb_queries.py. - Enhanced term_info_parse_object to include new queries based on anatomical regions and classes. - Created a comprehensive test suite for the new queries in test_new_owlery_queries.py, ensuring they return expected results and are included in term_info. - Updated existing functions to maintain consistency and improve error handling.
1 parent 15fe254 commit 6fe0da0

3 files changed

Lines changed: 822 additions & 160 deletions

File tree

VFB_QUERIES_REFERENCE.md

Lines changed: 120 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -121,23 +121,113 @@ Applies to: Class + Synaptic_neuropil, Class + Visual_system, Class + Synaptic_n
121121

122122
### ✅ CONVERTED - Queries with Python Implementation
123123

124+
---
125+
126+
### ✅ FULLY CONVERTED - Complete Implementation
127+
124128
#### 1. **NeuronsPartHere**
125129
- **ID**: `NeuronsPartHere`
126-
- **Name**: "Neurons with any part here"
127-
- **Description**: "Neurons with some part in $NAME"
130+
- **Name**: "Neuron Classes with some part in a region"
131+
- **Description**: "Neuron classes with some part overlapping $NAME"
128132
- **Matching Criteria**:
129133
- Class + Synaptic_neuropil
130-
- Class + Visual_system
131-
- Class + Synaptic_neuropil_domain
132-
- **Query Chain**: Owlery subclass → Process → SOLR
133-
- **OWL Query**: `object=<FBbt_00005106> and <RO_0002131> some <$ID>`
134+
- Class + Anatomy (broader match)
135+
- **Query Chain**: Owlery subclass query → Process → SOLR
136+
- **OWL Query**: `'Neuron' that 'overlaps' some '{short_form}'`
134137
- **Python Function**: `get_neurons_with_part_in()`
135138
- **Schema Function**: `NeuronsPartHere_to_schema()`
139+
- **Cache Key**: `'neurons_part_here'`
140+
- **Preview**: 10 results with images (id, label, tags, thumbnail, source)
141+
- **Status**: ✅ **FULLY IMPLEMENTED** with tests
142+
143+
#### 2. **NeuronsSynaptic**
144+
- **ID**: `NeuronsSynaptic`
145+
- **Name**: "Neurons with synaptic terminals in region"
146+
- **Description**: "Neuron classes with synaptic terminals in $NAME"
147+
- **Matching Criteria**:
148+
- Class + Synaptic_neuropil
149+
- Class + Visual_system
150+
- Class + Synaptic_neuropil_domain
151+
- **Query Chain**: Owlery subclass query → Process → SOLR
152+
- **OWL Query**: `'Neuron' that 'has synaptic terminals in' some '{short_form}'`
153+
- **Python Function**: `get_neurons_with_synapses_in()`
154+
- **Schema Function**: `NeuronsSynaptic_to_schema()`
155+
- **Cache Key**: `'neurons_synaptic'`
156+
- **Preview**: 10 results (id, label, tags, thumbnail)
157+
- **Status**: ✅ **FULLY IMPLEMENTED** with term_info integration
158+
159+
#### 3. **NeuronsPresynapticHere**
160+
- **ID**: `NeuronsPresynapticHere`
161+
- **Name**: "Neurons with presynaptic terminals in region"
162+
- **Description**: "Neuron classes with presynaptic terminals in $NAME"
163+
- **Matching Criteria**:
164+
- Class + Synaptic_neuropil
165+
- Class + Visual_system
166+
- Class + Synaptic_neuropil_domain
167+
- **Query Chain**: Owlery subclass query → Process → SOLR
168+
- **OWL Query**: `'Neuron' that 'has presynaptic terminal in' some '{short_form}'`
169+
- **Python Function**: `get_neurons_with_presynaptic_terminals_in()`
170+
- **Schema Function**: `NeuronsPresynapticHere_to_schema()`
171+
- **Cache Key**: `'neurons_presynaptic'`
172+
- **Preview**: 10 results (id, label, tags, thumbnail)
173+
- **Status**: ✅ **FULLY IMPLEMENTED** with term_info integration
174+
175+
#### 4. **NeuronsPostsynapticHere**
176+
- **ID**: `NeuronsPostsynapticHere`
177+
- **Name**: "Neurons with postsynaptic terminals in region"
178+
- **Description**: "Neuron classes with postsynaptic terminals in $NAME"
179+
- **Matching Criteria**:
180+
- Class + Synaptic_neuropil
181+
- Class + Visual_system
182+
- Class + Synaptic_neuropil_domain
183+
- **Query Chain**: Owlery subclass query → Process → SOLR
184+
- **OWL Query**: `'Neuron' that 'has postsynaptic terminal in' some '{short_form}'`
185+
- **Python Function**: `get_neurons_with_postsynaptic_terminals_in()`
186+
- **Schema Function**: `NeuronsPostsynapticHere_to_schema()`
187+
- **Cache Key**: `'neurons_postsynaptic'`
188+
- **Preview**: 10 results (id, label, tags, thumbnail)
189+
- **Status**: ✅ **FULLY IMPLEMENTED** with term_info integration
190+
191+
#### 5. **ComponentsOf**
192+
- **ID**: `ComponentsOf`
193+
- **Name**: "Components of"
194+
- **Description**: "Components of $NAME"
195+
- **Matching Criteria**: Class + Clone
196+
- **Query Chain**: Owlery Part of → Process → SOLR
197+
- **OWL Query**: `'part of' some '{short_form}'`
198+
- **Python Function**: `get_components_of()`
199+
- **Schema Function**: `ComponentsOf_to_schema()`
200+
- **Cache Key**: `'components_of'`
201+
- **Preview**: 10 results (id, label, tags, thumbnail)
202+
- **Status**: ✅ **FULLY IMPLEMENTED** with term_info integration
203+
204+
#### 6. **PartsOf**
205+
- **ID**: `PartsOf`
206+
- **Name**: "Parts of"
207+
- **Description**: "Parts of $NAME"
208+
- **Matching Criteria**: Class (any)
209+
- **Query Chain**: Owlery Part of → Process → SOLR
210+
- **OWL Query**: `'part of' some '{short_form}'`
211+
- **Python Function**: `get_parts_of()`
212+
- **Schema Function**: `PartsOf_to_schema()`
213+
- **Cache Key**: `'parts_of'`
214+
- **Preview**: 10 results (id, label, tags, thumbnail)
215+
- **Status**: ✅ **FULLY IMPLEMENTED** with term_info integration
216+
217+
#### 7. **SubclassesOf**
218+
- **ID**: `SubclassesOf`
219+
- **Name**: "Subclasses of"
220+
- **Description**: "Subclasses of $NAME"
221+
- **Matching Criteria**: Class (any)
222+
- **Query Chain**: Owlery subclasses query → Process → SOLR
223+
- **OWL Query**: `'{short_form}'` (direct class query)
224+
- **Python Function**: `get_subclasses_of()`
225+
- **Schema Function**: `SubclassesOf_to_schema()`
226+
- **Cache Key**: `'subclasses_of'`
136227
- **Preview**: 10 results (id, label, tags, thumbnail)
137-
- **Status**: ✅ **FULLY IMPLEMENTED** (Nov 4, 2025)
138-
- **Test Coverage**: `test_neurons_part_here.py` (6 tests, 100% passing)
228+
- **Status**: ✅ **FULLY IMPLEMENTED** with term_info integration
139229

140-
#### 2. **ListAllAvailableImages**
230+
#### 8. **ListAllAvailableImages**
141231
- **ID**: `ListAllAvailableImages`
142232
- **Name**: "List all available images for class with examples"
143233
- **Description**: "List all available images of $NAME"
@@ -148,7 +238,7 @@ Applies to: Class + Synaptic_neuropil, Class + Visual_system, Class + Synaptic_n
148238
- **Preview**: 5 results (id, label, tags, thumbnail)
149239
- **Status**: ✅ **FULLY IMPLEMENTED**
150240

151-
#### 3. **SimilarMorphologyTo** ✅ (Partial)
241+
#### 9. **SimilarMorphologyTo** ✅ (Partial)
152242
- **ID**: `SimilarMorphologyTo` / `has_similar_morphology_to`
153243
- **Name**: "NBLAST similarity neo Query"
154244
- **Description**: "Neurons with similar morphology to $NAME [NBLAST mean score]"
@@ -159,7 +249,7 @@ Applies to: Class + Synaptic_neuropil, Class + Visual_system, Class + Synaptic_n
159249
- **Preview**: 5 results (id, score, name, tags, thumbnail)
160250
- **Status**: ✅ **IMPLEMENTED** (may need preview enhancement)
161251

162-
#### 4. **NeuronInputsTo** ✅ (Partial)
252+
#### 10. **NeuronInputsTo** ✅ (Partial)
163253
- **ID**: `NeuronInputsTo`
164254
- **Name**: "Neuron inputs query"
165255
- **Description**: "Find neurons with synapses into $NAME"
@@ -172,30 +262,9 @@ Applies to: Class + Synaptic_neuropil, Class + Visual_system, Class + Synaptic_n
172262

173263
---
174264

175-
### 🔶 PARTIALLY CONVERTED - Schema Exists, Implementation Incomplete
176-
177-
#### 5. **ComponentsOf** 🔶
178-
- **ID**: `ComponentsOf`
179-
- **Name**: "Components of"
180-
- **Description**: "Components of $NAME"
181-
- **Matching Criteria**: Class + Clone
182-
- **Query Chain**: Owlery Part of → Process → SOLR
183-
- **OWL Query**: `object=<BFO_0000050> some <$ID>`
184-
- **Status**: 🔶 **SCHEMA EXISTS** - needs full implementation
185-
186-
#### 6. **PartsOf** 🔶
187-
- **ID**: `PartsOf`
188-
- **Name**: "Parts of"
189-
- **Description**: "Parts of $NAME"
190-
- **Matching Criteria**: Class (any)
191-
- **Query Chain**: Owlery Part of → Process → SOLR
192-
- **Status**: 🔶 **SCHEMA EXISTS** - needs full implementation
193-
194-
---
195-
196265
### ❌ NOT CONVERTED - XMI Only
197266

198-
#### 7. **ExpressionOverlapsHere**
267+
#### 11. **ExpressionOverlapsHere**
199268
- **ID**: `ExpressionOverlapsHere`
200269
- **Name**: "Expression overlapping what anatomy"
201270
- **Description**: "Anatomy $NAME is expressed in"
@@ -236,37 +305,7 @@ Applies to: Class + Synaptic_neuropil, Class + Visual_system, Class + Synaptic_n
236305
- **OWL Query**: `object=<FBbt_00005106> and <RO_0002131> some <$ID>` (instances, not classes)
237306
- **Status**: ❌ **NOT IMPLEMENTED**
238307

239-
#### 11. **NeuronsSynaptic**
240-
- **ID**: `NeuronsSynaptic`
241-
- **Name**: "Neurons Synaptic"
242-
- **Description**: "Neurons with synaptic terminals in $NAME"
243-
- **Matching Criteria**:
244-
- Class + Synaptic_neuropil
245-
- Class + Visual_system
246-
- Class + Synaptic_neuropil_domain
247-
- **Query Chain**: Owlery → Process → SOLR
248-
- **OWL Query**: `object=<FBbt_00005106> and <RO_0002130> some <$ID>`
249-
- **Status**: ❌ **NOT IMPLEMENTED**
250-
251-
#### 12. **NeuronsPresynapticHere**
252-
- **ID**: `NeuronsPresynapticHere`
253-
- **Name**: "Neurons Presynaptic"
254-
- **Description**: "Neurons with presynaptic terminals in $NAME"
255-
- **Matching Criteria**: Class + Synaptic_neuropil, Visual_system, Synaptic_neuropil_domain
256-
- **Query Chain**: Owlery → Process → SOLR
257-
- **OWL Query**: `object=<FBbt_00005106> and <RO_0002113> some <$ID>`
258-
- **Status**: ❌ **NOT IMPLEMENTED**
259-
260-
#### 13. **NeuronsPostsynapticHere**
261-
- **ID**: `NeuronsPostsynapticHere`
262-
- **Name**: "Neurons Postsynaptic"
263-
- **Description**: "Neurons with postsynaptic terminals in $NAME"
264-
- **Matching Criteria**: Class + Synaptic_neuropil, Visual_system, Synaptic_neuropil_domain
265-
- **Query Chain**: Owlery → Process → SOLR
266-
- **OWL Query**: `object=<FBbt_00005106> and <RO_0002110> some <$ID>`
267-
- **Status**: ❌ **NOT IMPLEMENTED**
268-
269-
#### 14. **PaintedDomains**
308+
#### 12. **PaintedDomains**
270309
- **ID**: `PaintedDomains` / `domainsForTempId`
271310
- **Name**: "Show all painted domains for template"
272311
- **Description**: "List all painted anatomy available for $NAME"
@@ -312,16 +351,7 @@ Applies to: Class + Synaptic_neuropil, Class + Visual_system, Class + Synaptic_n
312351
- **Query Chain**: Neo4j → Neo4j Pass → SOLR
313352
- **Status**: ❌ **NOT IMPLEMENTED**
314353

315-
#### 19. **SubclassesOf**
316-
- **ID**: `SubclassesOf` / `subclasses`
317-
- **Name**: "Subclasses of"
318-
- **Description**: "Subclasses of $NAME"
319-
- **Matching Criteria**: Class (any)
320-
- **Query Chain**: Owlery → Process → SOLR
321-
- **OWL Query**: `object=<$ID>`
322-
- **Status**: ❌ **NOT IMPLEMENTED**
323-
324-
#### 20. **AlignedDatasets**
354+
#### 19. **AlignedDatasets**
325355
- **ID**: `AlignedDatasets` / `template_2_datasets_ids`
326356
- **Name**: "Show all datasets aligned to template"
327357
- **Description**: "List all datasets aligned to $NAME"
@@ -459,24 +489,32 @@ Applies to: Class + Synaptic_neuropil, Class + Visual_system, Class + Synaptic_n
459489

460490
### Statistics
461491
- **Total VFB Queries**: 35
462-
- **✅ Fully Implemented**: 4 (11%)
492+
- **✅ Fully Implemented**: 10 (29%)
463493
- **🔶 Partially Implemented**: 2 (6%)
464-
- **❌ Not Implemented**: 29 (83%)
494+
- **❌ Not Implemented**: 23 (66%)
495+
496+
### Recently Implemented (This Session)
497+
-**NeuronsSynaptic** - neurons with synaptic terminals in region
498+
-**NeuronsPresynapticHere** - neurons with presynaptic terminals in region
499+
-**NeuronsPostsynapticHere** - neurons with postsynaptic terminals in region
500+
-**ComponentsOf** - components of anatomical structures
501+
-**PartsOf** - parts of anatomical structures
502+
-**SubclassesOf** - subclasses of a class
465503

466504
### Implementation Priority Categories
467505

468506
#### High Priority (Common Use Cases)
469-
1. **NeuronsSynaptic** - synaptic terminal queries are very common
470-
2. **NeuronsPresynapticHere** - presynaptic connectivity is essential
471-
3. **NeuronsPostsynapticHere** - postsynaptic connectivity is essential
507+
1. **NeuronsSynaptic** - synaptic terminal queries are very common (COMPLETED)
508+
2. **NeuronsPresynapticHere** - presynaptic connectivity is essential (COMPLETED)
509+
3. **NeuronsPostsynapticHere** - postsynaptic connectivity is essential (COMPLETED)
472510
4.**ExpressionOverlapsHere** - expression pattern queries are frequent
473-
5. **ComponentsOf** - anatomical hierarchy navigation
474-
6. **PartsOf** - anatomical hierarchy navigation
511+
5. **ComponentsOf** - anatomical hierarchy navigation (COMPLETED)
512+
6. **PartsOf** - anatomical hierarchy navigation (COMPLETED)
475513

476514
#### Medium Priority (Specialized Queries)
477515
7.**neuron_region_connectivity_query** - connectivity analysis
478516
8.**neuron_neuron_connectivity_query** - circuit analysis
479-
9. **SubclassesOf** - ontology navigation
517+
9. **SubclassesOf** - ontology navigation (COMPLETED)
480518
10.**anatScRNAseqQuery** - transcriptomics integration
481519
11.**clusterExpression** - gene expression analysis
482520

0 commit comments

Comments
 (0)