Closed zbjornson closed 11 years ago
Script for the first two of three transpositions below...
# Produce statistics tables
message("Producing tables...")
dir.create(paste(OUTPUT_DIR,'tables',sep='/'),recursive=TRUE,showWarnings=FALSE)
# Find the files
files <- dir(OUTPUT_DIR,full.names=TRUE,pattern=glob2rx("*.anno.Rsave"))
# Find all the params
params <- unique(as.vector(sapply(files, function(f) { load(f); colnames(anno); })))
#Rows are nodes, cols are files, files are params
dir.create(paste(OUTPUT_DIR,'tables','byAttribute',sep='/'),recursive=TRUE,showWarnings=FALSE)
for (p in params) {
pivot <- c();
names <- c();
for (f in files) { load(f); if (p %in% colnames(anno)) { pivot <- cbind(pivot, anno[,p]); names <- c(names, f); }}
names <- gsub("[[:alnum:][:punct:]]+/output/([[:alnum:][:punct:]]+).fcs.density.fcs.cluster.fcs.anno.Rsave", "\\1", names);
pivot <- cbind(1:nrow(pivot),pivot);
colnames(pivot) <- c("name", names);
if (!is.null(pivot) && ncol(pivot) > 0) {
write.csv(pivot, file=paste(OUTPUT_DIR,'/tables/byAttribute/',p,'_table','.csv',sep=''), row.names=FALSE)
}
}
#Rows are nodes, cols are params, files are files
dir.create(paste(OUTPUT_DIR,'tables','bySample',sep='/'),recursive=TRUE,showWarnings=FALSE)
for (f in files) {
load(f);
pivot <- anno;
names <- colnames(pivot);
pivot <- cbind(1:nrow(pivot),pivot);
colnames(pivot) <- c("name", names);
name <- gsub("[[:alnum:][:punct:]]+/output/([[:alnum:][:punct:]]+).fcs.density.fcs.cluster.fcs.anno.Rsave", "\\1", f);
write.csv(pivot, file=paste(OUTPUT_DIR,'/tables/bySample/',name,'_table','.csv',sep=''), row.names=FALSE);
}
#Rows are params, cols are files, files are nodes
dir.create(paste(OUTPUT_DIR,'tables','byNodeID',sep='/'),recursive=TRUE,showWarnings=FALSE);
# TODO
Right now there's a button in Cytoscape to export the statistics tables. This should just be included in the normal runSPADE workflow I think -- or at least, if not for the normal distribution, it should be included for the Cytobank distribution.
I have a version of the runSPADE script that does two of the three transpositions of the tables. Need the third (see issue #29).