From 455d0c7d3e818d22f116bc998b5f11c7ec45af0e Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 22 Nov 2024 13:45:22 +0100 Subject: [PATCH] ramp_raw optionally remove prefixes from sourceIds --- pypath/inputs/ramp/_sqlite.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pypath/inputs/ramp/_sqlite.py b/pypath/inputs/ramp/_sqlite.py index ee0ae40af..30f1dfd3d 100644 --- a/pypath/inputs/ramp/_sqlite.py +++ b/pypath/inputs/ramp/_sqlite.py @@ -118,7 +118,8 @@ def ramp_raw( tables: str | list[str] = None, sqlite: bool = False, return_df: bool = True, - **kwargs + prefixes: bool = True, + **kwargs, ) -> dict[str, list[tuple] | pd.DataFrame | sqlite3.Connection]: """ Retrieve RaMP database contents from its SQLite build. @@ -176,6 +177,9 @@ def ramp_raw( result = {t: callback(t) for t in tables} + if not prefixes and 'source' in result: + result['source'].sourceId = result['source'].sourceId.apply(lambda x: x.split(':', maxsplit = 1)[1]) + if len(result) == 1: result = _misc.first(result.values())