Skip to content

PGxEngine BETA-1.1

Choose a tag to compare

@PrideInt PrideInt released this 17 Nov 21:46
· 11 commits to master since this release

PGxEngine BETA-1.1 (prototype)

Highlights

  • You can now build standalone distributions. New build scripts make two kinds of build: one that needs nothing installed, and a portable one that only needs Java.
  • New model for panel-based results. A new Hardy-Weinberg model estimates how likely each phenotype is when a genotyping panel only tested some alleles. It isn't shown in reports yet.

New: distribution packaging

  • packaging/build.sh (Linux, macOS, Git Bash on Windows) and packaging/build.ps1 (Windows, no bash needed) each build two outputs under dist/:
    • PGxEngine/ (or PGxEngine.app on macOS) is a native app made with jpackage. It includes Java and the engine, so nothing needs installing.
    • PGxEngine-portable/ is a runnable jar plus the engine. It needs Java 17+ and runs on Windows, Linux and Apple Silicon.
  • Both builds include a frozen engine and a copy of the knowledge base. Both start the engine themselves on the local machine only (loopback) and stop it when the window closes.
  • The engine is frozen with PyInstaller (packaging/pgx-engine.spec, packaging/engine_main.py) as a folder rather than a single file, so it starts faster and antivirus software is less likely to flag it.
  • pgx.db is placed next to the engine, not inside it, so you can update the knowledge base without rebuilding the engine.
  • The scripts pick a Python that has PyInstaller automatically. You can override this with PYTHON=....
  • Each build includes a README.txt with run steps, platform limits and where to find pgx-engine.log.
  • Added the Windows app icon packaging/app.ico.
  • Builds don't cross-compile: run the script on the platform you're targeting.

New: phenotype inference model (pgx/frequency.py)

A panel reports *1 for every allele it didn't test, so different true diplotypes can produce the same result. The new module works backwards from that:

  • Allele priors for each population, plus a pooled prior (a plain average across populations) for when ancestry is unknown. Each prior reports coverage, the share of CPIC's published frequency the model can account for, so missing alleles are visible.
  • posterior() gives the phenotype probabilities for a reported diplotype, given which alleles the panel tests. marginal() gives the phenotype distribution with no panel at all. This is also the figure CPIC publishes, so it can be checked against an outside source.
  • Scoring: brier() (the main score; a confident wrong answer scores 2.0) and log_loss() (with a minimum probability so misses don't score infinity).
  • Structural alleles (copy number changes, hybrids) and alleles with no published frequency are left out of the candidates.

Known issues

  • The drugs section of the report shows "would haveneeded": a space was lost when that line was joined in ReportView.java.
  • The macOS build looks for packaging/app.icns, which isn't in the repo, so the Mac app builds without an icon.
  • The portable jar won't open a window on Intel Macs until you rebuild with the mac JavaFX classifier.