aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
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-23Add more test dataMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi
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-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-22Test for shortest distance between members in a list and coordinateMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * gn3/computations/slink.py: add code to pass new test * tests/unit/computations/test_slink.py: new test Given a list of members in a group, and a coordinate for a member in the same group, find the distance of the closest member from the given coordinate in the group.
2021-07-22Check that given list and both coordinates, we get shortest distanceMuriithi Frederick Muriuki
* gn3/computations/slink.py: Add code to compute the distance given the coordinate of both members on the parent list/tuple * tests/unit/computations/test_slink.py: * Change the name of the tests to more closely correspond to the business requirement the test is checking for * Update the comments to indicate some more things that might need to be done in the future
2021-07-22Check that all distances are positive or zeroMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * gn3/computations/slink.py: check that all distances between the 'somethings' are all either zero or positive. * tests/unit/computations/test_slink.py: * Remove data with all distances positive or zero, since it would fail the test * Change the expected message to more closely correspond to the business logic
2021-07-22Check that distance from A to B is same as from B to AMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * gn3/computations/slink.py: check that the distance from child A to B is the same as distance from child B to A. If not, throw an exception. * tests/unit/computations/test_slink.py: * Change the name of the test to more closely correspond to the business logic being tested. * Update the data in a separate test such that it does not error out due to failing to fulfill the expectations of separate requirement. - pass tests - Rename test - Fix errors: distances same both directions
2021-07-22Check that child distance from itself is zeroMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * gn3/computations/slink.py: Check that a child's distance from itself is zero. If not, throw an exception. The children lists are a list of distances of "something" from other "somethings". There is still some need to establish what those "somethings" are, so that the test names can reflect the ideas that are actually being tested for. * tests/unit/computations/test_slink.py: Change the name of the test so that it more closely corresponds to the business logic it is actually testing, and not the mechanics of testing the idea.
2021-07-21Extract tests from code in GN1Muriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * gn3/computations/slink.py: Add dummy `nearest' function * tests/unit/computations/test_slink.py: Add some tests This commit adds tests to try and reproduce the working of the `nearest' function in: https://github.com/genenetwork/genenetwork1/blob/master/web/webqtl/heatmap/slink.py This commit might not yet have extracted all the expected behaviour of the `nearest' function, and therefore, there is a possibility of a later commit augmenting the work in this commit.
2021-07-20Add test for code to move over from GN1Muriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * .gitignore: ignore emacs temporary files * gn3/computations/correlations2.py: add a dummy function * tests/unit/computations/test_correlation.py: add unit tests for the function As part of the move of the clustering and heatmap code over from GN1 to GN3, this commit begins by providing some unit tests for the correlation function used to ensure that the implementation that is built up here corresponds, and produces the same results as the original. This tests and the function might change in the new system, but for now, we try and maintain bug-to-bug compatibility.
2021-07-10Fix pylint issuesBonfaceKilz
2021-07-10db: test_db: Test that a fetch is correct when columns are specifiedBonfaceKilz
2021-06-29tests: test_commands: Add extra check for when an error occursBonfaceKilz
2021-06-29Add a diffing functionBonfaceKilz
For now the diff function uses the Linux tool "diff" to generate the diff since it is efficient and straightforward. * gn3/computations/diff.py (generate_diff): New function. * tests/unit/computations/test_diff.py: Test cases for ☝🏾.
2021-06-29tests: test_data: Add test data that contains trait data for 10007BonfaceKilz
2021-06-20merge mainAlexander Kabui
2021-06-20make requested changes to biweightAlexander Kabui
2021-06-18Fixed another error where test_generate_rqtl_command didn't include the ↵zsloan
filename argument (not sure why running unit tests locally doesn't detect this)
2021-06-18Fixed file type from json to csv for test_generate_rqtl_commandzsloan
2021-06-18Fixed test_rqtl.py to include Rscript in the commandzsloan
2021-06-18Fixed test_compose_rqtl_command test; forgot to include Rscript in the commandzsloan
2021-06-18Change test_compose_rqtl_command in test_commands.py to have different ↵zsloan
arguments to hopefully avoid github's pylint 'duplicate code' complaint Changed some parameters in test_compose_rqtl_cmd to avoid pylint complaining about duplicate code
2021-06-18minor fixesAlexander Kabui
2021-06-18remove ununsed variablesAlexander Kabui
2021-06-18refactor perf query functionsAlexander Kabui
2021-06-18rename perf query fileAlexander Kabui
2021-06-18pep8 formattingAlexander Kabui
2021-06-18add types and dataset namesAlexander Kabui
2021-06-18initial commit for queries perfomance testsAlexander Kabui
2021-06-18db: test_db: Add extra variable in test data for "id"BonfaceKilz
2021-06-18Rename json_data column to json_diff_dataBonfaceKilz
2021-06-18tests: test_db: Add a test-case for fetchallBonfaceKilz
2021-06-18tests: test_db: Rename TestPhenotypeBonfaceKilz
2021-06-18tests: test_phenotype: Rename to test_dbBonfaceKilz
2021-06-18Use prepared statements for FETCH sql functionBonfaceKilz
2021-06-18Use prepared statements for UPDATE sql functionBonfaceKilz
2021-06-18tests: test_audit: Update test case to check for prepared statementsBonfaceKilz
2021-06-18Add data structures for the table metadata_auditBonfaceKilz
2021-06-18unit: test_phenotypes: Test for multiple "WHERE" clausesBonfaceKilz
2021-06-18Get the diff between 2 dicts and return that as a dictBonfaceKilz
2021-06-18fix index error (#16)Alexander Kabui
2021-06-18Move the methods, "update" and "fetch", to gn3.dbBonfaceKilz
2021-06-18tests: test_phenotype: Add function that tests "fetchone"BonfaceKilz
2021-06-18db: phenotypes: Update failing testsBonfaceKilz
2021-06-18tests: test_phenotypes: New test cases for loading phenotypesBonfaceKilz
2021-06-14add biweight r script and testsAlexander Kabui
2021-06-11minor fixesAlexander Kabui
2021-06-11remove ununsed variablesAlexander Kabui