aboutsummaryrefslogtreecommitdiff
path: root/gn3
AgeCommit message (Collapse)Author
2021-08-18Provide top-level `riset` key-value pairMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Provide the expected, top-level `riset` key-value pair and eliminate the redundant key-value pair.
2021-08-18Add tests and fix errors caught with testsMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * gn3/computations/heatmap.py: fix errors * tests/unit/computations/test_heatmap.py: new tests Add new tests with the expected source data format, and expected results. Fix all errors that were caught by running the tests
2021-08-18Fix errors: add in missing parenthesisMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Call the `cursor.fetchone()` function to get results. Without the parenthesis, the code was trying to use the function itself as the results, which was a bug, and would lead to failure.
2021-08-18Initialise heatmap generation moduleMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * gn3/heatmaps/heatmaps.py: Initialise the module with some code to be used to test out plotly features on the command-line. * guix.scm: Add `python-plotly` and `python-pandas` as dependencies.
2021-08-16Merge pull request #32 from genenetwork/heatmap_decompose_db_retrievalBonfaceKilz
Heatmap decompose db retrieval
2021-08-12Fix linting errorsMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Fix some errors caught by the linter.
2021-08-12Import missing definitionsMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Import some missing definitions.
2021-08-11use normal function for correlation (#34)Alexander Kabui
* use normal function for correlation + rename functions * update test for sample correlation * use normal function for tissue correlation + rename functions
2021-08-09Build up the heatmap dataMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Add code to compute and organise the data that will be used to draw the final heatmap. This varies significantly in how it works from the original, but it still tries to retain the general flow of data.
2021-08-09Set up the trait dataset type correctlyMuriithi Frederick Muriuki
* gn3/db/traits.py: setup `trait_dataset_type` * tests/unit/db/test_traits.py: fix tests The type ('Temp', 'Geno', 'Publish', and 'ProbeSet') relate to a trait's dataset, and not the trait itself. This commit updates the code to take this into consideration. The dataset type is also set up from a trait's full name, therefore this commit removes the `trait_type` argument from the `retrieve_trait_info` function.
2021-08-09Retrieve the trait dataMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Add functions to retrieve the `value`, `variance`, and `ndata` values for any given trait.
2021-08-09Add missing arguments. Fix typo.Muriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Fix minor bugs in the code.
2021-08-09Fix linting errorsMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Add module, class and function docstrings * Deactivate some irrelevant pylint errors * Fix indentations and line-lengths
2021-08-08Only load extra data if the traits have basic infoMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Only load the extra trait data if the basic trait information is found.
2021-08-08Merge branch 'main' of github.com:genenetwork/genenetwork3 into ↵Muriithi Frederick Muriuki
heatmap_decompose_db_retrieval
2021-08-07Add gunicorn support for productionPjotr Prins
2021-08-05db: traits: Return unique values when fetching sample dataBonfaceKilz
2021-08-05Reorganise the database codeMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Reorganise the code to separate the datasets from the traits, and to more closely conform to the same flow as that in GN1
2021-08-05Build up trait_name items from full nameMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * The full name of the traits from search contains multiple parts to it, and as such, we use it to retrieve the appropriate data and set it up in the final trait_info dictionary that is produced.
2021-08-04Fix issues caught by pylintMuriithi Frederick Muriuki
* gn3/computations/slink.py: remove unused imports * gn3/db/traits.py: remove unnecessary `else` clauses * tests/unit/db/test_traits.py: add docstrings for functions
2021-08-04Retrieve the RISet and RISet ID valuesMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Retrieve the RISet and RISet ID values from the database.
2021-08-04Add tests for post-processing functionsMuriithi Frederick Muriuki
Issues: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Add missing tests for some post-processing functions
2021-08-04Avoid string interpolation: use prepared statementMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Following Arun's comment at https://github.com/genenetwork/genenetwork3/pull/31#issuecomment-890915813 this commit eliminates string interpolation, and adds a map of tables for the various types of traits dataset names
2021-07-30Rework db functions to enable postprocessingMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Rework the database functions to return a dict of key-value pairs, which eases the postprocessing of the trait information. The postprocessing is mainly to try an maintain data compatibility with the code that is at the following locations: https://github.com/genenetwork/genenetwork1/blob/master/web/webqtl/base/webqtlTrait.py https://github.com/genenetwork/genenetwork1/blob/master/web/webqtl/base/webqtlDataset.py https://github.com/genenetwork/genenetwork1/blob/master/web/webqtl/heatmap/Heatmap.py This was mainly a proof-of-concept, and the functions do not have testing added for them: there is therefore need to add testing for the new functions, and probably even rework them if they are found to be complicated.
2021-07-30Add module for common utilitiesMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * gn3/function_helpers.py: new file Provides a new module to hold common programming utilities that are generic enough that they will find use across the entire application. The first utility function provided in this commit is the `compose` function, whose purpose, as indicated by its name, is to take a number of functions and compose them into a single function, which when called, will return the same result that would have been got had the user called the functions in a chain from right to left.
2021-07-30Return dict from query functionsMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * gn3/db/traits.py: return dicts rather than tuples/list * tests/unit/db/test_traits.py: Update tests Return dicts with the key-value pairs set up so as to ease with the data manipulation down the pipeline. This is also useful to help with the retrieval of all other extra information that was left out in the first iteration. This commit also updates the tests by ensuring they expect dicts rather than tuples.
2021-07-29Merge branch 'main' into Feature/Update-db-from-csv-dataBonfaceKilz
2021-07-29Delete "update_raw" and it's test-casesBonfaceKilz
2021-07-29Add method for updating values from a sample datasetBonfaceKilz
* gn3/db/traits.py (update_sample_data): New function. * tests/unit/db/test_traits.py: New test cases for ^^.
2021-07-29Add partial type annotations for slink moduleMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Add some type annotations for the `nearest` function. * Leave some comments regarding the issues experienced when trying to add some typing annotations to the function to help with future endeavours of the same.
2021-07-29Add type annotations to the functionMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Add some type annotations to the functions to reduce the chances of bugs creeping into the code.
2021-07-29Retrieve trait informationMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * gn3/db/traits.py: add functions to retrieve traits information * tests/unit/db/test_traits.py: add tests for new function Add functions to retrieve traits information as is done in genenetwork1 https://github.com/genenetwork/genenetwork1/blob/master/web/webqtl/base/webqtlTrait.py#L397-L456 At this point, the data retrieval functions are probably incomplete, as there is more of the `retrieveInfo` function in GN1 that has not been considered as of this commit.
2021-07-29Make name retrieval more generalMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * gn3/db/traits.py: make function more general * tests/unit/db/test_traits.py: parametrize the tests Make the name retrieval more general for the different types of traits by changing the column specification and table as appropriate.
2021-07-29Retrieve 'ProbeSet' trait nameMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * gn3/db/traits.py: new function (retrieve_probeset_trait_name) * tests/unit/db/test_traits.py: test(s) for new function Add a function to retrieve the name of a 'ProbeSet' trait in a manner similar to genenetwork1's retrieval of the same, as implemented here https://github.com/genenetwork/genenetwork1/blob/master/web/webqtl/base/webqtlDataset.py#L140-154 Unlike in genenetwork1, we do not mutate an object, instead, we return the values as retrieved from the database, and the caller will deal with the returned values as appropriate.
2021-07-29db: traits: Remove publishdata columnBonfaceKilz
2021-07-26gn3: db: Create a raw update queryBonfaceKilz
* gn3/db/__init__.py (update_raw): New function.
2021-07-26db: traits: Fetch sample_data from a trait in csv formBonfaceKilz
2021-07-26Merge branch 'main' of github.com:genenetwork/genenetwork3Muriithi Frederick Muriuki
2021-07-26Fix issues caught by pylintMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Fix a myriad of issues caught by pylint to ensure the code passes all tests.
2021-07-26db: traits: Remove unused functionsBonfaceKilz
2021-07-26Check if corr_coefficient is NaN, since apparently it's stored as NaN ↵zsloan
instead of None when it can't be calculcated (which was messing up sorting); it may also be okay to remove the None check, but leaving it for now (#28)
2021-07-23Add data examples for `slink`. Implement function.Muriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * gn3/computations/slink.py: Copy the function, mostly verbatim from genenetwork1. See: https://github.com/genenetwork/genenetwork1/blob/master/web/webqtl/heatmap/slink.py#L107-L138 * tests/unit/computations/test_slink.py: Add a test with some example data to test that the implementation gives the same results as that in genenetwork1
2021-07-23Iterate through all valid pairsMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * gn3/computations/slink.py: Fix the iteration construct. Given two lists of member coordinates, such as [0, 1] and [3, 5], the initial code would iterate over the pairs [0, 3] and [1, 5]. This commit fixes the iteration constructs such that the new code iterates over the pairs [0, 3], [0, 5], [1, 3] and [1, 5].
2021-07-23Extract function to flatten list of listsMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * gn3/computations/slink.py: Extract the `__flatten_list_of_lists` function since it is used in more than one place.
2021-07-23Fix issue caught in `nearest` while testing `slink`Muriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * While running tests for slink, to try and understand what it is doing in order to write the appropriate tests for it, an issue arose that pointed a blindspot in the former understanding of now `nearest` should work. This commit fixes the issue found in both the expected data, and the code.
2021-07-23New function (`slink`): return [] on exceptionMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * gn3/computations/slink.py: Add minimum code to pass new test * tests/unit/computations/test_slink.py: new test Add test to ensure that the new `slink` function return an empty list in case and exception is raised. Add the new `slink` function with minimum amount of code needed to pass the test.
2021-07-23Add dummy module documentationMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * gn3/computations/slink.py: Add initial dummy module documentation in form of a python docstring Update the names of what would be private methods/function to start with a double-underscore (__) so that they do not show up in the default python documentation.
2021-07-23Add docstring for `nearest' functionMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * gn3/computations/slink.py: add documentation for the `nearest` function in the `gn3.computations.slink` module in the form of a (hopefully correct) python docstring.
2021-07-22Get shortest distance from two lists/tuples of member coordinatesMuriithi Frederick Muriuki
* gn3/computations/slink.py: add code to ensure new test passes * tests/unit/computations/test_slink.py: new test This one is a little weird: from https://github.com/genenetwork/genenetwork1/blob/master/web/webqtl/heatmap/slink.py#L57-L63 It gets rid of the last coordinates in both the lists of the member coordinates, and uses the remaining coordinates to find the shortest members. For example, given the following member coordinates: - i=[0,1,2] and j=[5,7,9], it uses [0,1] and [5,7] - i=[3,6,1] and j=[7,13], it uses [3,6] and [7] to find the shortest distances. I (fredmanglis) am not sure why it does it this way, since I'd have expected it to use all the coordinates, however, since at this time we need to retain bug-compatibility with the older code, I have done it as it is done in the old code. I also add a statement to raise an exception in the case where i and j are not lists of integers, or integers
2021-07-22Extract common `is_list_or_tuple' functionMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Extract the common function `is_list_or_tuple' making it accessible to later parts of the code.