From 12b1c761b927455b604a5469fbc2291edaa7c88d Mon Sep 17 00:00:00 2001 From: NP Date: Thu, 15 Feb 2024 15:57:57 +0100 Subject: [PATCH] Update cellphonedb.py Added the `is_ppi` flag from the interaction database of CellPhoneDB Fixes #269 --- pypath/inputs/cellphonedb.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pypath/inputs/cellphonedb.py b/pypath/inputs/cellphonedb.py index c128a365c..e4aebbb2b 100644 --- a/pypath/inputs/cellphonedb.py +++ b/pypath/inputs/cellphonedb.py @@ -263,6 +263,10 @@ def get_type(entity): if entity in receptors else 'unknown' ) + + def get_bool(rec, attr): + + return attr in rec and rec[attr].upper() == 'TRUE' CellphonedbInteraction = collections.namedtuple( 'CellphonedbInteraction', @@ -274,6 +278,7 @@ def get_type(entity): 'interaction_type', 'type_a', 'type_b', + 'is_ppi', ] ) @@ -304,6 +309,7 @@ def get_type(entity): rec['partner_b'], complexes = complexes, ) + _is_ppi = get_bool(rec, 'is_ppi') for partner_a, partner_b in itertools.product(_partner_a, _partner_b): @@ -338,6 +344,7 @@ def get_type(entity): interaction_type = '%s-%s' % (_type_a, _type_b), type_a = _type_a, type_b = _type_b, + is_ppi = _is_ppi, ) )