Skip to content

Commit c3d75fe

Browse files
committed
fix(hurdle): correct sex mapping, add methylation_sites method
1 parent b8f765c commit c3d75fe

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

biolearn/model.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1694,9 +1694,10 @@ def predict(
16941694
sample_meta["chronologicalAge"] = float(row["age"])
16951695
if "sex" in row:
16961696
sex_value = row["sex"]
1697+
# Biolearn standard: 0=female, 1=male (metadata_standard.rst)
16971698
sample_meta["sex"] = (
16981699
"f"
1699-
if sex_value in [1, "f", "F", "female"]
1700+
if sex_value in [0, "f", "F", "female"]
17001701
else "m"
17011702
)
17021703

@@ -1753,6 +1754,10 @@ def predict(
17531754
except Exception as e:
17541755
raise Exception(f"API error: {str(e)}")
17551756

1757+
def methylation_sites(self):
1758+
"""Return list of required CpG sites for imputation compatibility."""
1759+
return self.required_cpgs if self.required_cpgs else []
1760+
17561761

17571762
class ImputationDecorator:
17581763
def __init__(self, clock, imputation_method):

0 commit comments

Comments
 (0)