hdng / clonevol

Inferring and visualizing clonal evolution in multi-sample cancer sequencing
GNU General Public License v3.0
141 stars 45 forks source link

error input from ClonEvol for fishplot #29

Open Tinalxt opened 5 years ago

Tinalxt commented 5 years ago

Hello, I get the following error when running generateFishplotInputs(). Can you please help me fix this? I have attached the input data.txt file for your reference.

f = generateFishplotInputs(results=y) Error in $<-.data.frame(tmp, "parent", value = numeric(0)) : replacement has 0 rows, data has 1

this is my code:

library(clonevol) library(fishplot) ZHQ.ClonEvol.input.txt x <- read.table("ZHQ.ClonEvol.input.txt",header = T,sep = "\t")

x <- aml1$variants

shorten vaf column names as they will be

vaf.col.names <- grep('.vaf', colnames(x), value=T) sample.names <- gsub('.vaf', '', vaf.col.names)

x[, sample.names] <- x[, vaf.col.names] vaf.col.names <- sample.names

prepare sample grouping

sample.groups <- c('P', 'R');

sample.groups <- vaf.col.names names(sample.groups) <- vaf.col.names

setup the order of clusters to display in various plots (later)

x <- x[order(x$cluster),]

clone.colors <- c('#999793', '#8d4891', '#f8e356', '#fe9536', '#d7352e') y = infer.clonal.models(variants = x, cluster.col.name = 'cluster', vaf.col.names = vaf.col.names, sample.groups = sample.groups, cancer.initiation.model='monoclonal', subclonal.test = 'bootstrap', subclonal.test.model = 'non-parametric', num.boots = 1000, founding.cluster = 1, cluster.center = 'mean', ignore.clusters = NULL, clone.colors = clone.colors, min.cluster.vaf = 0.01,

min probability that CCF(clone) is non-negative

sum.p = 0.05,

alpha level in confidence interval estimate for CCF(clone)

alpha = 0.05)

y <- transfer.events.to.consensus.trees(y, x[x$is.driver,], cluster.col.name = 'cluster', event.col.name = 'gene')

y <- convert.consensus.tree.clone.to.branch(y, branch.scale = 'sqrt')

f = generateFishplotInputs(results=y) fishes = createFishPlotObjects(f)

plot with fishplot

pdf('fish.pdf', width=8, height=5) for (i in 1:length(fishes)){ fish = layoutClones(fishes[[i]]) fish = setCol(fish,f$clonevol.clone.colors) fishPlot(fish,shape="spline", title.btm="Patient", cex.title=0.5, vlines=seq(1, length(vaf.col.names)), vlab=vaf.col.names, pad.left=0.5) } dev <- dev.off()

hdng commented 5 years ago

Looking like the cause is that you only have one cluster (hence one clone). I didn't catch this special case but will note this as a bug.

Anw, when you have one clone, you don't learn much via clonevol analysis, eg. you can predict a tree with one node, 100% CCF in all samples w/o running clonevol. Fishplot will be a straight rectangle with 100% CCF throughout all time points/samples.