aboutsummaryrefslogtreecommitdiff
path: root/gn3/computations
AgeCommit message (Collapse)Author
2021-11-04Retrieve indices of the selected samplesFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/computations/partial_correlations.py: New function (good_dataset_samples_indexes). * tests/unit/computations/test_partial_correlations.py: Tests for new function (good_dataset_samples_indexes) Get the indices of the selected samples. This is a partial migration of the `web.webqtl.correlation.PartialCorrDBPage.getPartialCorrelationsFast` function in GN1.
2021-11-04Explicitly round the valuesFrederick Muriuki Muriithi
* Explicitly round the values to prevent issues with the type-checker
2021-11-04Specify ten (10) decimal placesFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/computations/partial_correlations.py: specify 10 decimal places * tests/unit/computations/test_partial_correlations.py: update examples Slight differences in python implementations, possibly hardware and operating systems could cause the value of float (double) values to be different in the less significant parts of the decimal places. This commit limits the usable part of the decimals to the first 10 decimal places for now.
2021-11-04Fix linting and typing errorsFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi
2021-11-04Complete `build_temporary_tissue_correlations_table`Frederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/computations/partial_correlations.py: Remove comments after updating usage of the function at call point * gn3/db/correlations.py: Complete the implementation of the `build_temporary_tissue_correlations_table` function
2021-11-04Complete implementation of `batch_computed_tissue_correlation`Frederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Complete the implementation of the `batch_computed_tissue_correlation` function
2021-11-04Move `correlations_of_all_tissue_traits`Frederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/computations/partial_correlations.py: new function (`correlations_of_all_tissue_traits`). * gn3/db/correlations.py: delete function (`correlations_of_all_tissue_traits`). Move the function to `gn3.computations.partial_correlations` module and comment out the db-access code. Rework it to receive, as arguments, the data it previously fetched from the database, and add comments on future rework to get the function working again.
2021-11-04Implement `tissue_correlation` functionFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/computations/partial_correlations.py: New function (tissue_correlation) * tests/unit/test_partial_correlations.py -> tests/unit/computations/test_partial_correlations.py: Move module. Implement tests for new function Migrate the `cal_tissue_corr` function embedded in the `web.webqtl.correlation.correlationFunction.batchCalTissueCorr` function in GN1 and implement tests to ensure it works correctly.
2021-11-04Move the function to computations moduleFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * The function `batch_computed_tissue_correlation` is a pure computations function with no expressions accessing the database, as far as I can tell, therefore, this commit moves the function over to the gn3.computations.partial_correlations module that holds the pure computation functions.
2021-11-04Move the partial_correlations module to gn3.computationsFrederick Muriuki Muriithi
* Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Move the partial_correlations.py module to the gn3.computations module, since it contains the computations for partial correlations.
2021-10-29Feature/biweight reimplementation (#47)Alexander Kabui
* add biweight reimplementation with pingouin * delete biweight scripts and tests * add python-pingouin to guix file * delete biweight paths * mypy fix:pingouin mising imports * pep8 formatting && pylint fixes
2021-10-25mypy:Incompatible types in assignment fixAlexander Kabui
2021-10-25mypy fix for none stdoutAlexander Kabui
2021-10-25pylint and pep8 formattingAlexander Kabui
2021-10-25fix unittestsAlexander Kabui
2021-10-25minor modification for emitting data:add namespacesAlexander Kabui
2021-10-25pep8 formatting,pylint fixesAlexander Kabui
2021-10-25add socket obj and emit processAlexander Kabui
2021-10-25fix issues serializing byte stringAlexander Kabui
2021-10-25rename key to image_dataAlexander Kabui
2021-10-25add function to process imagesAlexander Kabui
2021-10-25add function to capture output in real timeAlexander Kabui
2021-09-27add file not found exceptionAlexander Kabui
2021-09-27return str error for exceptionAlexander Kabui
2021-09-27fix merge conflictsAlexander Kabui
2021-09-27Narrow the exception and add commentsFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Only catch the `FileExistsError` allowing any other exception to pass through. This tries to conform a little to the review at https://github.com/genenetwork/genenetwork3/pull/37#discussion_r714552696
2021-09-27Update terminology: `strain` to `sample`Frederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Update the terminology used: use `sample` in place of `strain` according to Zachary's direction at https://github.com/genenetwork/genenetwork3/pull/37#issuecomment-926043306
2021-09-23minor fixes for endpointAlexander Kabui
2021-09-23Return r error if returncode!=0Alexander Kabui
2021-09-23read generated files from r and return outputAlexander Kabui
2021-09-22Fix more pylint errorsFrederick Muriuki Muriithi
2021-09-22Fix typing issuesFrederick Muriuki Muriithi
* Ignore some errors * Update typing definitions for some portions of code * Add missing imports
2021-09-22Fix pylint errorsFrederick Muriuki Muriithi
* Add missing function and module docstrings * Remove unused imports * Fix import order * Rework some code sections to fix issues * Disable some pylint errors.
2021-09-17Fix a number of linting issuesFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi
2021-09-16run cmd and add exception handlerAlexander Kabui
2021-09-16add function to compose and run wgcna scriptAlexander Kabui
2021-09-16function to parse form data and write to json fileAlexander Kabui
2021-09-15init wgcna file to run r script and preprocess dataAlexander Kabui
2021-09-15Reorganise modulesFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * The heatmap generation does not fall cleanly within the computations or db modules. This commit moves it to the higher level gn3 module.
2021-09-08Ease search for traits and chromosomesMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Return a dict of values rather than list for the traits and chromosomes to ease searching through the data.
2021-09-08Parse Chr value as int where possibleMuriithi Frederick Muriuki
* To ease sorting of data by numerical order down the line, sort the "Chr" values by numerical order.
2021-09-08Remove extraneous text to ease sortingMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Change the id from 'T<n>' to simply '<n>' to ease sorting of the trait results by numerical order rather than string order.
2021-09-08Fix the traits order computations for clusteringMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * gn3/computations/heatmap.py: Fix ordering function * tests/unit/computations/test_heatmap.py: update test The order of the traits is important for the clustering algorithm, since the clustering seems to use the distance of one trait from another to determine how to order them. This commit also gets rid of the xoffset argument that is not important to the ordering, and was used in the older GN1 to determine how to draw the clustering lines.
2021-09-06Provide function to organise parsed QTLReaper resultsMuriithi Frederick Muriuki
* gn3/computations/qtlreaper.py: Provide a function to organise the results by trait for easier use down the line. * tests/unit/computations/test_qtlreaper.py: provide a test to ensure that the organising function works as expected.
2021-09-06Leave "Chr" value as string when parsingMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * The "Chr" value seems to be mostly a name of some sort, despite it being, seemingly an number. This commit parses the "Chr" value as a string. It also updates the tests to expec a string, rather than a number for "Chr" values.
2021-09-06Handle type-coercion exceptionsMuriithi Frederick Muriuki
* gn3/computations/qtlreaper.py: handle exceptions Sometimes, the values being parsed are plain strings and cannot be cast to the float types. This commit handles that by casting only those values that can be cast to float, and returning the others as strings.
2021-09-06Find nearest markerMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Migrate the `web.webqtl.heatmap.Heatmap.getNearestMarker` function in GN1 to GN3.
2021-08-31Fix linting errors, minor bugs and reorganise codeMuriithi Frederick Muriuki
* Fix some linting errors and some minor bugs caught by the linter. Move the `random_string` function to separate module for use in multiple places in the code.
2021-08-31Update `heatmap_data` function: remove extraneous dataMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * gn3/computations/heatmap.py: update function * gn3/db/traits.py: new function Remove extraneous data and arguments from the function. - Load the genotype file - Generate traits file - Provide both raw traits data, and exported traits data in return
2021-08-31Parse QTLReaper outputsMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * gn3/computations/qtlreaper.py: pass output files * tests/unit/computations/data/qtlreaper/main_output_sample.txt: sample test data * tests/unit/computations/data/qtlreaper/permu_output_sample.txt: sample test data * tests/unit/computations/test_qtlreaper.py: add tests Add code to parse the QTLReaper output data files.