navinlabcode / copykat

Other
203 stars 54 forks source link

Question about define subpopulations of aneuploid tumor cells #82

Open lwlive opened 1 year ago

lwlive commented 1 year ago

I have tried to define subpopulations of aneuploid tumor cells by changing the parameter with following command, but errors happend in "legend" with "Error in rep_len(col, n.leg) : attempt to replicate non-vector". I am not familiar with R package, could you please offer some help?

treecut_number<-4 hc.umap <- cutree(hcc,treecut_number) rbPal6 <- colorRampPalette(RColorBrewer::brewer.pal(n = 8, name = "Dark2")[1:treecut_number]) subpop <- rbPal6(treecut_number)[as.numeric(factor(hc.umap))] cells <- rbind(subpop,subpop)

legend_names<-paste("c",1:treecut_number,sep="") png(paste(out_dir,"/copykat_05.heatmap.png",sep=""),width = 4006, height =4006,res=400) heatmap.3(t(tumor.mat),dendrogram="r", distfun = function(x) parallelDist::parDist(x,threads =20, method = "euclidean"), hclustfun = function(x) hclust(x, method="ward.D2"), ColSideColors=chr1,RowSideColors=cells,Colv=NA, Rowv=TRUE, notecol="black",col=my_palette,breaks=col_breaks, key=TRUE, keysize=1, density.info="none", trace="none", cexRow=0.1,cexCol=0.1,cex.main=1,cex.lab=0.1, symm=F,symkey=F,symbreaks=T,cex=1, cex.main=4, margins=c(10,10)) legend("topright", paste("c",names(table(hc.umap)),sep=""), pch=15,col=colorRampPalette(RColorBrewer::brewer.pal(n = 8, name = "Dark2")[1:treecut_number]), cex=0.9, bty='n') dev.off()