about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2025-09-02 21:28:01 +0100
committerArun Isaac2025-09-02 22:32:03 +0100
commit831f3da094834547fd9a2d357a8006c065a85289 (patch)
treee010dca5180ca6162702cc8af271bf17d661dfad
parent7fd6a0ac1eccff5d772942b5de453309a967ca0b (diff)
downloadpyhegp-831f3da094834547fd9a2d357a8006c065a85289.tar.gz
pyhegp-831f3da094834547fd9a2d357a8006c065a85289.tar.lz
pyhegp-831f3da094834547fd9a2d357a8006c065a85289.zip
Add is_phenotype_metadata_column.
Promote phenotype_reserved_column_name_p from helpers.strategies to
is_phenotype_metadata_column in pyhegp.serialization.
-rw-r--r--pyhegp/serialization.py3
-rw-r--r--tests/helpers/strategies.py7
2 files changed, 5 insertions, 5 deletions
diff --git a/pyhegp/serialization.py b/pyhegp/serialization.py
index ba2cb0f..c197bf2 100644
--- a/pyhegp/serialization.py
+++ b/pyhegp/serialization.py
@@ -95,6 +95,9 @@ def read_genotype(file):
     df[sample_columns] = df[sample_columns].astype("float")
     return df
 
+def is_phenotype_metadata_column(name):
+    return name.lower() == "sample-id"
+
 def read_phenotype(file):
     df = read_tsv(file, {"sample-id": "str"})
     phenotype_columns = [column
diff --git a/tests/helpers/strategies.py b/tests/helpers/strategies.py
index 416a914..de8239c 100644
--- a/tests/helpers/strategies.py
+++ b/tests/helpers/strategies.py
@@ -19,7 +19,7 @@
 from hypothesis import strategies as st
 from hypothesis.extra.pandas import column, columns, data_frames
 
-from pyhegp.serialization import Summary, is_genotype_metadata_column
+from pyhegp.serialization import Summary, is_genotype_metadata_column, is_phenotype_metadata_column
 from pyhegp.utils import negate
 
 tabless_printable_ascii_text = st.text(
@@ -71,11 +71,8 @@ def genotype_frames(draw):
                genotype.columns)),
                                     ignore_index=True)
 
-def phenotype_reserved_column_name_p(name):
-    return name.lower() == "sample-id"
-
 phenotype_names = st.lists(tabless_printable_ascii_text
-                           .filter(negate(phenotype_reserved_column_name_p)),
+                           .filter(negate(is_phenotype_metadata_column)),
                            unique=True)
 
 @st.composite