Fishplot

Authors

[Editor] Hu Zheng;

[Contributors]

Clone evolution analysis

Setup

  • System Requirements: Cross-platform (Linux/MacOS/Windows)

  • Programming language: R

  • Dependent packages: data.table; jsonlite; fishplot

# Install packages
if (!requireNamespace("data.table", quietly = TRUE)) {
  install.packages("data.table")
}
if (!requireNamespace("jsonlite", quietly = TRUE)) {
  install.packages("jsonlite")
}
if (!requireNamespace("fishplot", quietly = TRUE)) {
  install_github("chrisamiller/fishplot")
}

# Load packages
library(data.table)
library(jsonlite)
library(fishplot)

Data Preparation

# Load data
data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/fishplot/data.json")$exampleData$textarea[[1]])
data <- as.data.frame(data)

# View data
head(data)
  timepoints parents sample.name event1 event2 event3 event4
1          0       0     Sample1    100      2      2     98
2         30       1     Sample1     45      0      0      0
3         75       1     Sample1      0      0      2     95
4        150       3     Sample1      0      0      1     40
  • timepoints: specifying the timepoints for each column of the matrix

  • parents: specifying parental relationships between clones

  • samplename: samplename (support multiple samples)

  • other: a numeric matrix containing tumor fraction estimates for all clones at all timepoints

Visualization

## Create a fish object
fish = createFishObject(as.matrix(data[,4:7]), parents=data$parents, 
                        timepoints=data$timepoints, 
                        col = c("#888888","#e8130c","#f8150d","#55158f"))
## Calculate the layout of the drawing
fish = layoutClones(fish)
## Draw the plot, using the splining method (recommended), and providing both timepoints to label and a plot title
fishPlot(fish,shape="spline", title.btm="Sample1", title = "Fishplot",
         cex.title=1, vlines=c(0,30,75,150), 
         vlab=c("Day 0","Day 30","Day 75","Day 150"))
FigureΒ 1: Fishplot