From a12681276be07f9b675652a4542398d56d138843 Mon Sep 17 00:00:00 2001 From: Ivan Blagoev Topolsky Date: Fri, 5 Jul 2024 19:29:16 +0200 Subject: [PATCH] [bugfix] filters regex quotes - correctly handle /regex/ --- filters_preprint.yaml | 5 ++++- lollipop/preprocessors.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/filters_preprint.yaml b/filters_preprint.yaml index 743abdc..2b938a5 100644 --- a/filters_preprint.yaml +++ b/filters_preprint.yaml @@ -1,4 +1,7 @@ -bad_mutations: +controls: + - sample ~ /^control/ + +bad_mutations: - proto v3 - mutations in [ 28461G, 11201G, 26801C, -28461G, -11201G, -26801C ] diff --git a/lollipop/preprocessors.py b/lollipop/preprocessors.py index 62af257..2943b52 100644 --- a/lollipop/preprocessors.py +++ b/lollipop/preprocessors.py @@ -186,12 +186,12 @@ def apply_filter_statement(name, fs): ) case "~" | "=~" | "~=": return col.str.contains( - val[1, -2] if val[0] == val[-1] in "/@" else val + val[1:-1] if not m["qv"] and val[0] == val[-1] in "/@" else val ) case "!~" | "~!": return ~( col.str.contains( - val[1, -2] if val[0] == val[-1] in "/@" else val + val[1:-1] if not m["qv"] and val[0] == val[-1] in "/@" else val ) ) case _ as o: