aboutsummaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2021-11-01 08:18:48 +0300
committerBonfaceKilz2021-11-04 12:45:57 +0300
commit856ee56890f9c10401b717579dc8c0358c7d465d (patch)
tree93acd047af24a6f8ae8ea8fd550de643f3e862b5 /tests/unit
parent4ecaae288c78f8c3b4b6b40b56de3ba392ecc1bd (diff)
downloadgenenetwork3-856ee56890f9c10401b717579dc8c0358c7d465d.tar.gz
Retrieve indices of the selected samples
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.
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/computations/test_partial_correlations.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/unit/computations/test_partial_correlations.py b/tests/unit/computations/test_partial_correlations.py
index c4ec79a..f7217a9 100644
--- a/tests/unit/computations/test_partial_correlations.py
+++ b/tests/unit/computations/test_partial_correlations.py
@@ -6,7 +6,8 @@ from gn3.computations.partial_correlations import (
control_samples,
dictify_by_samples,
tissue_correlation,
- find_identical_traits)
+ find_identical_traits,
+ good_dataset_samples_indexes)
sampleslist = ["B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"]
control_traits = (
@@ -260,3 +261,13 @@ class TestPartialCorrelations(TestCase):
with self.subTest(primary=primary, target=target, method=method):
self.assertEqual(
tissue_correlation(primary, target, method), expected)
+
+ def test_good_dataset_samples_indexes(self):
+ """
+ Test that `good_dataset_samples_indexes` returns correct indices.
+ """
+ self.assertEqual(
+ good_dataset_samples_indexes(
+ ("a", "e", "i", "k"),
+ ("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l")),
+ (0, 4, 8, 10))