aboutsummaryrefslogtreecommitdiff
path: root/gn3/api/search.py
AgeCommit message (Collapse)Author
2023-07-10Fix linting errors caused by bump to Python 3.10migrate-to-python3.10Frederick Muriuki Muriithi
2023-01-24search: Use decimals, not floats, when converting to megabases.Arun Isaac
* gn3/api/search.py (parse_location_field): Use decimals, not floats, when converting to megabases.
2023-01-24search: Support SI suffixes and point locations.Arun Isaac
* gn3/api/search.py (parse_position_field): New function. (parse_query): Associate the position prefix with the parse_position_field field processor.
2023-01-24search: Abstract out parsing of position spec into separate function.Arun Isaac
* gn3/api/search.py (parse_position): New function. (parse_location_field): Use parse_position. * tests/unit/test_search.py: Import parse_position from gn3.api.search. (test_parse_position_close_to_zero_location): New test.
2023-01-24search: Alias the position prefix with pos.Arun Isaac
* gn3/api/search.py (parse_query): Alias the position prefix with pos.
2023-01-24search: Rename the mb prefix to position.Arun Isaac
* gn3/api/search.py (parse_query): Rename the mb prefix to position.
2023-01-24search: Assume triplets mean synteny is requested.Arun Isaac
* gn3/api/search.py (query_subqueries, query_terms, parse_synteny_field, is_synteny_on, remove_synteny_field): Delete functions. (parse_query): Assume triplets mean synteny is requested.
2023-01-24search: Use comprehension when splitting location.Arun Isaac
* gn3/api/search.py (parse_location_field): Use comprehension.
2023-01-20mypy: minor fixes to typing errorsFrederick Muriuki Muriithi
2023-01-19search: Downcase before applying SI suffix.Arun Isaac
* gn3/api/search.py (apply_si_suffix): Downcase before applying SI suffix.
2023-01-19search: Use decimals, not floats, to manipulate range limits.Arun Isaac
Decimals are exact and do not introduce tiny errors in the range limits like floats are wont to do. * gn3/api/search.py: Import Decimal from decimal. (apply_si_suffix): Use decimals, not floats, to manipulate range limits.
2023-01-19search: Only look for SI suffix in the last character.Arun Isaac
Suffixes are the last character, not everything but the last character. * gn3/api/search.py (apply_si_suffix): Only look for SI suffix in the last character.
2023-01-19search: Apply SI suffix only if last character is an actual suffix.Arun Isaac
Prior to this commit, when there was no SI suffix (such as in a plain suffix-less number), the last digit would be dropped! * gn3/api/search.py (apply_si_suffix): Apply SI suffix only if last character is an actual suffix.
2023-01-18search: Ensure limits of chromosomal interval is non-negative.Arun Isaac
* gn3/api/search.py (parse_location_field): Ensure limits of chromosomal interval is non-negative.
2023-01-18search: Convert point locations to a +/- 50 kbase range.Arun Isaac
* gn3/api/search.py (parse_location_field): Convert point locations to a +/- 50 kbase range.
2023-01-18Pass species and species prefix as a single query argument.Arun Isaac
* gn3/api/search.py (parse_location_field): Accept a single species query argument instead of separate species and species prefix arguments. (parse_query): Pass parse_location_field a single species query argument.
2023-01-18auth: Fix tests after enforcing FOREIGN KEY constraintFrederick Muriuki Muriithi
Fix a number of tests and fixtures that were not conforming to the FOREIGN KEY constraints: * Each test that creates a new "object" needs to clean up after itself * Each fixture that sets up test data needs to clean up after itself
2023-01-18Tolerate WEIGHT operator in parsed search queries.Arun Isaac
* gn3/api/search.py (remove_synteny_field): Tolerate WEIGHT operator in parsed search queries.
2023-01-18Implement synteny search.Arun Isaac
* gn3/api/search.py: Import gzip, Path from pathlib and curry from pymonad.tools. (IntervalLiftoverFunction): New variable. (query_subqueries, query_terms, field_processor_or, liftover, liftover_interval, parse_synteny_field, is_synteny_on, remove_synteny_field): New functions. (parse_location_field): Generalize to support synteny searches. (parse_query): Support synteny search queries. (search_results): Pass synteny files directory to parse_query.
2023-01-18Support location shorthands in search queries.Arun Isaac
* gn3/api/search.py: Import partial and reduce from functools. Import Callable from typing. (ChromosomalPosition, ChromosomalInterval, FieldProcessor): New classes. (apply_si_suffix, combine_queries, parse_location_field, interval_start, interval_end): New functions. (parse_query): Add field processors for location shorthands.
2023-01-18Split off search query parsing into separate function.Arun Isaac
* gn3/api/search.py (parse_query): New function. (search_results): Use parse_query.
2022-10-28Use Xapian index path from app settings.Arun Isaac
App settings should be accessed from current_app. It should not be hard-coded to a variable in a module. * gn3/db_utils.py: Do not import XAPIAN_DB_PATH from gn3.settings. (xapian_database): Accept path argument. * gn3/api/search.py: Import current_app from flask. (search_results): Pass Xapian index path to xapian_database.
2022-10-28Add search.Arun Isaac
* gn3/api/search.py: New file. * gn3/app.py: Register the search blueprint.