PheTK
A fast, efficient, and resource-friendly Python library for PheWAS analysisFive modules that compose into one workflow: clinvar selects variants by clinical significance, cohort builds the study population, phecode maps diagnosis codes to phenotypes, phewas runs the regressions, plot draws the result.
Running a PheWAS at biobank scale usually means assembling several tools and writing the glue between them. PheTK covers the whole path: genetic cohort, covariates, ICD-to-phecode mapping and phecode counts, the regressions, the plot. On the All of Us Researcher Workbench it covers it directly, with functions that already know where the data sits and what shape it is in. The queries, the joins, the reshaping between steps all stay inside the package, so what is left to the researcher is the analysis: choose a variant, choose covariates, choose a model, read the result. Both phecode 1.2 and phecodeX 1.0 are supported, and the model can be logistic or Cox, with or without Firth penalization.
Underneath, it is built for the scale that arrived since most PheWAS packages were written, when a large cohort meant tens of thousands of people. It has been tested to a million participants, roughly twice the largest cohort that currently has the health record data a PheWAS needs (UK Biobank, 500,000; All of Us, ~481,000 with linked EHR). Speed and footprint come out of the same choices: efficient dependencies and data formats, implementations written to fit the problem, and parallelization applied where the method actually benefits from it. On an end-to-end workflow it is substantially faster than the established alternatives it has been benchmarked against.
The All of Us support is convenience, not dependency. The PheWAS function itself is platform-independent and runs on modest resources, a smaller cluster or a laptop, where it finishes rather than running out of memory. And on the platforms the data cannot leave, compute is billed by the hour, so a lighter run is a cheaper one, which keeps the same analysis affordable for a single researcher rather than only a well-funded group. It has been cited by twenty-five papers since release, including in Nature, Nature Genetics, and the Journal of Clinical Investigation.