diff --git a/src/pypath/__version__ b/src/pypath/__version__ index bd0119f96..44ab23e43 100644 --- a/src/pypath/__version__ +++ b/src/pypath/__version__ @@ -1 +1 @@ -0.11.12 +0.11.13 diff --git a/src/pypath/omnipath/server/run.py b/src/pypath/omnipath/server/run.py index 275638ff4..0d2d5bdf5 100644 --- a/src/pypath/omnipath/server/run.py +++ b/src/pypath/omnipath/server/run.py @@ -548,6 +548,21 @@ class TableServer(BaseServer): 'sec': {'1', '0', 'no', 'yes'}, 'pmp': {'1', '0', 'no', 'yes'}, 'pmtm': {'1', '0', 'no', 'yes'}, + 'causality': { + 'transmitter', + 'trans', + 'receiver', + 'rec', + 'both' + }, + 'topology': { + 'secreted', + 'sec', + 'plasma_membrane_peripheral', + 'pmp', + 'plasma_membrane_transmembrane', + 'pmtm', + }, }, 'intercell_summary': { 'header': None, @@ -1965,6 +1980,46 @@ def intercell(self, req): tbl = tbl[getattr(tbl, _long) == this_arg] + if b'causality' in req.args: + + causality = self._args_set(req, 'causality') + + trans = causality & {'transmitter', 'trans', 'both'} + rec = causality & {'receiver', 'rec', 'both'} + tbl = ( + tbl[tbl.transmitter | tbl.receiver] + if trans and rec else + tbl[tbl.transmitter] + if trans else + tbl[tbl.receiver] + if rec else + tbl + ) + + if b'topology' in req.args: + + topology = self._args_set(req, 'topology') + query = ' or '.join( + colname + for enabled, colname in + ( + (topology & {'secreted', 'sec'}, 'secreted'), + ( + topology & {'plasma_membrane_peripheral', 'pmp'}, + 'plasma_membrane_peripheral' + ), + ( + topology & {'plasma_membrane_transmembrane', 'pmtm'}, + 'plasma_membrane_transmembrane' + ) + ) + if enabled + ) + + if query: + + tbl = tbl.query(query) + # filtering for categories if b'categories' in req.args: