Skip to content

dmattek/TCourseInspector-rpkg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TCourseInspector R Package

License: GPL v3

Overview

TCourseInspector (Time Course Inspector) is an R package that provides an interactive Shiny web application for visualization, analysis, and clustering of time-series data. It has a user-friendly GUI that requires no programming knowledge, making time-series analysis accessible to all researchers.

Key Features

  • Data Preprocessing

    • Normalization (fold-change or z-score)
    • Outlier removal with configurable thresholds
    • Linear interpolation of missing values
    • Time axis trimming
    • Mathematical operations on measurements
  • Visualization

    • Trajectory plots; individual and population averages with confidence intervals
    • Power spectral density (PSD) analysis
  • Statistical Analysis

    • Area under curve (AUC) calculation
    • Distribution plots (box, violin, dot plots) at specific time points
    • Population statistics and variability measures
    • Correlation analysis
  • Clustering

    • Hierarchical clustering with multiple distance metrics (Manhattan, Euclidean, DTW)
    • Sparse-hierarchical clustering for high-dimensional data
    • Interactive dendrogram cutting
    • Cluster validation (silhouette analysis, within-cluster sum of squares)
    • PCA visualization of clusters

Demo

TCI

The screencast with an overview of the app's functionality and processing of the test-case-1 dataset can be found here.

If you just wish to give the app a quick try without installing it, you can access a running instance at shinyapps.io. Bear in mind that your experience using this instance might be sluggish and that the number of uses per month is limited. For a quick trial, we rather recommend to run the app locally as described in sections below.

Installation

From Source

Download the source from this GitHub repository and install from a local directory:

install.packages("path/to/TCourseInspector", repos = NULL, type = "source")

# Or using devtools
devtools::install_local("path/to/TCourseInspector")

From GitHub

# Install from GitHub
devtools::install_github("dmattek/TCourseInspector-rpkg")

Quick Start

Launch the App

library(TCourseInspector)

# Launch the main application
runTCourseInspector()

# Launch with example data
runTCourseInspectorExample()

# Get path to example datasets
example_path <- getTCIExampleData("test-case-1")
list.files(example_path)

Using Specific Port or Host

# Run on a specific port
runTCourseInspector(port = 8080)

# Run without launching browser (useful for servers)
runTCourseInspector(launch.browser = FALSE, host = "0.0.0.0", port = 3838)

Data Format

Long Format (Recommended)

Long format provides maximum flexibility with support for multiple groupings and multivariate measurements:

Group ID Time Measurement
gr1 1 1 3.3
gr1 1 2 2.1
gr1 1 4 4.3
gr1 2 1 2.8
gr2 1 1 5.1

Required columns:

  • Track ID (unique identifier for each time series)
  • Time points
  • At least one measurement column

Optional columns:

  • Grouping variables (experimental conditions, treatments, etc.)
  • Additional measurement columns for multivariate analysis

Wide Format

Wide format stores each time series as a single row:

Group ID 0 1 2 ...
gr1 1 3.0 3.3 3.1 ...
gr1 2 2.0 2.1 1.9 ...

Requirements:

  • First two columns: Group, Track ID
  • Remaining columns: Time points (must have numeric headers)

Typical Workflow

  1. Load Data: Upload CSV file (compressed formats supported: .gz, .bz2)
  2. Configure Columns: Select track ID, time, measurement, and grouping columns
  3. Preprocess:
    • Create unique track IDs if needed
    • Trim time axis
    • Interpolate missing values
    • Normalize data
  4. Filter: Remove duplicate tracks, short tracks, or outliers
  5. Visualize: Plot trajectories, heatmaps, or PSD
  6. Analyze: Calculate AUC, examine distributions, identify correlations
  7. Cluster: Perform hierarchical clustering and validate results
  8. Export: Download processed data, plots, and cluster assignments

Clustering Features

TCourseInspector performs pooled clustering, meaning all groups (experimental conditions) are analyzed together. This approach helps identify:

  • Shared dynamics across groups
  • Over/under-represented patterns in specific conditions
  • Subtle differences that distinguish experimental outcomes

Distance Metrics:

  • Manhattan distance (recommended for time series)
  • Euclidean distance
  • Dynamic Time Warping (DTW) - accounts for time shifts

Linkage Methods:

  • Complete linkage (default, robust)
  • Ward's method
  • Average linkage
  • Single linkage

Validation:

  • Silhouette analysis (optimal cluster separation)
  • Within-cluster sum of squares (compactness)
  • Visual inspection with PCA

Package Structure

TCourseInspector/
├── DESCRIPTION           # Package metadata and dependencies
├── NAMESPACE            # Exported functions
├── R/                   # R functions
│   ├── runTCourseInspector.R    # Main launch functions
│   └── TCourseInspector-package.R  # Package documentation
├── inst/
│   ├── shiny-app/       # Shiny application files
│   │   ├── global.R     # Global setup and module loading
│   │   ├── server.R     # Server logic
│   │   ├── ui.R         # User interface
│   │   └── modules/     # Shiny modules
│   └── example-data/    # Example datasets
├── man/                 # Documentation (generated by roxygen2)
└── vignettes/          # Usage tutorials

Development

Building the Package

# Generate documentation
devtools::document()

# Check package
devtools::check()

# Build package
devtools::build()

# Install locally
devtools::install()

Running Tests

devtools::test()

Citation

If you use TCourseInspector in your research, please cite:

Dobrzyński, M., Jacques, M. A., & Pertz, O. (2019). Mining single-cell time-series datasets with Time Course Inspector. Bioinformatics, 36(6), 1968-1969. https://doi.org/10.1093/bioinformatics/btz846

Dobrzyński, M., Jacques, M. A., & Pertz, O. (2022). Mining of Single-Cell Signaling Time-Series for Dynamic Phenotypes with Clustering, in TGF-beta Signaling: Methods and Protocols, Springer, pp 183–206. https://doi.org/10.1007/978-1-0716-2277-3_13

Support

  • Issues: Report bugs or request features at GitHub Issues
  • Documentation: See function help (?runTCourseInspector) or vignettes
  • Examples: Try runTCourseInspectorExample() to explore functionality

License

This package is licensed under GPL-3. See LICENSE file for details.

Authors

  • Maciej Dobrzyński (Author, Maintainer)
  • Marc-Antoine Jacques (Contributor)

Acknowledgments

Original web app and methodology developed at the Institute of Cell Biology, University of Bern.

About

An R package with a Shiny web app for visualisation, analysis and clustering of time-series.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages