diff options
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | gn3/computations/correlations2.py | 4 | ||||
-rw-r--r-- | tests/unit/computations/test_correlation.py | 26 |
3 files changed, 33 insertions, 0 deletions
@@ -179,3 +179,6 @@ dmypy.json # Pyre type checker .pyre/ + +# emacs temporary files +/**/*~
\ No newline at end of file diff --git a/gn3/computations/correlations2.py b/gn3/computations/correlations2.py new file mode 100644 index 0000000..193f646 --- /dev/null +++ b/gn3/computations/correlations2.py @@ -0,0 +1,4 @@ +## From GN1: mostly for clustering and heatmap generation + +def compute_correlation(dbdata, userdata): + return tuple() diff --git a/tests/unit/computations/test_correlation.py b/tests/unit/computations/test_correlation.py index b1bc6ef..6153c8a 100644 --- a/tests/unit/computations/test_correlation.py +++ b/tests/unit/computations/test_correlation.py @@ -19,6 +19,7 @@ from gn3.computations.correlations import compute_all_lit_correlation from gn3.computations.correlations import compute_all_tissue_correlation from gn3.computations.correlations import map_shared_keys_to_values from gn3.computations.correlations import process_trait_symbol_dict +from gn3.computations.correlations2 import compute_correlation class QueryableMixin: @@ -464,3 +465,28 @@ class TestCorrelation(TestCase): trait_symbol_dict, tissue_values_dict) self.assertEqual(results, [expected_results]) + + def test_compute_correlation(self): + for dbdata,userdata,expected in [ + [[None,None,None,None,None,None,None,None,None,None], + [None,None,None,None,None,None,None,None,None,None], + (0.0, 0)], + [[None,None,None,None,None,None,None,None,None,0], + [None,None,None,None,None,None,None,None,None,None], + (0.0, 0)], + [[None,None,None,None,None,None,None,None,None,0], + [None,None,None,None,None,None,None,None,None,0], + (0.0, 1)], + [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0], + (0, 10)], + [[9.87,9.87,9.87,9.87,9.87,9.87,9.87,9.87,9.87,9.87], + [9.87,9.87,9.87,9.87,9.87,9.87,9.87,9.87,9.87,9.87], + (0.9999999999999998, 10)], + [[9.3,2.2,5.4,7.2,6.4,7.6,3.8,1.8,8.4,0.2], + [0.6,3.97,5.82,8.21,1.65,4.55,6.72,9.5,7.33,2.34], + (-0.12720361919462056, 10)], + [[0,1,2,3,4,5,6,7,8,9], + [None,None,None,None,2,None,None,3,None,None], + (0.0, 2)]]: + with self.subTest(dbdata=dbdata, userdata=userdata): + self.assertEqual(compute_correlation(dbdata,userdata), expected) |