From 831f3da094834547fd9a2d357a8006c065a85289 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Tue, 2 Sep 2025 21:28:01 +0100 Subject: Add is_phenotype_metadata_column. Promote phenotype_reserved_column_name_p from helpers.strategies to is_phenotype_metadata_column in pyhegp.serialization. --- pyhegp/serialization.py | 3 +++ tests/helpers/strategies.py | 7 ++----- 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 -- cgit 1.4.1