comparison scripts/cluster.R @ 4:ee0bbc160cb1 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:00:12 -0400
parents d4646ce659b4
children a4b734cd253b
comparison
equal deleted inserted replaced
3:d4646ce659b4 4:ee0bbc160cb1
1 #!/usr/bin/env R 1 #!/usr/bin/env R
2 VERSION = "0.4" 2 VERSION = "0.5"
3 3
4 args = commandArgs(trailingOnly = T) 4 args = commandArgs(trailingOnly = T)
5 5
6 if (length(args) != 1){ 6 if (length(args) != 1){
7 message(paste("VERSION:", VERSION)) 7 message(paste("VERSION:", VERSION))
137 137
138 }) 138 })
139 write.table(df, file=out.genelist, sep="\t", quote=F) 139 write.table(df, file=out.genelist, sep="\t", quote=F)
140 } 140 }
141 141
142
143 writecellassignments <- function(sc){
144 dat <- sc@cluster$kpart
145 tab <- data.frame(row.names = NULL,
146 cells = names(dat),
147 cluster.initial = dat,
148 cluster.final = sc@cpart,
149 is.outlier = names(dat) %in% sc@out$out)
150
151 write.table(tab, file=out.assignments, sep="\t", quote=F, row.names = F)
152 }
153
154
142 pdf(out.pdf) 155 pdf(out.pdf)
143 156
144 if (use.filtnormconf){ 157 if (use.filtnormconf){
145 sc <- do.filter(sc) 158 sc <- do.filter(sc)
146 message(paste(" - Source:: genes:",nrow(sc@expdata),", cells:",ncol(sc@expdata))) 159 message(paste(" - Source:: genes:",nrow(sc@expdata),", cells:",ncol(sc@expdata)))
147 message(paste(" - Filter:: genes:",nrow(getfdata(sc)),", cells:",ncol(getfdata(sc)))) 160 message(paste(" - Filter:: genes:",nrow(getfdata(sc)),", cells:",ncol(getfdata(sc))))
148 message(paste(" :: ", 161 message(paste(" :: ",
149 sprintf("%.1f", 100 * nrow(getfdata(sc))/nrow(sc@expdata)), "% of genes remain,", 162 sprintf("%.1f", 100 * nrow(getfdata(sc))/nrow(sc@expdata)), "% of genes remain,",
150 sprintf("%.1f", 100 * ncol(getfdata(sc))/ncol(sc@expdata)), "% of cells remain")) 163 sprintf("%.1f", 100 * ncol(getfdata(sc))/ncol(sc@expdata)), "% of cells remain"))
164 write.table(as.matrix(sc@ndata), file=out.table, col.names=NA, row.names=T, sep="\t", quote=F)
151 } 165 }
152 166
153 if (use.cluster){ 167 if (use.cluster){
154 par(mfrow=c(2,2)) 168 par(mfrow=c(2,2))
155 sc <- do.cluster(sc) 169 sc <- do.cluster(sc)
159 173
160 par(mfrow=c(2,2), mar=c(1,1,6,1)) 174 par(mfrow=c(2,2), mar=c(1,1,6,1))
161 sc <- do.clustmap(sc) 175 sc <- do.clustmap(sc)
162 176
163 mkgenelist(sc) 177 mkgenelist(sc)
178 writecellassignments(sc)
164 } 179 }
165 180
166 dev.off() 181 dev.off()
167 182
168 saveRDS(sc, out.rdat) 183 saveRDS(sc, out.rdat)