MyNixOS website logo
Description

MEchanistic Clustering - Treatment eXposure Framework.

Implements the MEC-TX (MEchanistic Clustering - Treatment eXposure) framework for encoding, clustering, and survival analysis of real-world oncology treatment timelines. Provides functions for normalising medication records, computing treatment intervals, performing k-means clustering in PCA space, assigning line-of-therapy labels, and comparing survival outcomes across treatment groups. Designed for use with registry-based cohorts such as the ORIEN AVATAR dataset. Methods follow the digital-twin framework described in Dhrubo and Spakowicz (2026) <https://github.com/spakowiczlab/mec-tx>. treatment timelines using the MEC-TX digital-twin framework.

mec-tx DOI

MEchanistic Clustering - Treatment eXposure Framework

Overview

mectx implements the MEC-TX framework for encoding, clustering, and survival analysis of real-world oncology treatment timelines. It was developed for registry-based cohorts such as the ORIEN AVATAR dataset.

Installation

Install the released version from CRAN:

install.packages("mectx")

Or the development version from GitHub:

# install.packages("devtools")
devtools::install_github("spakowiczlab/mectx")

Core functions

FunctionDescription
tx_normalize()Normalize raw medication records to a time grid
tx_intervals()Compute treatment intervals per patient
tx_cluster_surv()K-means clustering in PCA space with survival output
tx_lines()Assign line-of-therapy labels
tx_pooled_analysis()Compare survival across treatment groups
tx_duration()Summarise treatment exposure duration by group
tx_compare_groups()Statistical comparison across patient groups
dominant_exclusive()Assign mutually exclusive dominant regimen per patient
get_focus_cohort()Filter cohort by focus treatment type
tx_focus_dt()Build digital-twin timeline for focus treatment

Basic usage

library(mectx)

# Step 1: Normalize raw medication data
norm <- tx_normalize(raw_medication_df)

# Step 2: Compute treatment intervals
intervals <- tx_intervals(norm)

# Step 3: Cluster patients by treatment pattern
clustered <- tx_cluster_surv(norm, meta_df)

# Step 4: Assign line-of-therapy
lines <- tx_lines(intervals)

# Step 5: Pooled survival analysis
results <- tx_pooled_analysis(intervals, meta_df, group_var = "CAlevel")

# Step 6: Compare treatment duration by group
duration <- tx_duration(intervals, meta_df, group_var = "CAlevel")

Pipeline

The canonical MEC-TX pipeline order:

raw data └─ tx_normalize() └─ tx_cluster_surv() └─ tx_intervals() └─ tx_lines() └─ tx_pooled_analysis() └─ tx_compare_groups() └─ tx_duration()

Citation

If you use mectx in your research, please cite: need to double check

Dhrubo and Spakowicz (2026). MEchanistic Clustering - Treatment eXposure Framework for real-world oncology treatment timeline analysis.

License

MIT + file LICENSE.

Metadata

Version

1.1.1

License

Unknown

Platforms (80)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arc-linux
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • sh4-linux
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows