Skip to content

Commit

Permalink
feat: required changes in variant index
Browse files Browse the repository at this point in the history
  • Loading branch information
d0choa committed Dec 7, 2023
1 parent f208d60 commit 0d1b387
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 12 deletions.
60 changes: 53 additions & 7 deletions src/otg/assets/schemas/variant_index.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,26 +76,72 @@
"metadata": {}
},
{
"name": "cadd",
"name": "inSilicoPredictors",
"nullable": false,
"metadata": {},
"type": {
"type": "struct",
"fields": [
{
"name": "phred",
"type": "float",
"name": "cadd",
"nullable": true,
"metadata": {},
"type": {
"type": "struct",
"fields": [
{
"name": "raw",
"type": "float",
"nullable": true,
"metadata": {}
},
{
"name": "phred",
"type": "float",
"nullable": true,
"metadata": {}
}
]
}
},
{
"name": "revelMax",
"type": "double",
"nullable": true,
"metadata": {}
},
{
"name": "raw",
"name": "spliceaiDsMax",
"type": "float",
"nullable": true,
"metadata": {}
},
{
"name": "pangolinLargestDs",
"type": "double",
"nullable": true,
"metadata": {}
},
{
"name": "phylop",
"type": "double",
"nullable": true,
"metadata": {}
},
{
"name": "siftMax",
"type": "double",
"nullable": true,
"metadata": {}
},
{
"name": "polypheMax",
"type": "double",
"nullable": true,
"metadata": {}
}
]
},
"nullable": true,
"metadata": {}
}
},
{
"name": "mostSevereConsequence",
Expand Down
2 changes: 1 addition & 1 deletion src/otg/dataset/variant_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def from_variant_annotation(
"positionB37",
"alleleType",
"alleleFrequencies",
"cadd",
"inSilicoPredictors",
]
va_slimmed = variant_annotation.filter_by_variant_df(
study_locus.unique_variants_in_locus()
Expand Down
8 changes: 4 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,13 +354,13 @@ def mock_variant_annotation(spark: SparkSession) -> VariantAnnotation:
expr='named_struct("cadd", named_struct("phred", cast(rand() as float), "raw_score", cast(rand() as float)), "revelMax", cast(rand() as double), "spliceaiDsMax", cast(rand() as float), "pangolinLargestDs", cast(rand() as double), "phylop", cast(rand() as double), "polyphenMax", cast(rand() as double), "siftMax", cast(rand() as double))',
percentNulls=0.1,
)

)
return VariantAnnotation(_df=data_spec.build(), _schema=va_schema)


@pytest.fixture()
def mock_variant_index(spark: SparkSession) -> VariantIndex:
"""Mock gene index."""
"""Mock variant index."""
vi_schema = VariantIndex.get_schema()

data_spec = (
Expand All @@ -383,8 +383,8 @@ def mock_variant_index(spark: SparkSession) -> VariantIndex:
percentNulls=0.1,
)
.withColumnSpec(
"cadd",
expr='named_struct("phred", cast(rand() AS float), "raw", cast(rand() AS float))',
"inSilicoPredictors",
expr='named_struct("cadd", named_struct("phred", cast(rand() as float), "raw_score", cast(rand() as float)), "revelMax", cast(rand() as double), "spliceaiDsMax", cast(rand() as float), "pangolinLargestDs", cast(rand() as double), "phylop", cast(rand() as double), "polyphenMax", cast(rand() as double), "siftMax", cast(rand() as double))',
percentNulls=0.1,
)
.withColumnSpec("rsIds", expr="array(cast(rand() AS string))", percentNulls=0.1)
Expand Down

0 comments on commit 0d1b387

Please sign in to comment.