Skip to content

Commit

Permalink
feat(gold_standard): add traitFromSourceMappedId to schema (opentarge…
Browse files Browse the repository at this point in the history
…ts#924)

* feat(gold_standard): add traitFromSourceMappedId to schema

* chore: adapt tests

* feat(feature_matrix): consider `traitFromSourceMappedId` a static column

* feat(feature_matrix): consider `traitFromSourceMappedId` an optional column
  • Loading branch information
ireneisdoomed authored Nov 27, 2024
1 parent 008aa38 commit 4837a4b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/gentropy/assets/schemas/l2g_gold_standard.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
"nullable": false,
"metadata": {}
},
{
"name": "traitFromSourceMappedId",
"type": "string",
"nullable": true,
"metadata": {}
},
{
"name": "goldStandardSet",
"type": "string",
Expand Down
2 changes: 2 additions & 0 deletions src/gentropy/dataset/l2g_feature_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def __init__(
self.fixed_cols = ["studyLocusId", "geneId"]
if self.with_gold_standard:
self.fixed_cols.append("goldStandardSet")
if "traitFromSourceMappedId" in _df.columns:
self.fixed_cols.append("traitFromSourceMappedId")

self.features_list = features_list or [
col for col in _df.columns if col not in self.fixed_cols
Expand Down
2 changes: 1 addition & 1 deletion tests/gentropy/dataset/test_l2g_feature_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def _setup(self: TestFromFeaturesList, spark: SparkSession) -> None:
"""Setup fixture."""
self.sample_gold_standard = L2GGoldStandard(
_df=spark.createDataFrame(
[(1, "var1", "gwas1", "g1", "positive", ["a_source"])],
[(1, "var1", "gwas1", "g1", "efo1", "positive", ["a_source"])],
L2GGoldStandard.get_schema(),
),
_schema=L2GGoldStandard.get_schema(),
Expand Down

0 comments on commit 4837a4b

Please sign in to comment.