about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorArun Isaac2026-01-28 00:23:56 +0000
committerArun Isaac2026-01-28 01:18:09 +0000
commitee0b1836f33004c62d05408c4ee2b69086652131 (patch)
treed284558a4049c8e6b9f910f5c5b046c5e2b3a248 /tests
parent963e662a93291b2e5297f637e8a59947657d4325 (diff)
downloadpyhegp-ee0b1836f33004c62d05408c4ee2b69086652131.tar.gz
pyhegp-ee0b1836f33004c62d05408c4ee2b69086652131.tar.lz
pyhegp-ee0b1836f33004c62d05408c4ee2b69086652131.zip
Do not drop zero standard deviation SNPs with --only-center.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_pyhegp.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_pyhegp.py b/tests/test_pyhegp.py
index 569ebe5..3192bf7 100644
--- a/tests/test_pyhegp.py
+++ b/tests/test_pyhegp.py
@@ -178,6 +178,19 @@ def test_encrypt_genotype_does_not_produce_na(genotype, key, only_center):
 def test_encrypt_phenotype_does_not_produce_na(phenotype, key):
     assert not encrypt_phenotype(phenotype, key).isna().any(axis=None)
 
+def test_encrypt_with_only_center_does_not_drop_snps(tmp_path):
+    genotype_file = Path("test-data/genotype-with-zero-stddev-snp.tsv")
+    shutil.copy(genotype_file, tmp_path)
+    result = CliRunner().invoke(main, ["encrypt",
+                                       "--only-center",
+                                       str(tmp_path / genotype_file.name)])
+    assert result.exit_code == 0
+    with genotype_file.open("rb") as file:
+        genotype = read_genotype(file)
+    with (tmp_path / f"{genotype_file.name}.hegp").open("rb") as file:
+        encrypted_genotype = read_genotype(file)
+    assert len(genotype) == len(encrypted_genotype)
+
 @pytest.mark.parametrize("summary_files",
                          [[Path("test-data/pool-test-summary1"),
                            Path("test-data/pool-test-summary2")],