Skip to main content

Reusable Reflex UI components for Polygenic Risk Score computation with PGS Catalog

Project description

prs-ui

PyPI version

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.

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_section(state) Complete PRS 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 with checkboxes and filtering
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

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prs_ui-0.2.5.tar.gz (37.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prs_ui-0.2.5-py3-none-any.whl (43.1 kB view details)

Uploaded Python 3

File details

Details for the file prs_ui-0.2.5.tar.gz.

File metadata

  • Download URL: prs_ui-0.2.5.tar.gz
  • Upload date:
  • Size: 37.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","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}

File hashes

Hashes for prs_ui-0.2.5.tar.gz
Algorithm Hash digest
SHA256 35a08bc5465709aa0b19893eb7d4d73ea5c07d93ba04ed41a6214f0bdd030c81
MD5 6ec5f12379ac1558c8462b2ec04ae5c7
BLAKE2b-256 bb5eef8611df6a25a2084cbca75a056bc9a2ccc7553b1a04d4363e71e3a226cd

See more details on using hashes here.

File details

Details for the file prs_ui-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: prs_ui-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 43.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","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}

File hashes

Hashes for prs_ui-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f732bd3cdeeea3a6b7399ff8ae6859332d33815b705d7b05120701b57a790c02
MD5 d11faba86f7c7d71c3983dacbd6568eb
BLAKE2b-256 d23c76a81b857445b573ab178258ef64c6057c702da6c9bffa9a6c2523da44e3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page