prs-ui
Reusable Reflex UI components for Polygenic Risk Score (PRS) computation using the PGS Catalog.
Built on top of just-prs for the computation engine and reflex-mui-datagrid for data grid display.
Installation
pip install prs-ui
Running the Standalone App
uv run start
The launcher reads .env, resolves both the Reflex frontend port (PRS_UI_PORT, default 3000) and backend port (PRS_UI_BACKEND_PORT, default 8000), and passes the resolved pair explicitly to Reflex so another running Reflex app cannot shift only one side. Runtime uploads go under PRS_UI_DATA_DIR/input/ (default: ./data/input/ from the directory where the launcher was invoked), which keeps uvx runs from writing into the installed package.
Quick Start
import polars as pl
import reflex as rx
from reflex_mui_datagrid import LazyFrameGridMixin
from prs_ui import PRSComputeStateMixin, prs_section
class MyAppState(rx.State):
genome_build: str = "GRCh38"
cache_dir: str = ""
status_message: str = ""
class PRSState(PRSComputeStateMixin, LazyFrameGridMixin, MyAppState):
def load_genotypes(self, parquet_path: str) -> None:
lf = pl.scan_parquet(parquet_path)
self.set_prs_genotypes_lf(lf) # preferred: provide a LazyFrame
self.prs_genotypes_path = parquet_path
def prs_page() -> rx.Component:
return prs_section(PRSState)
Components
| Component | Description |
|---|---|
prs_workbench(source_section, prs_state, trait_state, mode_state, trait_selector, ...) |
Unified single-tab layout: one shared genotype source + Select by PRS / Select by Trait sub-tabs, per-mode controls, compute button, and per-mode results |
vcf_source_section(source_state) |
Reference detachable genotype source: compact VCF upload + build detection + collapsed normalized preview. Swap it for your own source in a host app |
prs_shared_build_bar(source_state) |
Single genome-build selector that fans the build out to all consumer states |
prs_section(state) |
Older single-state section: build selector + score grid + compute button + progress + results |
prs_build_selector(state) |
Genome build dropdown (GRCh37/GRCh38) |
prs_scores_selector(state) |
MUI DataGrid for score selection. Selection (checkboxes + Select/Clear) is read-only and dimmed until genotypes are loaded, with an "upload a VCF" callout |
prs_compute_button(state) |
Compute button with disclaimer callout |
prs_progress_section(state) |
Progress bar and status text during computation |
prs_results_table(state) |
Results table with quality badges, interpretation cards, and CSV download. Curated scores show "Higher score means …", a Direction badge, and valence colours (green favourable, red only alarming) |
trait_selector(state, show_search=True) |
By Trait grid grouped by curated concept (default; ontology or reported trait selectable), with an "Also known as" column and a synonym-aware search bar (trait_search_bar) |
The genotype source is loosely coupled to the PRS logic: a source pushes a normalized
genotypes parquet into each consumer via the additive load_genotypes(path) hook, or
several at once via load_samples([{"label", "path"}, ...]) for CLI-style multi-sample
comparison (per-sample colors, medians, and bell-curve markers). Each uploaded sample
gets its genetic ancestry autodetected (1000 Genomes reference panel): the sample row
shows the population with the classifier's confidence plus the closest 1000G cohort as a
clickable IGSR link with its own confidence — a reference point, not a nationality — and
the majority detected population becomes the percentile reference (shown on each sample
row; override via the trait dashboard Population dropdown). After
computing, the chart panel renders automatically for the first (or currently open)
result/trait — no row click needed. Sources may also pass optional per-sample
ancestry / ancestry_confidence / fine_population / fine_confidence keys, and optionally
set_genome_build(build), so a host app can replace vcf_source_section /
GenomicGridState with its own source (public genome, consumer-array file, pre-normalized
parquet) without touching PRSComputeStateMixin. VCF normalization (not upload) is the
slow step; it is content-aware cached (a fresh normalized parquet is reused) and shown via an
indeterminate progress bar.
Curated score directions
Both consumers read the published direction curation through PRSCatalog (pulled from
just-dna-seq/pgs-catalog, refreshed after PRS_CURATION_MAX_AGE_HOURS): every result row
carries higher_percentile_means, curation_status, concept, axis, valence and polarity;
trait summaries put opposite-direction scores on one concept axis and list scores still in
curation review without counting them. The Curated tab shows the published tables when the
app is not running inside a curation/ checkout.
State Mixin
PRSComputeStateMixin provides all PRS computation logic as a Reflex state mixin. Mix it into your concrete state class alongside LazyFrameGridMixin to get the full PRS workflow.
The preferred input method is a polars LazyFrame via set_prs_genotypes_lf() -- memory-efficient and avoids re-reading VCF files on each computation. A parquet path (prs_genotypes_path) is supported as a fallback.
Documentation
See the just-prs documentation for the full Python API, CLI reference, and integration guide.
Metadata
Release files for prs-ui 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| prs_ui-0.4.0.tar.gz | 181.2 kB | Without provenance | Details for prs_ui-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| prs_ui-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for prs_ui-0.4.0-py3-none-any.whl |
Total release size: 297.3 kB
Release files / prs_ui-0.4.0.tar.gz
| Download URL | prs_ui-0.4.0.tar.gz |
|---|---|
| Size | 181.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ea271b5e016090e65813d502a7dba1efcb9abbd00cce7b36763849387a546c13
|
|
BLAKE2b-256 checksum How to use checksums |
8e1efba91ad8b377b8c2910afdc7f4fadc3f520a8330983863bd49a498af60f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / prs_ui-0.4.0-py3-none-any.whl
| Download URL | prs_ui-0.4.0-py3-none-any.whl |
|---|---|
| Size | 116.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a4c27b5f2c0d1ea13c61ff0c23311c57903e99a5fe356179a04f05e2920a5653
|
|
BLAKE2b-256 checksum How to use checksums |
f8de70cedce2862072811e05e3acd62fadc5b2414623f53ec1741a655328999e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for prs-ui 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.