Age | Commit message (Expand) | Author |
2022-02-21 | Test partial corrs API with mix of existing and non-existing control traits...Test that the partial correlations endpoint handles a mix of existing and
non-existing control traits gracefully and issues a warning to the user.
Summary of changes:
* gn3/computations/partial_correlations.py: Issue a warning for all
non-existing control traits
* gn3/db/partial_correlations.py: update queries - use `INNER JOIN` for tables
instead of comma-separated list of tables
* tests/integration/conftest.py: Add `db_conn` fixture to provide a database
connection to the tests. This will probably be changed in the future to
connect to a temporary database for tests.
* tests/integration/test_partial_correlations.py: Add test to check for
correct behaviour with a mix of existing and non-existing control traits
| Frederick Muriuki Muriithi |
2022-02-19 | Test partial corrs endpoint with non-existing control traits...Test that if the endpoint is queried and not a single one of the control
traits exists in the database, then the endpoint will respond with a
404 (not-found) status code.
Summary of changes:
* gn3/computations/partial_correlations.py: Check whether any control trait is
found. If none is found, return "not-found" message.
* gn3/db/partial_correlations.py: Fix bug in Geno query.
* tests/integration/test_partial_correlations.py: Add test for non-existing
control traits. Rename function to make it clearer what it is testing
for. Remove obsoleted comments.
| Frederick Muriuki Muriithi |
2022-02-18 | Remove code trying to query non-existent `TempFreeze` table...The code was migrated from GN1 with a faulty assumption that all trait types
have a corresponding `*Freeze` table in the database. This assumption is not
true for the `Temp` traits.
This commit removes the buggy code.
| Frederick Muriuki Muriithi |
2022-02-18 | Test partial correlations endpoint with non-existent primary traits...Test that the partial correlations endpoint responds with an appropriate
"not-found" message and the corresponding 404 status code in the case where a
request is made and the primary trait requested for does not exist in the
database.
Summary of the changes in each file:
* gn3/api/correlation.py: generalise the building of the response
* gn3/computations/partial_correlations.py: return with a "not-found" if the
primary trait does not exist in the database
* gn3/db/partial_correlations.py: Fix a number of bugs that led to exceptions
in the case that the primary trait did not exist
* pytest.ini: register a `slow` pytest marker
* tests/integration/test_partial_correlations.py: Add a new test to check for
an appropriate 404 response in case of a primary trait that does not exist
in the database.
| Frederick Muriuki Muriithi |
2022-02-08 | db: traits: Enable deletion of individual sample values...If a user replaces an individual value with an "x", delete that date entry
from the respective table. Deletion here is the only option since by default
the Nstrain, PublishData and PublishSE don't accept null values. Note that
deleting all 3 values is equivalent to removing the sample from the CSV file.
* gn3/db/traits.py (update_sample_data): If a value is "x", delete it from the
respective table.
| BonfaceKilz |
2022-02-08 | db: traits: Allow insertions of "0" in resp. sample values tables...When editing values from "x" to "0"(or any other value) when editing data, an
"update" statement was being run; thereby no new value was being inserted. To
the end user, modifying an "x" value to something else meant that no value was
being inserted. This commit fixes that by doing an insert whenever a change
from "x" to "0" is performed.
* gn3/db/traits.py (update_sample_data): Add insert statements whenever an
"update" statement returns a 0 row-count.
| BonfaceKilz |
2022-02-08 | db: traits: Insert "count" instead of "error" in "NStrain" table | BonfaceKilz |
2022-02-03 | db: Fetch correct sample data | BonfaceKilz |
2022-02-02 | Remove PublishFreeze from retrieve_publish_trait_info query...The PublishFreeze table isn't necessary in phenotype queries, since
PublishFreeze.Id = InbredSet.Id (for the purposes of identifying traits,
at least)
| zsloan |
2022-02-02 | Fix bug where sample values of 0 were being treated as False...In line 91 of gn3/db/traits.py, there was an if statement "if
record[key] else 'x'" that was treating values of 0 as False, so I
changed it to explicitly check that values aren't None
| zsloan |
2022-02-02 | Fix retrieve_publish_trait_data query...The PublishFreeeze table is actually unnecessary for this query, since
the group ID (inbred_set_id) should be passed in and that ID is in the
PublishXRef table (so no neeed to join with PublishFreeze)
| zsloan |
2022-01-12 | Indent code correctly...Indent the code correctly.
| Frederick Muriuki Muriithi |
2022-01-12 | Deduplicate query to fetch data for 'Publish' traits...The queries run in the `get_trait_csv_sample_data` and
`retrieve_publish_trait_data` functions in the `gn3.db.traits` module were
mostly similar. This commit changes that, by making the
`get_trait_csv_sample_data` function make use of the results from calling the
`retrieve_publish_trait_data` function.
| Frederick Muriuki Muriithi |
2022-01-10 | Check for path existence...Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi
| Frederick Muriuki Muriithi |
2022-01-10 | Fix dataset retrieval query for `Geno` traits...Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi
| Frederick Muriuki Muriithi |
2022-01-10 | Surround statement with parens for readability | Frederick Muriuki Muriithi |
2022-01-10 | Convert keys to string...* Some traits have a name composed of all numerals, which leads to the names
being interpreted as numbers. This commit forces them to string to avoid
subtle bugs where the code fails.
| Frederick Muriuki Muriithi |
2022-01-10 | Fix error in query: Replace '=' with 'IN' | Frederick Muriuki Muriithi |
2022-01-10 | Rework database functions to fetch multiple items...Issue:
https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi
* In an attempt to optimise the performance of the partial correlations
feature, this commit reworks some database access functions to fetch
multiple items from the database, per query, unlike their original forms
which would fetch a single item per query.
This reduces queries to the database, and should hopefully improve the
responsiveness of the partial correlations feature.
| Frederick Muriuki Muriithi |
2022-01-05 | Merge branch 'main' into fix/check-for-duplicates-before-deletions-or-insertions | BonfaceKilz |
2022-01-04 | traits.py: Don't use "value" to check if a record exists...The problem with using the "value" record is that it's a floating point
number. See
<https://www.bonfacemunyoki.com/post/2021-10-21-comparing-floating-point-numbers/>
on why comparing floating point numbers can be an issue.
| BonfaceKilz |
2022-01-04 | traits.py: Return early during an insert if the give record exists...Sometimes, a user will try to insert data twice, on in some instances, 2
different users will attempt the same inserts of the same records separately.
In such cases, ignore the insert, and return early.
| BonfaceKilz |
2022-01-04 | traits.py Delete a record only if it exists...In the case when the user tries to delete the same data twice, prior to this
commit, an error was being generated. This commit remedies this by checking
if a record exists prior to deleting it.
| BonfaceKilz |
2021-12-23 | db: Assist mypy with explicit type declaration....* gn3/db/datasets.py (dataset_metadata): Assist mypy by explicitly declaring
type of return dictionary.
| Arun Isaac |
2021-12-23 | db: Fix sparql_query return type....* gn3/db/datasets.py: Import List from typing.
(sparql_query): Set return type to List[Dict[str, Any]].
| Arun Isaac |
2021-12-23 | db: Fix wrong continued indentation....* gn3/db/datasets.py (dataset_metadata): Fix wrong continued indentation.
| Arun Isaac |
2021-12-14 | linting: Fix obvious linting issues | Frederick Muriuki Muriithi |
2021-12-14 | Fix bug: expects int, gets object - Fixed. | Frederick Muriuki Muriithi |
2021-12-14 | mypy: ignore some imports and errors...* Ignore some missing library stubs
* Ignore some typing errors
* Fix obvious typing errors
| Frederick Muriuki Muriithi |
2021-12-14 | Set explicit formatting for sequences in queries...Issue:
https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi
* the mysqlclient is sometimes finicky with the format specifiers, especially
in the `WHERE ... IN ...` clauses where a sequence of values is
provided. This commit explicitly sets the format specifiers for such clauses
so as to avoid sporadic failures due to differences in the form of data from
one query to the next.
| Frederick Muriuki Muriithi |
2021-12-13 | Fix errors with query...Issue:
https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi
* Use the correct format string paradigm: put f before opening quote.
* Provide missing space just before 'FROM' clause
| Frederick Muriuki Muriithi |
2021-12-10 | Fix parameters...Issue:
https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi
* Provide parameters as a dict of items (which works for MySQL), rather than
as keywork arguments (as works in PostgreSQL).
| Frederick Muriuki Muriithi |
2021-12-09 | Prevent error on no result. Fix indexing...Issue:
https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi
* If the dataset name is not found, don't cause an exception, instead, return
the provided search name.
* Use the correct inner object
| Frederick Muriuki Muriithi |
2021-12-09 | Provide clearer error message...Issue:
https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi
* To help with debugging error conditions, provide the original name to help
with figuring out why the error was raised
| Frederick Muriuki Muriithi |
2021-12-06 | Merge branch 'main' of github.com:genenetwork/genenetwork3 | Frederick Muriuki Muriithi |
2021-12-02 | Implement dataset metadata API endpoint....* guix.scm: Import (gnu packages rdf).
(genenetwork3)[propagated-inputs]: Add python-sparqlwrapper.
* gn3/settings.py (SPARQL_ENDPOINT): New variable.
* gn3/api/general.py: Import datasets from gn3.db.
(dataset_metadata): New API endpoint.
* gn3/db/datasets.py: Import re, Template from string, Dict and Optional from
typing, JSON and SPARQLWrapper from SPARQLWrapper, SPARQL_ENDPOINT from
gn3.settings.
(sparql_query, dataset_metadata): New functions.
| Arun Isaac |
2021-11-29 | Merge branch 'main' into partial-correlations | Muriithi Frederick Muriuki |
2021-11-29 | Fix linting errors...Issue:
https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi
| Frederick Muriuki Muriithi |
2021-11-29 | Provide entry-point function for the partial correlations...Issue:
https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi
* Provide the entry-point function to the partial correlation feature. This is
the function that ochestrates the fetching of the data, and processing it
for output by the API endpoint (to be implemented).
| Frederick Muriuki Muriithi |
2021-11-29 | Fix bugs in data...Issue:
https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi
* Process the db_name and db_type values.
* Return data correctly
| Frederick Muriuki Muriithi |
2021-11-29 | Update return type...Issue:
https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi
* Return the complete filename when found, or the boolean value False, when it
is not found.
| Frederick Muriuki Muriithi |
2021-11-29 | Return only values...Issue:
https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi
* Return the values from the database, not the tuples.
| Frederick Muriuki Muriithi |
2021-11-29 | Update typing notations on functions...Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi
| Frederick Muriuki Muriithi |
2021-11-29 | Fix query parametrisation...Issue:
https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi
* Pass parameters to the query the way the MySQL driver expects.
| Frederick Muriuki Muriithi |
2021-11-29 | Retrieve the species name given the group...Issue:
https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi
* Migrate the `web.webqtl.dbFunction.webqtlDatabaseFunction.retrieveSpecies`
in GeneNetwork1 to `gn3.db.species.species_name` in GeneNetwork3 to enable
the retrieval of the species name, given the group name (formerly RISet).
| Frederick Muriuki Muriithi |
2021-11-29 | db: traits: Support additions and deletions from csv file | BonfaceKilz |
2021-11-29 | db: traits: Remove trailing ".0" in int values | BonfaceKilz |
2021-11-29 | db: traits: Remove "\n\n" when generating csv file...In excel, "\n\n" is replaced with ",,,," during upload.
| BonfaceKilz |
2021-11-25 | db: traits: Support additions and deletions from csv file | BonfaceKilz |
2021-11-24 | db: traits: Remove trailing ".0" in int values | BonfaceKilz |