aboutsummaryrefslogtreecommitdiff
path: root/gn3/api
AgeCommit message (Collapse)Author
2023-10-27Implement "GET /species/:name".Munyoki Kilyungi
* gn3/api/metadata.py (fetch_species): New end-point. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-10-27Implement "GET /species".Munyoki Kilyungi
* gn3/api/metadata.py (list_species): New end-point. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-10-27Implement "GET /genewikis/ncbi/:symbol".Munyoki Kilyungi
* gn3/api/metadata.py (get_ncbi_genewiki_entries): New end-point.
2023-10-27Delete gn3.db.rdf.sparql_query.Munyoki Kilyungi
* gn3/api/metadata.py: Remove sparql_query import. * gn3/db/rdf.py: Remove unused imports. (sparql_query): Delete. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-10-27Implement "GET /genewikis/gn/:symbol".Munyoki Kilyungi
* gn3/api/metadata.py (get_genewiki_entries): Rename this to ... (get_gn_genewiki_entries): ... this. Create an end-point for querying GN GeneRIF entries. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-10-27Implement "GET /metadata/phenotypes/:name".Munyoki Kilyungi
* gn3/api/metadata.py: Delete gn3.db.rdf.get_phenotype_metadata. (phenotype): Rename this to ... (phenotypes): ... this and implement update logic. * gn3/db/rdf.py (get_phenotype_metadata): Delete. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-10-27Remove un-used get_dataset_metadata import.Munyoki Kilyungi
* gn3/api/metadata.py: Delete gn3.db.rdf.get_dataset_metadata. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-10-27Implement "GET /metadata/genotypes/:name".Munyoki Kilyungi
* gn3/api/metadata.py: Delete gn3.db.rdf.get_genotype_metadata. (genotype): Rename this to ... (genotypes): ... this. Construct a query for fetching genotypes and return a response as json-ld.
2023-10-27Implement "GET /metadata/publications/search/:term".Munyoki Kilyungi
* gn3/api/metadata.py (search_publications): New function. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-10-27Implement "GET /metadata/publications/:name".Munyoki Kilyungi
* gn3/api/metadata.py: Delete gn3.db.rdf.get_publication_metadata. (publication): Rename this ... (publications): ... to this. Return a json-ld result. * gn3/db/rdf.py (get_publication_metadata): Delete. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-10-27Implement "GET /metadata/datasets/search/:term".Munyoki Kilyungi
* gn3/api/metadata.py (search_datasets): New search endpoint with pagination. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-10-27Implement "GET /metadata/datasets/:name".Munyoki Kilyungi
* gn3/api/metadata.py: Import json, SPARQLWrapper.{JSON, JSONLD}. (dataset): Rename this to ... (datasets): ... this. Return a well formatted JSONLD result from a dataset. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-10-27Simplify CONSTRUCT query when fetching a dataset's metadata.Munyoki Kilyungi
* gn3/api/metadata.py (dataset): Update docstring. * gn3/db/rdf.py (get_dataset_metadata): Simplify CONSTRUCT query. Also, now you can fetch metadata using either an accession_id or the dataset's name. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-10-06Provide keyword argument.Frederick Muriuki Muriithi
2023-10-06Pass in configs/settings as function argumentsFrederick Muriuki Muriithi
To avoid reliance of `flask.current_app.config` or on `gn3.settings` modules globally, this commit passes in the appropriate configurations as arguments to the relevant functions.
2023-09-05Fix C3001: Lambda expression assigned to a variableMunyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-06-15Fetch genotypes from virtuosoMunyoki Kilyungi
* gn3/api/metadata.py: Import get_genotype_metadata. (genotype): New end-point. * gn3/db/rdf.py (get_phenotype_metadata): New function. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-06-12Fetch phenotypes from virtuosoMunyoki Kilyungi
* gn3/api/metadata.py: Import get_phenotype_metadata. (phenotype): New end-point. * gn3/db/rdf.py (get_phenotype_metadata): New function. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-06-12Correct publication function docstringMunyoki Kilyungi
* gn3/api/metadata.py (publication): Update docstring. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-06-07Add publication end-pointMunyoki Kilyungi
* gn3/api/metadata.py: Import get_publication_metadata (publication): New endpoint. * gn3/db/rdf.py (get_dataset_metadata): New function. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-06-07Remove trait_metadata endpointMunyoki Kilyungi
* gn3/api/metadata.py: Remove get_trait_metadata import. (trait_metadata): Delete. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-06-06Rename dataset_metadata -> datasetMunyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-04-17Create new endpoint for fetching GeneRIF entriesMunyoki Kilyungi
* gn3/api/metadata.py: Import Template, sparql_query and RDF_PREFIXES. (get_genewiki_entries): New endpoint. * gn3/db/rdf.py: Add new constant for storing rdf prefixes. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-04-06Remove deprecated `gn3.db_utils.database_connector` functionFrederick Muriuki Muriithi
Remove the deprecated function and fix a myriad of bugs that arise from removing the function. Issue: https://issues.genenetwork.org/issues/bugfix_coupling_current_app_and_db_utils
2023-03-01Fetch sampledataMunyoki Kilyungi
* gn3/api/sampledata.py (get_sampledata): New end-point. * gn3/app.py: Register above end-point. * gn3/settings.py: Add new conf variable for LMDB. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-03-01Create API endpoint for fetching trait metadataMunyoki Kilyungi
* gn3/api/metadata.py (dataset_metadata): New function and endpoint. (jsonify_dataset_metadata): Rename to dataset_metadata. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
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-12-06Use a dataset's name to fetch it's metadata from RDFMunyoki Kilyungi
* gn3/api/metadata.py (jsonify_dataset_metadata): Rewrite metadata end-point to use a dataset's name instead of it's accession_id. * gn3/db/rdf.py (get_dataset_metadata): Replace accession_id with name. Use one single RDF query instead of multiple queries.
2022-11-28Catch a URLError when virtuoso isn't running at allMunyoki Kilyungi
* gn3/api/metadata.py: Import URLError. (jsonify_dataset_metadata): Add URLError in except block.
2022-11-28Fix pylint errorsMunyoki Kilyungi
* gn3/api/general.py: Delete rdf import. Delete trailing white spaces. * gn3/api/metadata.py: Delete trailing white spaces.
2022-11-28Fail gracefully when virtuoso is not accessibleMunyoki Kilyungi
* gn3/api/metadata.py: import RemoteDisconnected. (jsonify_dataset_metadata): Wrap get_dataset_metadata in try block.