Visualization Guide

R-CMD-check pkgdown CRAN status Codecov test coverage CRAN downloads CRAN downloads total License: MIT Lifecycle: experimental

Overview

All molpathR plot functions return ggplot2 objects, so you can customize them with standard ggplot2 syntax.

library(molpathR)
db <- mp_example_db(n_patients = 150, seed = 42)

Variant landscape

mp_plot_variant_landscape(db, top_n = 10)

Recorded variant classifications across synthetic patients for selected genes.

VAF distribution

mp_plot_vaf_distribution(db, gene = "TP53")

Distribution of observed TP53 variant allele fractions in the synthetic cohort.

Survival analysis

# Overall survival by diagnosis
mp_plot_survival(db, group_by = "diagnosis", type = "os")

Kaplan-Meier curves for synthetic patients grouped by diagnosis.

# Compare recorded TP53 variants with no recorded TP53 variant
mp_plot_survival(db, group_by = "TP53", type = "os")

Kaplan-Meier curves comparing recorded TP53 variants with no recorded TP53 variant; missing records are not a negative assay.

The gene groups describe database records only. A patient with no recorded variant is not established to be wild-type; assay coverage is unavailable.

Cohort overview

plots <- mp_plot_cohort_overview(db)
plots$diagnosis

Synthetic patient counts by diagnosis.

plots$top_genes

Recorded synthetic variant counts for the most frequent genes.

Patient timeline

pid <- db$patients$patient_id[1]
mp_plot_timeline(db, pid)

Dated sample, report and clinical records for one synthetic patient.

Customization

All plots can be customized with ggplot2:

library(ggplot2)
mp_plot_vaf_distribution(db) +
  labs(title = "Custom Title") +
  theme(plot.title = element_text(colour = "purple"))

Distribution of synthetic variant allele fractions with a customized title and styling.