Skip to content

Commit

Permalink
[bugfix] filters regex quotes
Browse files Browse the repository at this point in the history
- correctly handle /regex/
  • Loading branch information
DrYak committed Jul 5, 2024
1 parent f54e275 commit 7d77300
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion filters_preprint.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
bad_mutations:
controls:
- sample ~ /^control/

bad_mutations:
- proto v3
- mutations in [ 28461G, 11201G, 26801C, -28461G, -11201G, -26801C ]

Expand Down
6 changes: 4 additions & 2 deletions lollipop/preprocessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,14 @@ 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:
Expand Down

0 comments on commit 7d77300

Please sign in to comment.