Skip to content

Commit

Permalink
Update cellphonedb.py
Browse files Browse the repository at this point in the history
Added the `is_ppi` flag from the interaction database of CellPhoneDB
Fixes #269
  • Loading branch information
NP authored Feb 15, 2024
1 parent bbee7b9 commit 12b1c76
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pypath/inputs/cellphonedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -274,6 +278,7 @@ def get_type(entity):
'interaction_type',
'type_a',
'type_b',
'is_ppi',
]
)

Expand Down Expand Up @@ -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):

Expand Down Expand Up @@ -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,
)
)

Expand Down

0 comments on commit 12b1c76

Please sign in to comment.