aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorzsloan2022-02-24 21:53:56 +0000
committerzsloan2022-02-24 16:02:06 -0600
commit6496f75af521d6801c25de682d2852e14d597fed (patch)
tree84e169a18d30eaa88aa54d21358576c9a4c58b73 /wqflask
parentbbeba72a82e0a5698b4fb413430203e8aaee1830 (diff)
downloadgenenetwork2-6496f75af521d6801c25de682d2852e14d597fed.tar.gz
Fix ProbeSet query for aliases
ProbeSet queries previously weren't dealing with aliases correctly, because it was doing a MATCH/AGAINST against the ProbeSet.alias field, but that field usually contains a list of gene symbols separated by semi-colons (so it wouldn't detect the alias unless there was only a single alias. To fix this, I added some LIKE conditions, searching for the possible variations. This is a little awkward, because I needed to make sure to avoid a situation where, for example, an alias like 'LPD-1' matches a search for 'PD-1'. I don't think the way it currently works is efficient, but I don't know of any good alternative without changing the way we store aliases in the database.
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/do_search.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/wqflask/wqflask/do_search.py b/wqflask/wqflask/do_search.py
index 5c182260..f8cc482f 100644
--- a/wqflask/wqflask/do_search.py
+++ b/wqflask/wqflask/do_search.py
@@ -137,15 +137,18 @@ class MrnaAssaySearch(DoSearch):
search_string = escape(self.search_term[0])
if self.search_term[0] != "*":
- match_clause = """((MATCH (ProbeSet.Name,
+ match_clause = f"""((MATCH (ProbeSet.Name,
ProbeSet.description,
ProbeSet.symbol,
- alias,
GenbankId,
UniGeneId,
Probe_Target_Description)
- AGAINST ('%s' IN BOOLEAN MODE))) AND
- """ % (search_string)
+ AGAINST ('{search_string}' IN BOOLEAN MODE)) OR (
+ alias LIKE '%%; {search_string};%%' OR
+ alias LIKE '{search_string};%%' OR
+ alias LIKE '%%; {search_string}' OR
+ alias LIKE '{search_string}'
+ )) AND """
else:
match_clause = ""