From 913ae1a73c72adbcf78c6969f266d0e8eb1bf887 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..299693226 100644 --- a/pypath/inputs/cellphonedb.py +++ b/pypath/inputs/cellphonedb.py @@ -264,6 +264,10 @@ def get_type(entity): '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, ) )