Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/test/test_neuron_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ def test_schema_generation(self):
self.assertIsNotNone(schema, "Schema should not be None")
self.assertEqual(schema.query, "NeuronInputsTo", "Query name should match")
self.assertEqual(schema.function, "get_individual_neuron_inputs", "Function name should match")
# NeuronInputsTo uses ribbon format with preview=-1 (all results)
self.assertEqual(schema.preview, -1, "Preview should show all results (ribbon format)")
# NeuronInputsTo uses ribbon format; preview must be > 0 so
# fill_query_results populates the count badge and ribbon rows
# (preview<=0 is skipped by process_query, vfb_queries.py:6192).
self.assertGreater(schema.preview, 0, "Preview must be > 0 for the ribbon to be populated")
self.assertIn("Neurotransmitter", schema.preview_columns, "Preview should include 'Neurotransmitter' column")
self.assertIn("Weight", schema.preview_columns, "Preview should include 'Weight' column")

Expand Down
20 changes: 16 additions & 4 deletions src/vfbquery/vfb_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -976,10 +976,16 @@ def term_info_parse_object(results, short_form):
if contains_all_tags(termInfo["SuperTypes"], ["Individual", "Neuron"]):
q = SimilarMorphologyTo_to_schema(termInfo["Name"], {"neuron": vfbTerm.term.core.short_form, "similarity_score": "NBLAST_score"})
queries.append(q)
if contains_all_tags(termInfo["SuperTypes"], ["Individual", "Neuron", "has_neuron_connectivity"]):
# NeuronInputsTo is gated behind the extra "Demo" tag so it does NOT
# appear on the current site (no live terms carry "Demo"). Keep it
# separate from NeuronNeuronConnectivityQuery below, which should still
# show for all connectivity-bearing neurons.
if contains_all_tags(termInfo["SuperTypes"], ["Individual", "Neuron", "has_neuron_connectivity", "Demo"]):
q = NeuronInputsTo_to_schema(termInfo["Name"], {"neuron_short_form": vfbTerm.term.core.short_form})
queries.append(q)
# NeuronNeuronConnectivity query - neurons connected to this neuron

# NeuronNeuronConnectivity query - neurons connected to this neuron
if contains_all_tags(termInfo["SuperTypes"], ["Individual", "Neuron", "has_neuron_connectivity"]):
q = NeuronNeuronConnectivityQuery_to_schema(termInfo["Name"], {"short_form": vfbTerm.term.core.short_form})
queries.append(q)

Expand Down Expand Up @@ -1557,13 +1563,19 @@ def term_info_parse_object(results, short_form):

def NeuronInputsTo_to_schema(name, take_default):
query = "NeuronInputsTo"
label = f"Find neurons with synapses into {name}"
label = f"Find neurons presynaptic to {name}"
function = "get_individual_neuron_inputs"
takes = {
"neuron_short_form": {"$and": ["Individual", "Neuron"]},
"default": take_default,
}
preview = -1
# preview MUST be > 0: fill_query_results/process_query only populates the
# count badge and ribbon rows when preview > 0 (vfb_queries.py:6192). A
# value of -1 caused the query to be skipped entirely, shipping count=-1
# and no preview_results to the frontend (broken card). output_format
# "ribbon" already makes process_query call the backing function in
# summary_mode, so the ribbon shows the neurotransmitter breakdown.
preview = 5
preview_columns = ["Neurotransmitter", "Weight"]
output_format = "ribbon"

Expand Down
Loading