From 40b3733e48d8df1a1aad7f303f9b7d22e91bac86 Mon Sep 17 00:00:00 2001 From: Philipp Schlegel Date: Fri, 30 Aug 2024 12:35:48 +0100 Subject: [PATCH] get_connectors: use link "name" instead of link "type" (see comment) --- pymaid/fetch/__init__.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pymaid/fetch/__init__.py b/pymaid/fetch/__init__.py index d0e03ac..c5d6688 100644 --- a/pymaid/fetch/__init__.py +++ b/pymaid/fetch/__init__.py @@ -1230,9 +1230,11 @@ def get_connectors(x, relation_type=None, tags=None, remote_instance=None): # Get connector type IDs cn_ids = {k: v[0][3] for k, v in data['partners'].items()} - # Map type ID to relation (also note conversion of connector ID to integer) - cn_type = {int(k): rel_ids.get(v, {'type': 'unknown'})['type'] - for k, v in cn_ids.items()} + # Map type ID to relation; also note: + # 1. Conversion of connector ID to integer) + # 2. We're using the "name" field of the relation - this used to be "type" but + # on VFB CATMAID "type" is always "Synaptic" while name can be "Presynaptic" or "Postsynaptic" + cn_type = {int(k): rel_ids.get(v, {}).get('name', 'unknown') for k, v in cn_ids.items()} # Map connector ID to connector type df['type'] = df.connector_id.map(cn_type)