From b8bafad302138b13b3381aa768c2fe29142fa42c Mon Sep 17 00:00:00 2001 From: Efrain Gonzalez Date: Tue, 20 Feb 2018 13:43:15 -0500 Subject: [PATCH] Updated by adding in output for average without zscore --- RAutoClDs.R | 90 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 66 insertions(+), 24 deletions(-) diff --git a/RAutoClDs.R b/RAutoClDs.R index e26d4d7..6a7ea88 100644 --- a/RAutoClDs.R +++ b/RAutoClDs.R @@ -404,7 +404,26 @@ THEFT <- function(){ } j <- j + 1 } - + + + ##Outputting non Z-score Average over genes + newoutput <-NuRDATN + colnames(newoutput) <- rownames(tabRDATID) + nfnewout <- strsplit(alz,"[\\]") %>% + .[[1]] %>% + .[length(.)] %>% + gsub("\\D","",.) %>% + c("GSE",.,"newout.txt") %>% + paste(collapse = "") + noutput <- newoutput %>% + t()%>% + as.data.frame(.,stringsAsFactors = FALSE) + noutput <- cbind(rownames(noutput),noutput) + colnames(noutput) <- c("Gene Symbol",subjnam) + rownames(noutput) <- NULL + write.table(noutput, file = nfnewout, sep = "\t",col.names = TRUE,row.names = FALSE) + + ##Scaling the Data scrawdat <- NuRDATN%>% scale() @@ -417,14 +436,17 @@ THEFT <- function(){ .[[1]] %>% .[length(.)] %>% gsub("\\D","",.) %>% - c("GSE",.,"zscore.txt") %>% + c("GSE",.,"avg.txt") %>% paste(collapse = "") zscraw <- scrawdat %>% t()%>% as.data.frame(.,stringsAsFactors = FALSE) - colnames(zscraw) <- subjnam - write.table(zscraw, file = nfnzsc, sep = "\t",col.names = TRUE,row.names = TRUE) - + zscraw <- cbind(rownames(zscraw),zscraw) + colnames(zscraw) <- c("Gene Symbol",subjnam) + rownames(zscraw) <- NULL + write.table(zscraw, file = nfnewout, sep = "\t",col.names = TRUE,row.names = FALSE) + + ##Discretized the Data dialzdat <- scrawdat %>% dndat(.) %>% @@ -706,25 +728,45 @@ THEFT <- function(){ j <- j + 1 } - ##Scaling the Data - scrawdat <- NuRDATN%>% - scale() - attr(scrawdat,"scaled:center") <- NULL - attr(scrawdat,"scaled:scale") <- NULL - colnames(scrawdat) <- rownames(tabRDATID) - - #Outputting the Z-score file - nfnzsc <- strsplit(alz,"[\\]") %>% - .[[1]] %>% - .[length(.)] %>% - gsub("\\D","",.) %>% - c("GSE",.,"zscore.txt") %>% - paste(collapse = "") - zscraw <- scrawdat %>% - t()%>% - as.data.frame(.,stringsAsFactors = FALSE) - colnames(zscraw) <- subjnam - write.table(zscraw, file = nfnzsc, sep = "\t",col.names = TRUE,row.names = TRUE) + ##Outputting non Z-score Average over genes + newoutput <-NuRDATN + colnames(newoutput) <- rownames(tabRDATID) + nfnewout <- strsplit(alz,"[\\]") %>% + .[[1]] %>% + .[length(.)] %>% + gsub("\\D","",.) %>% + c("GSE",.,"avg.txt") %>% + paste(collapse = "") + noutput <- newoutput %>% + t()%>% + as.data.frame(.,stringsAsFactors = FALSE) + noutput <- cbind(rownames(noutput),noutput) + colnames(noutput) <- c("Gene Symbol",subjnam) + rownames(noutput) <- NULL + write.table(noutput, file = nfnewout, sep = "\t",col.names = TRUE,row.names = FALSE) + + + ##Scaling the Data + scrawdat <- NuRDATN%>% + scale() + attr(scrawdat,"scaled:center") <- NULL + attr(scrawdat,"scaled:scale") <- NULL + colnames(scrawdat) <- rownames(tabRDATID) + + #Outputting the Z-score file + nfnzsc <- strsplit(alz,"[\\]") %>% + .[[1]] %>% + .[length(.)] %>% + gsub("\\D","",.) %>% + c("GSE",.,"zscore.txt") %>% + paste(collapse = "") + zscraw <- scrawdat %>% + t()%>% + as.data.frame(.,stringsAsFactors = FALSE) + zscraw <- cbind(rownames(zscraw),zscraw) + colnames(zscraw) <- c("Gene Symbol",subjnam) + rownames(zscraw) <- NULL + write.table(zscraw, file = nfnewout, sep = "\t",col.names = TRUE,row.names = FALSE) ##Discretized the Data dialzdat <- scrawdat %>% -- 2.29.0