Skip to content

Summary Statistics QC

gentropy.sumstat_qc_step.SummaryStatisticsQCStep

Step to run GWAS QC.

Source code in src/gentropy/sumstat_qc_step.py
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
class SummaryStatisticsQCStep:
    """Step to run GWAS QC."""

    def __init__(
        self,
        session: Session,
        gwas_path: str,
        output_path: str,
        pval_threshold: float = 5e-8,
    ) -> 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.
            pval_threshold (float): P-value threshold for the QC. Default is 5e-8.
        """
        gwas = SummaryStatistics.from_parquet(session, path=gwas_path)

        (
            SummaryStatisticsQC.from_summary_statistics(
                gwas=gwas,
                pval_threshold=pval_threshold,
            )
            .df.repartition(1)
            .write.mode(session.write_mode)
            .parquet(output_path)
        )