-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add qc step * fix: remove .df * fix: fix in name * fix: fix v3 * Update src/gentropy/sumstat_qc_step.py Co-authored-by: Daniel Suveges <[email protected]> * Update src/gentropy/sumstat_qc_step.py Co-authored-by: Daniel Suveges <[email protected]> * fix: optimisation of code --------- Co-authored-by: Daniel Suveges <[email protected]>
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
"""Step to calculate quality control metrics on the provided GWAS study.""" | ||
|
||
from __future__ import annotations | ||
|
||
from gentropy.common.session import Session | ||
from gentropy.dataset.summary_statistics import SummaryStatistics | ||
from gentropy.method.sumstat_quality_controls import SummaryStatisticsQC | ||
|
||
|
||
class SummaryStatisticsQCStep: | ||
"""Step to run GWAS QC.""" | ||
|
||
def __init__( | ||
self, | ||
session: Session, | ||
gwas_path: str, | ||
output_path: str, | ||
studyid: str, | ||
) -> None: | ||
"""Calculating quality control metrics on the provided GWAS study. | ||
Args: | ||
session (Session): Spark session | ||
gwas_path (str): Path to the GWAS summary statistics. | ||
output_path (str): Output path for the QC results. | ||
studyid (str): Study ID for the QC. | ||
""" | ||
gwas = SummaryStatistics.from_parquet(session, path=gwas_path) | ||
|
||
( | ||
SummaryStatisticsQC.get_quality_control_metrics( | ||
gwas=gwas, limit=100_000_000, min_count=100, n_total=100000 | ||
) | ||
.write.mode(session.write_mode) | ||
.parquet(output_path + "/qc_results_" + studyid) | ||
) |