rki-mf1 / covsonar

A database-driven system for handling genomic sequences of SARS-CoV-2 and screening genomic profiles.
GNU General Public License v3.0
6 stars 0 forks source link

SQL not working properly - Searching Any Mutation #25

Closed silenus092 closed 2 years ago

silenus092 commented 2 years ago

In GitLab by @kunaphas.kon on Jan 22, 2022, 09:39

"get any mutation at this site" function does not work for me, or do I run this wrong?

python3 sonar.py match --tsv --db dc.db --include S:N501X --collection RKI_STICHPROBE --date 2020-12-01:2021-12-31
# no hit
python3 sonar.py match --tsv --db dc.db --include S:N501Y --collection RKI_STICHPROBE --date 2020-12-01:2021-12-31 --count
#1102

Debug

python3 /home/hoelzerm/git/covsonar/sonar.py match --tsv --db dc.db --include S:N501X --collection RKI_STICHPROBE --date 2020-12-01:2021-12-31 --count --debug
query: SELECT COUNT(*) as count FROM essence WHERE collection IN (?) AND (date BETWEEN '2020-12-01' AND '2021-12-31') AND aa_profile LIKE '% S:N501Q %' AND aa_profile LIKE '% S:N501M %' AND aa_profile LIKE '% S:N501Ω %' AND aa_profile LIKE '% S:N501Z %' AND aa_profile LIKE '% S:N501D %' AND aa_profile LIKE '% S:N501H %' AND aa_profile LIKE '% S:N501O %' AND aa_profile LIKE '% S:N501B %' AND aa_profile LIKE '% S:N501T %' AND aa_profile LIKE '% S:N501F %' AND aa_profile LIKE '% S:N501Φ %' AND aa_profile LIKE '% S:N501N %' AND aa_profile LIKE '% S:N501V %' AND aa_profile LIKE '% S:N501Y %' AND aa_profile LIKE '% S:N501P %' AND aa_profile LIKE '% S:N501ζ %' AND aa_profile LIKE '% S:N501W %' AND aa_profile LIKE '% S:N501R %' AND aa_profile LIKE '% S:N501K %' AND aa_profile LIKE '% S:N501G %' AND aa_profile LIKE '% S:N501I %' AND aa_profile LIKE '% S:N501U %' AND aa_profile LIKE '% S:N501A %' AND aa_profile LIKE '% S:N501S %' AND aa_profile LIKE '% S:N501X %' AND aa_profile LIKE '% S:N501+ %' AND aa_profile LIKE '% S:N501- %' AND aa_profile LIKE '% S:N501J %' AND aa_profile LIKE '% S:N501Ψ %' AND aa_profile LIKE '% S:N501C %' AND aa_profile LIKE '% S:N501E %' AND aa_profile LIKE '% S:N501π %' AND aa_profile LIKE '% S:N501L %';
vals:  ['RKI_STICHPROBE']
0
silenus092 commented 2 years ago

In GitLab by @kunaphas.kon on Jan 22, 2022, 09:41

I think the correct SQL LIKE statement should combine with OR instead of AND

aa_profile LIKE '% S:N501Q %' OR '% S:N501M %' OR '% S:N501Ω % etc......

and when join with other types should be AND

.... 
    (date BETWEEN '2020-12-01' AND '2021-12-31') AND 
    (aa_profile LIKE '% S:N501O %' OR aa_profile LIKE .... )
silenus092 commented 2 years ago

In GitLab by @kunaphas.kon on Feb 16, 2022, 19:21

mentioned in commit 26e0aae94704029ef625ad8cdd9d892acdd29046

silenus092 commented 2 years ago

In GitLab by @s.fuchs on Mar 10, 2022, 13:02

mentioned in commit b4a3cbe307e8094582c2cdcc59789ef347d1b255