Skip to content

Commit bd26700

Browse files
committed
fix incorrect csv output generated by analyze.*()
1 parent f014577 commit bd26700

1 file changed

Lines changed: 16 additions & 12 deletions

File tree

R/analysis.R

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,14 @@ analyze.t <- function(dataSet, ref = NULL, adjust.method = "none",
115115

116116
if (saveRes) {
117117

118+
rownames(means) <- paste(rownames(means), "mean")
118119
total <- do.call(rbind, lapply(result, `[`, c("difference", "p-value"), , drop = FALSE))
120+
rownames(total) <- as.vector(t(outer(names(result), c(": difference", ": p-value"), paste0)))
119121
total <- rbind(means, total)
120-
rownames(total) <- c(paste(conds, "mean"), as.vector(t(outer(names(result), c(": difference", ": p-value"), paste0))))
121122

122123
information <- read.csv("preprocess_protein_information.csv", check.names = FALSE)
123-
scaffoldCheck <- any(colnames(information) == "Visible?")
124-
IDcol <- ifelse(scaffoldCheck, "AccessionNumber", "PG.ProteinName")
124+
scaffoldCheck <- "Visible?" %in% colnames(information)
125+
IDcol <- if (scaffoldCheck) "AccessionNumber" else "PG.ProteinName"
125126

126127
total <- as.data.frame(t(total)) %>%
127128
rownames_to_column(IDcol) %>%
@@ -241,13 +242,14 @@ analyze.mod_t <- function(dataSet, ref = NULL, adjust.method = "none", saveRes =
241242

242243
if (saveRes) {
243244

245+
rownames(means) <- paste(rownames(means), "mean")
244246
total <- do.call(rbind, lapply(result, `[`, c("difference", "p-value"), , drop = FALSE))
247+
rownames(total) <- as.vector(t(outer(names(result), c(": difference", ": p-value"), paste0)))
245248
total <- rbind(means, total)
246-
rownames(total) <- c(paste(conds, "mean"), as.vector(t(outer(names(result), c(": difference", ": p-value"), paste0))))
247249

248250
information <- read.csv("preprocess_protein_information.csv", check.names = FALSE)
249-
scaffoldCheck <- any(colnames(information) == "Visible?")
250-
IDcol <- ifelse(scaffoldCheck, "AccessionNumber", "PG.ProteinName")
251+
scaffoldCheck <- "Visible?" %in% colnames(information)
252+
IDcol <- if (scaffoldCheck) "AccessionNumber" else "PG.ProteinName"
251253

252254
total <- as.data.frame(t(total)) %>%
253255
rownames_to_column(IDcol) %>%
@@ -361,13 +363,14 @@ analyze.wilcox <- function(dataSet, ref = NULL, adjust.method = "none",
361363

362364
if (saveRes) {
363365

366+
rownames(means) <- paste(rownames(means), "mean")
364367
total <- do.call(rbind, lapply(result, `[`, c("difference", "p-value"), , drop = FALSE))
368+
rownames(total) <- as.vector(t(outer(names(result), c(": difference", ": p-value"), paste0)))
365369
total <- rbind(means, total)
366-
rownames(total) <- c(paste(conds, "mean"), as.vector(t(outer(names(result), c(": difference", ": p-value"), paste0))))
367370

368371
information <- read.csv("preprocess_protein_information.csv", check.names = FALSE)
369-
scaffoldCheck <- any(colnames(information) == "Visible?")
370-
IDcol <- ifelse(scaffoldCheck, "AccessionNumber", "PG.ProteinName")
372+
scaffoldCheck <- "Visible?" %in% colnames(information)
373+
IDcol <- if (scaffoldCheck) "AccessionNumber" else "PG.ProteinName"
371374

372375
total <- as.data.frame(t(total)) %>%
373376
rownames_to_column(IDcol) %>%
@@ -444,13 +447,14 @@ analyze.ma <- function(dataSet, ref = NULL, saveRes = TRUE) {
444447

445448
if (saveRes) {
446449

450+
rownames(means) <- paste(rownames(means), "mean")
447451
total <- do.call(rbind, lapply(result, `[`, c("A", "M"), , drop = FALSE))
452+
rownames(total) <- as.vector(t(outer(names(result), c(": A", ": M"), paste0)))
448453
total <- rbind(means, total)
449-
rownames(total) <- c(paste(conds, "mean"), as.vector(t(outer(names(result), c(": A", ": M"), paste0))))
450454

451455
information <- read.csv("preprocess_protein_information.csv", check.names = FALSE)
452-
scaffoldCheck <- any(colnames(information) == "Visible?")
453-
IDcol <- ifelse(scaffoldCheck, "AccessionNumber", "PG.ProteinName")
456+
scaffoldCheck <- "Visible?" %in% colnames(information)
457+
IDcol <- if (scaffoldCheck) "AccessionNumber" else "PG.ProteinName"
454458

455459
total <- as.data.frame(t(total)) %>%
456460
rownames_to_column(IDcol) %>%

0 commit comments

Comments
 (0)