aboutsummaryrefslogtreecommitdiff
path: root/gn3
AgeCommit message (Collapse)Author
2022-01-22add endpoint for ctlAlexander Kabui
2022-01-22init file to call ctl scriptAlexander Kabui
2022-01-12Update return type. Remove duplicate import.Frederick Muriuki Muriithi
The function is a generator function, since it uses a `yield` statement, and thus returns a generator object, that contains a tuple object. This fixes that. We also remove a duplicate import.
2022-01-12Indent code correctlyFrederick Muriuki Muriithi
Indent the code correctly.
2022-01-12Deduplicate query to fetch data for 'Publish' traitsFrederick Muriuki Muriithi
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.
2022-01-10Check for path existenceFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi
2022-01-10Fix dataset retrieval query for `Geno` traitsFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi
2022-01-10Use the correct letter case for the keysFrederick Muriuki Muriithi
* Use the correct case for the keys inorder to retrieve the correct values.
2022-01-10Surround statement with parens for readabilityFrederick Muriuki Muriithi
2022-01-10Indicate that string is an f-stringFrederick Muriuki Muriithi
* The string had the f-string syntax to format the values to be inserted into the string, but was missing the 'f' before the opening quotes to signify to python that this was an f-string. This commit fixes that.
2022-01-10Convert keys to stringFrederick Muriuki Muriithi
* 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.
2022-01-10Remove all pairs with 'None' as the valueFrederick Muriuki Muriithi
* Remove all key-value pairs whose value is None.
2022-01-10Fix error in query: Replace '=' with 'IN'Frederick Muriuki Muriithi
2022-01-10Replace unoptimised function with optimised oneFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Replace unoptimised function with one optimised to give better performance. The optimisation done here is to fetch multiple items/traits from the database per query, rather than the original form, which fetched a single item/trait from the database per query.
2022-01-10Convert NaN to NoneFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi Comment: https://github.com/genenetwork/genenetwork3/pull/67#issuecomment-1000828159 * Convert NaN values to None to avoid possible bugs with the string replace method used before.
2022-01-10Add optimised entry for partial correlationsFrederick Muriuki Muriithi
Issue: * Function `gn3.computations.partial_correlations_optimised.partial_correlations_entry` is a copy of the `gn3.computations.partial_correlation.partial_correlations_entry` function that is optimised for better performance. The optimised function is intended to replace the unoptimised one, but it is included in this commit for comparison purposes, and to maintain some historical context for doing it this way.
2022-01-10Rework database functions to fetch multiple itemsFrederick Muriuki Muriithi
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.
2022-01-05Merge pull request #64 from jgarte/type-hint-normalize-valuesBonfaceKilz
Adds type hint for normalize_values function
2022-01-05Merge branch 'main' into fix/check-for-duplicates-before-deletions-or-insertionsBonfaceKilz
2022-01-05Fix pylint errorsBonfaceKilz
2022-01-04traits.py: Don't use "value" to check if a record existsBonfaceKilz
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.
2022-01-04traits.py: Return early during an insert if the give record existsBonfaceKilz
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.
2022-01-04traits.py Delete a record only if it existsBonfaceKilz
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.
2021-12-24Fix typing errorsFrederick Muriuki Muriithi
2021-12-24Fix linting errorsFrederick Muriuki Muriithi
2021-12-24Fix sortingFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Update the sorting algorithm, for literature and tissue correlations so that it sorts the results by the correlation value first then by the p-value next.
2021-12-24Return the correlation method usedFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Return the correlation method used
2021-12-24Replace `NaN` with `null` in JSON stringFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * `NaN` is not a valid JSON value, and leads to errors in the code. This commit replaces all `NaN` values with `null`.
2021-12-24Encode the data to JSON and set the status codeFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Encode bytes objects to string * Encode NaN values to "null" * gn3/api/correlation.py:
2021-12-24Reduce the total amount of data to be outputFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * There is a lot of data that is not necessary in the final result. This commit removes that data, retaining only data relevant for the display.
2021-12-24Add dataset type to the resultsFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * The dataset type is relevant for the display of the data, therefore, this commit presents the dataset type as part of the results.
2021-12-24Add API endpoint for partial correlationsFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Add an API endpoint for the partial correlation. * gn3/api/correlation.py:
2021-12-23db: Assist mypy with explicit type declaration.Arun Isaac
* gn3/db/datasets.py (dataset_metadata): Assist mypy by explicitly declaring type of return dictionary.
2021-12-23db: Fix sparql_query return type.Arun Isaac
* gn3/db/datasets.py: Import List from typing. (sparql_query): Set return type to List[Dict[str, Any]].
2021-12-23db: Fix wrong continued indentation.Arun Isaac
* gn3/db/datasets.py (dataset_metadata): Fix wrong continued indentation.
2021-12-17Add "success" status to final computation resultsFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi
2021-12-17Add API endpoint for partial correlationsFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Add an API endpoint for the partial correlation.
2021-12-14linting: Fix obvious linting issuesFrederick Muriuki Muriithi
2021-12-14Fix bug: expects int, gets object - Fixed.Frederick Muriuki Muriithi
2021-12-14mypy: ignore some imports and errorsFrederick Muriuki Muriithi
* Ignore some missing library stubs * Ignore some typing errors * Fix obvious typing errors
2021-12-14Adds type hint for normalize_values functionjgart
2021-12-14TO REVERT: Add logging to see data frameFrederick Muriuki Muriithi
2021-12-14Remove any items with less than 3 samplesFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * pingouin raises an exception whenever one attempts to use it to compute the partial correlation with data that has less than 3 samples.
2021-12-14Fix dataset: use target dataset not primaryFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Use the target dataset to load the target traits, not the primary trait's dataset, since they might differ.
2021-12-14Set explicit formatting for sequences in queriesFrederick Muriuki Muriithi
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.
2021-12-13Provide missing functionFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Import the missing function.
2021-12-13Fix the removal of controls for corresponding Nones in targetsFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Fix the code, so that it removes all control values, whose corresponding target values are None, without throwing an error.
2021-12-13Return the primary and control traits in addition to resultsFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * In addition to the partial correlation results, this commit enables the return of the chosen primary trait and the selected control traits. This data is required for presentation on the results page.
2021-12-13Run partial correlations against chosen databaseFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Run the partial correlations against the database that the user selects, and not the one from which the primary trait is. This was a bug in the code.
2021-12-13Fix errors with queryFrederick Muriuki Muriithi
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