The swimmer folder contains R scripts designed to create swimmer plots for visualizing treatment timelines and related data. These scripts process input data, calculate time differences, and generate swimmer plots for single and multiple treatments. The plots are saved as PDF or PNG files for further analysis and reporting.
1. swimmer_single_treatment.R
This script generates swimmer plots for single-treatment data. It processes input data, calculates time differences, and creates a swimmer plot with various visualizations, including treatment timelines and assay types.
Processes input data to calculate time differences.
Generates swimmer plots for single-treatment data.
Supports multiple time units (days, weeks, months, years).
Saves the plot as a PDF file.
Argument
Type
Description
Default Value
File path to the input data file.
File path for the output PDF file.
Time unit for the x-axis (days, weeks, months, years).
Example Command
2. swimmer_multi_treatment.R
This script generates swimmer plots for multi-treatment data. It processes metadata, calculates time differences, and creates a swimmer plot with treatment timelines and ctDNA detection points.
Processes metadata to calculate time differences.
Generates swimmer plots for multi-treatment data.
Supports multiple time units (days, weeks, months, years).
Allows customization of treatment colors.
Saves the plot as a PNG file.
Argument
Type
Description
Default Value
File path to the metadata file.
Output directory for the plot.
Comma-separated colors for treatment types.
Time unit for the x-axis (days, weeks, months, years).
Example Command
3. dates2days.R
This script converts date columns in the input data to numeric values representing time differences in specified units. The processed data is saved as a tab-delimited text file for use in swimmer plots.
Converts date columns to numeric time differences.
Supports multiple time units (days, weeks, months, years).
Saves the processed data as a tab-delimited text file.
Argument
Type
Description
Default Value
File path to the input .txt file.
File path for the output .txt file.
Example Command
The scripts require the following R packages:
Install the required packages using the following command:
The input file for swimmer_single_treatment.R must contain the following columns:
The metadata file for swimmer_multi_treatment.R must contain the following columns:
The input file for dates2days.R must contain date columns such as:
Single Treatment: PDF file containing the swimmer plot.
Multi-Treatment: PNG file containing the swimmer plot.
Tab-delimited text file with numeric time differences for use in swimmer plots.
Example Workflow
Generate Single Treatment Swimmer Plot:
Generate Multi-Treatment Swimmer Plot:
For questions or issues, please contact:
Author: Carmelina Charalambous, Alexander Ham