Age | Commit message (Expand) | Author |
2022-05-06 | Fix linting and typing errors | Frederick Muriuki Muriithi |
2022-05-05 | Compute partial correlation with selected traits...Compute partial correlations against a selection of traits rather than against
an entire dataset.
| Frederick Muriuki Muriithi |
2022-04-12 | Strip any newline, tab or carriage-return chars from sample data...* gn3/db/sample_data.py (get_trait_csv_sample_data): Strip out "\n", "\t", or
"\r" from the sample data. See:
<https://issues.genenetwork.org/issues/csv-error-ITP_10001-longevity-data-set.html>
| BonfaceKilz |
2022-04-07 | Fix pylint errors | BonfaceKilz |
2022-04-07 | Use case attribute id inside brackets if present during insertions...* gn3/db/sample_data.py (delete_sample_data): If an id is present in the column header, use it.
* tests/unit/db/test_sample_data.py (test_delete_sample_data): Update tests to
capture the above.
| BonfaceKilz |
2022-04-07 | Use case attribute id inside brackets if present during insertions...* gn3/db/sample_data.py (insert_sample_data): If an id is present in the column header, use it.
* tests/unit/db/test_sample_data.py (test_insert_sample_data): Update tests to
capture the above.
| BonfaceKilz |
2022-04-07 | Use case attribute id inside brackets if present during updates...* gn3/db/sample_data.py: Import "parse_csv_column".
(update_sample_data): If an id is present in the column header, use it.
* tests/unit/db/test_sample_data.py (test_update_sample_data): Update tests to
capture the above.
| BonfaceKilz |
2022-04-07 | Add method for fetching the case_attributes...* gn3/db/sample_data.py (get_case_attributes): New function.
* tests/unit/db/test_sample_data.py (test_get_case_attributes): Test case for
the above.
| BonfaceKilz |
2022-04-07 | Run python black on file...* gn3/db/sample_data.py: Run "python black -l 79 ..."
| BonfaceKilz |
2022-03-14 | Dummy White Space commit to fix laminar | BonfaceKilz |
2022-03-12 | Remove unused imports | BonfaceKilz |
2022-03-12 | Fix mypy issues | BonfaceKilz |
2022-03-12 | Fix pylint issues | BonfaceKilz |
2022-03-12 | Store the first element as strain_id | BonfaceKilz |
2022-03-12 | Append the strain name when extracting "actions"...* gn3/db/sample_data.py (__extract_actions): During updates, make sure that
the strain name is part of the returned string when extracting "actions".
* tests/unit/db/test_sample_data.py: Add test cases for the above.
| BonfaceKilz |
2022-03-12 | Apply auto-pep8 to sample_data.py and it's test file | BonfaceKilz |
2022-03-12 | Add missing return type-annotations...* tests/unit/db/test_sample_data.py (delete_sample_data): Add missing return
type for type annotations.
(insert_sample_data): Ditto.
| BonfaceKilz |
2022-03-12 | Update how data is updated by re-using existing functions...* gn3/db/sample_data.py (get_sample_data_ids): Re-use "delete_sample_data" and
"insert_sample_data" when updating data; and also add logic for updating
modified data.
* tests/unit/db/test_sample_data.py: Add tests for the above.
| BonfaceKilz |
2022-03-12 | Create action dict that's created when updating data...* gn3/db/sample_data.py (__extract_actions): An update on a vector of data can
contain: inserts, deletes and updates. This functions extracts these actions
during an update.
* tests/unit/db/test_sample_data.py (test_extract_actions): Add test-case for
the above.
| BonfaceKilz |
2022-03-12 | Remove check for inserted data when inserting individual data...* gn3/db/sample_data.py (insert_sample_data)[__insert_data]: Move check to the
main body. With this check here, you have 3 redundant checks. For a successful
insert, it will insert the first value to the `PublishData` table and ignore the
rest of the inserts.
| BonfaceKilz |
2022-03-12 | Make `_map` a constant...* gn3/db/sample_data.py: Now constant, `_MAP`.
(delete_sample_data)[__delete_data]: Replace `_map` with `_MAP`.
(insert_sample_data)[__insert_data]: Ditto.
| BonfaceKilz |
2022-03-12 | Fix faulty SQL query string when deleting case-attributes | BonfaceKilz |
2022-03-12 | Explicitly get CaseAttributeId and fix broken sql query...* gn3/db/sample_data.py (insert_sample_data): Use correct query string. Also,
use CaseAttributeId to determine whether case-attributes were inserted. If so,
do not attempt an insert.
| BonfaceKilz |
2022-03-12 | Remove duplicate params...* gn3/db/sample_data.py (insert_sample_data)[__insert_case_attribute]: Remove
extra parameters.
| BonfaceKilz |
2022-03-12 | Remove dead code | BonfaceKilz |
2022-03-12 | Check whether publish data already exists before inserting...* gn3/db/sample_data.py (insert_sample_data): If data already exists in the
table, do not attempt an insert; otherwise, an error will be generated.
| BonfaceKilz |
2022-03-12 | Fetch id's separately for the insertion edge-case...* gn3/db/sample_data (get_sample_data_ids): Add an extra condition that caters
for inserts: during inserts, joins won't work when fetching the strain_id,
publishdata_id, and strain_name. In this case, just create 2 separate queries
to do that work.
| BonfaceKilz |
2022-03-12 | Extract a strain name given a csv string and it's header...* gn3/csvcmp.py (extract_strain_name): New function.
* gn3/db/sample_data (delete_sample_data): Use the aforementioned function.
(insert_sample_data): Ditto.
* tests/unit/test_csvcmp: Test cases for above.
| BonfaceKilz |
2022-03-12 | Allow deleting case-attribute data during deletion...* gn3/db/sample_data.py (delete_sample_data): Modify this function to allow
deleting case-attribute values.
| BonfaceKilz |
2022-03-12 | Allow inserting case-attribute data during inserts...* gn3/db/sample_data.py (insert_sample_data): Modify this function to allow
inserting case-attribute values.
| BonfaceKilz |
2022-03-12 | Fetch InbredSetId...* gn3/db/sample_data.py (get_sample_data_ids): Extend to also fetch
InbredSetId.
(update_sample_data): Discard the returned value of InbredSetId.
(delete_sample_data): Ditto.
| BonfaceKilz |
2022-03-12 | Create a new function for retrieving strain_id and publishdata_id...* gn3/db/sample_data.py: Import Any, Tuple.
(get_sample_data_ids): New function that fetches the strain_id and
publishdata_id of a given data point.
(update_sample_data): Use `get_sample_data_ids`.
(delete_sample_data): Ditto.
(insert_sample_data): Ditto.
| BonfaceKilz |
2022-03-12 | Move operations on sample_data to it's own module | BonfaceKilz |
2022-03-12 | db: Fix error in SQL query...* gn3/db/traits.py (get_trait_csv_sample_data): Update SQL to fix runtime
errors.
| BonfaceKilz |
2022-03-12 | Fix pylint error | BonfaceKilz |
2022-03-12 | Append case attributes to csv data if they exist | BonfaceKilz |
2022-03-12 | db: Extend csv query to fetch case attributes...* gn3/db/traits.py (get_trait_csv_sample_data): Fetch case attribute data if
it exists.
| BonfaceKilz |
2022-03-12 | Revert "db: Fetch correct sample data"...This reverts commit 710769e84b3bc6a2bdd66effdbac0659272ed511.
| BonfaceKilz |
2022-03-11 | Fix typing errors | Frederick Muriuki Muriithi |
2022-02-21 | Fix minor issues introduced while fixing linting errors | Frederick Muriuki Muriithi |
2022-02-21 | Fix a myriad of linter issues...* Use `with` in place of plain `open`
* Use f-strings in place of `str.format()`
* Remove string interpolation from queries - provide data as query parameters
* other minor fixes
| Frederick Muriuki Muriithi |
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 |