diff scripts/cluster.R @ 4:20f522154663 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 5d7c4cd914295a81d42bf8baaad4981c23a83059"
author iuc
date Mon, 12 Aug 2019 13:01:12 -0400
parents 0fa80752a314
children 41f34e925bd5
line wrap: on
line diff
--- a/scripts/cluster.R	Mon Apr 15 17:55:46 2019 -0400
+++ b/scripts/cluster.R	Mon Aug 12 13:01:12 2019 -0400
@@ -1,5 +1,5 @@
 #!/usr/bin/env R
-VERSION = "0.4"
+VERSION = "0.5"
 
 args = commandArgs(trailingOnly = T)
 
@@ -139,6 +139,19 @@
     write.table(df, file=out.genelist, sep="\t", quote=F)
 }
 
+
+writecellassignments <- function(sc){
+    dat <- sc@cluster$kpart
+    tab <- data.frame(row.names = NULL,
+                      cells = names(dat),
+                      cluster.initial = dat,
+                      cluster.final = sc@cpart,
+                      is.outlier = names(dat) %in% sc@out$out)
+
+    write.table(tab, file=out.assignments, sep="\t", quote=F, row.names = F)
+}
+
+
 pdf(out.pdf)
 
 if (use.filtnormconf){
@@ -148,6 +161,7 @@
     message(paste("         :: ",
                   sprintf("%.1f", 100 * nrow(getfdata(sc))/nrow(sc@expdata)), "% of genes remain,",
                   sprintf("%.1f", 100 * ncol(getfdata(sc))/ncol(sc@expdata)), "% of cells remain"))
+    write.table(as.matrix(sc@ndata), file=out.table, col.names=NA, row.names=T, sep="\t", quote=F)
 }
 
 if (use.cluster){
@@ -161,6 +175,7 @@
     sc <- do.clustmap(sc)
 
     mkgenelist(sc)
+    writecellassignments(sc)
 }
 
 dev.off()