In sample_estimation, I created sc_filt which is precisely what I want.
keepers <- list(
"mcwu_vs_wcwu" = c("mtc_wtu", "wtc_wtu")
)
fsva <- all_pairwise(input=merged_filt, model_batch="fsva")
## The be method chose 3 surrogate variable(s).
## Attempting fsva surrogate estimation.
## Using fsva to test before/after batch correction.
## Finished running DE analyses, collecting outputs.
## Comparing analyses 1/6: mtc_wtu_vs_mtc_mtu
## Comparing analyses 2/6: wtc_mtu_vs_mtc_mtu
## Comparing analyses 3/6: wtc_wtu_vs_mtc_mtu
## Comparing analyses 4/6: wtc_mtu_vs_mtc_wtu
## Comparing analyses 5/6: wtc_wtu_vs_mtc_wtu
## Comparing analyses 6/6: wtc_wtu_vs_wtc_mtu
fsva_write <- combine_de_tables(all_pairwise_result=fsva,
keepers=keepers,
excel=paste0("excel/sva_in_model_differential_merged-v", ver, ".xlsx"))
## Deleting the file excel/sva_in_model_differential_merged-v20170515.xlsx before writing the tables.
## Writing a legend of columns.
## Working on 1/1: mcwu_vs_wcwu
## Found inverse table with wtc_wtu_vs_mtc_wtu
## Adding venn plots for mcwu_vs_wcwu.
## Limma expression coefficients for mcwu_vs_wcwu; R^2: 0.94; equation: y = 1.01x - 0.0273
## Edger expression coefficients for mcwu_vs_wcwu; R^2: 0.938; equation: y = 1.01x - 0.0115
## DESeq2 expression coefficients for mcwu_vs_wcwu; R^2: 0.966; equation: y = 0.996x - 0.0478
## Writing summary information.
## The sheet: pairwise_summary is in legend, mcwu_vs_wcwu, pairwise_summary.
## Attempting to add the comparison plot to pairwise_summary at row: 19 and column: 1
## Performing save of the workbook.
fsva_sig <- sm(extract_significant_genes(combined=fsva_write,
excel=paste0("excel/sva_in_model_significant_merged-v", ver, ".xlsx")))
merged_nor <- subset_expt(merged_filt, subset="batch!='r'")
fsva_nor <- all_pairwise(input=merged_nor, model_batch="fsva")
## The be method chose 1 surrogate variable(s).
## Attempting fsva surrogate estimation.
## Using fsva to test before/after batch correction.
## Finished running DE analyses, collecting outputs.
## Comparing analyses 1/6: mtc_wtu_vs_mtc_mtu
## Comparing analyses 2/6: wtc_mtu_vs_mtc_mtu
## Comparing analyses 3/6: wtc_wtu_vs_mtc_mtu
## Comparing analyses 4/6: wtc_mtu_vs_mtc_wtu
## Comparing analyses 5/6: wtc_wtu_vs_mtc_wtu
## Comparing analyses 6/6: wtc_wtu_vs_wtc_mtu
fsva_nor_write <- combine_de_tables(all_pairwise_result=fsva_nor,
keepers=keepers,
excel=paste0("excel/nor_sva_in_model_differential_merged-v", ver, ".xlsx"))
## Deleting the file excel/nor_sva_in_model_differential_merged-v20170515.xlsx before writing the tables.
## Writing a legend of columns.
## Working on 1/1: mcwu_vs_wcwu
## Found inverse table with wtc_wtu_vs_mtc_wtu
## Adding venn plots for mcwu_vs_wcwu.
## Limma expression coefficients for mcwu_vs_wcwu; R^2: 0.956; equation: y = 0.971x + 0.186
## Edger expression coefficients for mcwu_vs_wcwu; R^2: 0.955; equation: y = 0.961x + 0.311
## DESeq2 expression coefficients for mcwu_vs_wcwu; R^2: 0.961; equation: y = 0.972x + 0.274
## Writing summary information.
## The sheet: pairwise_summary is in legend, mcwu_vs_wcwu, pairwise_summary.
## Attempting to add the comparison plot to pairwise_summary at row: 19 and column: 1
## Performing save of the workbook.
merged_nos <- subset_expt(merged_filt, subset="batch!='s'")
fsva_nos <- all_pairwise(input=merged_nos, model_batch="fsva")
## The be method chose 2 surrogate variable(s).
## Attempting fsva surrogate estimation.
## Using fsva to test before/after batch correction.
## Finished running DE analyses, collecting outputs.
## Comparing analyses 1/6: mtc_wtu_vs_mtc_mtu
## Comparing analyses 2/6: wtc_mtu_vs_mtc_mtu
## Comparing analyses 3/6: wtc_wtu_vs_mtc_mtu
## Comparing analyses 4/6: wtc_mtu_vs_mtc_wtu
## Comparing analyses 5/6: wtc_wtu_vs_mtc_wtu
## Comparing analyses 6/6: wtc_wtu_vs_wtc_mtu
fsva_nos_write <- combine_de_tables(all_pairwise_result=fsva_nos,
keepers=keepers,
excel=paste0("excel/nos_sva_in_model_differential_merged-v", ver, ".xlsx"))
## Deleting the file excel/nos_sva_in_model_differential_merged-v20170515.xlsx before writing the tables.
## Writing a legend of columns.
## Working on 1/1: mcwu_vs_wcwu
## Found inverse table with wtc_wtu_vs_mtc_wtu
## Adding venn plots for mcwu_vs_wcwu.
## Limma expression coefficients for mcwu_vs_wcwu; R^2: 0.909; equation: y = 1.01x - 0.0726
## Edger expression coefficients for mcwu_vs_wcwu; R^2: 0.911; equation: y = 1.01x - 0.0653
## DESeq2 expression coefficients for mcwu_vs_wcwu; R^2: 0.942; equation: y = 0.992x - 0.0413
## Writing summary information.
## The sheet: pairwise_summary is in legend, mcwu_vs_wcwu, pairwise_summary.
## Attempting to add the comparison plot to pairwise_summary at row: 19 and column: 1
## Performing save of the workbook.
v1_env <- new.env()
load(paste0("../scerevisiae_cbf5v1/savefiles/differential_expression-v", ver, ".rda.xz"),
envir=v1_env)
v1_de <- v1_env$batch_write$data$mtc_vs_wtc
##v1_de <- nobatch_write$data$wtc_wtu_vs_mtc_wtu
##rm(list=c("v1_env"))
merged_de <- fsva$limma$all_tables$wtc_wtu_vs_mtc_wtu
merged_de$logFC <- merged_de$logFC * -1.0
v1v2_merged <- merge(v1_de, merged_de, by="row.names")
v1v2_merged <- v1v2_merged[, c("limma_logfc", "logFC")]
v1v2_scatter <- plot_linear_scatter(df=v1v2_merged, loess=TRUE)
## Used Bon Ferroni corrected t test(s) between columns.
v1v2_scatter$scatter
v1v2_scatter$correlation
##
## Pearson's product-moment correlation
##
## data: df[, 1] and df[, 2]
## t = 46, df = 5800, p-value <2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.4941 0.5321
## sample estimates:
## cor
## 0.5134
cor.test(v1v2_merged[, 1], v1v2_merged[, 2], method="spearman")
## Warning in cor.test.default(v1v2_merged[, 1], v1v2_merged[, 2], method = "spearman"):
## Cannot compute exact p-value with ties
##
## Spearman's rank correlation rho
##
## data: v1v2_merged[, 1] and v1v2_merged[, 2]
## S = 1.7e+10, p-value <2e-16
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
## rho
## 0.4819
## Well at least the direction is correct...
merged_nor_de <- fsva_nor$limma$all_tables$wtc_wtu_vs_mtc_wtu
merged_nor_de$logFC <- merged_nor_de$logFC * -1.0
v1v2_merged <- merge(v1_de, merged_nor_de, by="row.names")
v1v2_merged <- v1v2_merged[, c("limma_logfc", "logFC")]
v1v2_scatter <- plot_linear_scatter(df=v1v2_merged, loess=TRUE)
## Used Bon Ferroni corrected t test(s) between columns.
v1v2_scatter$scatter
v1v2_scatter$correlation
##
## Pearson's product-moment correlation
##
## data: df[, 1] and df[, 2]
## t = 140, df = 5800, p-value <2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.8674 0.8796
## sample estimates:
## cor
## 0.8737
cor.test(v1v2_merged[, 1], v1v2_merged[, 2])
##
## Pearson's product-moment correlation
##
## data: v1v2_merged[, 1] and v1v2_merged[, 2]
## t = 140, df = 5800, p-value <2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.8674 0.8796
## sample estimates:
## cor
## 0.8737
## Well at least the direction is correct...
merged_nos_de <- fsva_nos$limma$all_tables$wtc_wtu_vs_mtc_wtu
merged_nos_de$logFC <- merged_nos_de$logFC * -1.0
v1v2_merged <- merge(v1_de, merged_nos_de, by="row.names")
v1v2_merged <- v1v2_merged[, c("limma_logfc", "logFC")]
v1v2_scatter <- plot_linear_scatter(df=v1v2_merged, loess=TRUE)
## Used Bon Ferroni corrected t test(s) between columns.
v1v2_scatter$scatter
v1v2_scatter$correlation
##
## Pearson's product-moment correlation
##
## data: df[, 1] and df[, 2]
## t = 42, df = 5800, p-value <2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.4643 0.5037
## sample estimates:
## cor
## 0.4843
cor.test(v1v2_merged[, 1], v1v2_merged[, 2])
##
## Pearson's product-moment correlation
##
## data: v1v2_merged[, 1] and v1v2_merged[, 2]
## t = 42, df = 5800, p-value <2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.4643 0.5037
## sample estimates:
## cor
## 0.4843
## Well at least the direction is correct...