Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Fishplot - Updated Clonevol Integration in Additional File 2
## read in the data - copy number
cn1 = read.table("",sep="\t",stringsAsFactors=F)
cn2 = read.table("",sep="\t",stringsAsFactors=F)
cn1 = cn1[,c(1,2,3,5)]
cn2 = cn2[,c(1,2,3,5)]
## read in vaf data
samples = c("Tumor","Relapse")
## run sciclone to detect clusters
sc = sciClone(vafs=list(v1,v2),
useSexChrs=FALSE, doClusteringAlongMargins=FALSE)
writeClusterTable(sc, "clusters")
## prepare clonevol input
vafs = data.frame(cluster=sc@vafs.merged$cluster,
vafs = vafs[!$cluster) & vafs$cluster > 0,]
names(vafs)[2:3] = samples
## run clonevol
res = infer.clonal.models(variants=vafs,"cluster", vaf.col.names=samples,
subclonal.test="bootstrap", subclonal.test.model="non-parametric","mean",, founding.cluster=1,
min.cluster.vaf=0.01, sum.p=0.01, alpha=0.1, random.seed=63108)
# new clonevol
res =, branch.scale='sqrt')
# new clonevol
plot.clonal.models(res, box.plot=TRUE, fancy.boxplot=TRUE, cell.plot=TRUE,
out.format="pdf", overwrite.output=TRUE, scale.monoclonal.cell.frac=TRUE,, tree.node.shape="circle", tree.node.size=40,
tree.node.text.size=0.65, width=8, height=5, out.dir=".")
## create a list of fish objects - one for each model (in this case, there's only one)
f = generateFishplotInputs(results=res)
fishes = createFishPlotObjects(f)
## plot each of these with fishplot
pdf('fish.pdf', width=8, height=4)
for (i in 1:length(fishes)){
fish = layoutClones(fishes[[i]])
fish = setCol(fish,f$clonevol.clone.colors)
fishPlot(fish,shape="spline", title.btm="PatientID", cex.title=0.7,
vlines=seq(1, length(samples)), vlab=samples, pad.left=0.5)
dev <-
Copy link

chenxj1101 commented Jul 14, 2017

when I run this script with the tumor and relapse data, has a error:

plot.clonal.models(res$models, matched=res$matched, variants=vafs, box.plot=TRUE,

  •                out.format="pdf", overwrite.output=TRUE, scale.monoclonal.cell.frac=TRUE,
  •      , tree.node.shape="circle", tree.node.size=40,
  •                tree.node.text.size=0.65, width=8, height=5, out.dir=".")

Error in data.frame(x = c(xstarts, xstops), index = seq(1, 2 * k)) :
arguments imply differing number of rows: 0, 2
In addition: Warning message:
In min(xstarts) : no non-missing arguments to min; returning Inf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment