From 96a024cb4a5c5ed4c118ce004e7e89a5860f1f2d Mon Sep 17 00:00:00 2001 From: napakalas Date: Thu, 12 Mar 2026 14:45:42 +1300 Subject: [PATCH] Extract projection-lateralities, soma-phenotypes, and axon-phenotypes (#76). --- mapknowledge/npo.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/mapknowledge/npo.py b/mapknowledge/npo.py index d0d4b55..267ca51 100644 --- a/mapknowledge/npo.py +++ b/mapknowledge/npo.py @@ -229,8 +229,10 @@ def for_composer(n, cull=False) -> dict[str, Any]: # XXX dendrites don't really ... via ... they are all both terminal and via at the same time ... [dict(loc=l, type='DENDRITE') for l in lpes(n, ilxtr.hasDendriteLocatedIn)] ), - #laterality = lpes(n, ilxtr.hasLaterality), # left/rigth tricky ? - #projection_laterality = lpes(n, ilxtr.???), # axon located in contra ? + #laterality = lpes(n, ilxtr.hasLaterality), # left/right tricky ? + projection_lateralities = [l[0] for l in lpes(n, ilxtr.hasProjectionLaterality)], + soma_phenotypes = [l[0] for l in lpes(n, ilxtr.hasSomaPhenotype)], + axon_phenotypes = [l[0] for l in lpes(n, ilxtr.hasAxonPhenotype)], species = [l[0] for l in lpes(n, ilxtr.hasInstanceInTaxon)], sex = [NAMESPACES.curie(str(p.p)) for p in n if not isinstance(p, NegPhenotype) and p.e==ilxtr.hasBiologicalSex and not collect.append((ilxtr.hasBiologicalSex , p.p))], neg_sex = [NAMESPACES.curie(str(p.p)) for p in n if isinstance(p, NegPhenotype) and p.e==ilxtr.hasBiologicalSex and not collect.append((ilxtr.hasBiologicalSex , p.p))], @@ -593,6 +595,12 @@ def get_nodes(target_nodes, nodes): knowledge['curator-note'] = curator_note if len(member_of_circuits:=path_kn['member_of_circuits']) > 0: knowledge['member-of-circuits'] = member_of_circuits + if len(projection_lateralities:=path_kn.get('projection_lateralities', [])) > 0: + knowledge['projection-lateralities'] = projection_lateralities + if len(soma_phenotypes:=path_kn.get('soma_phenotypes', [])) > 0: + knowledge['soma-phenotypes'] = soma_phenotypes + if len(axon_phenotypes:=path_kn.get('axon_phenotypes', [])) > 0: + knowledge['axon-phenotypes'] = axon_phenotypes knowledge['pathDisconnected'] = not path_kn.get('connected', False) knowledge['forward-connections'] = path_kn['forward_connections'] all_nodes = {n for edge in path_kn['connectivity'] for n in edge}