Given this stricter filter, I think no genes pass in the genome
comparisons.
Location contrasts
with genes removed/kept
We will now repeat the above tasks seeking location differences
instead of genotype; essentially I copy/pasted the above with
s/genotype/location/g.
location_tables_full <- combine_de_tables(
location_de, keepers = location_keepers, label_column = tx_label_column,
excel = glue("17full_location_contrasts_tx/location_full_tables-v{ver}.xlsx"))
## Looking for subscript invalid names, end of extract_keepers.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 p08_het_dlgn_vs_p08_het_retina 1138 1074 1324
## 2 p15_het_dlgn_vs_p15_het_retina 1001 1314 1149
## 3 p08_ko_dlgn_vs_p08_ko_retina 960 914 1087
## 4 p15_ko_dlgn_vs_p15_ko_retina 882 1107 1042
## 5 p08_het_scn_vs_p08_het_retina 1410 1414 1685
## 6 p15_het_scn_vs_p15_het_retina 1383 1460 1641
## 7 p08_ko_scn_vs_p08_ko_retina 1181 1184 1391
## 8 p15_ko_scn_vs_p15_ko_retina 939 1135 1156
## 9 p08_het_dlgn_vs_p08_het_scn 443 483 513
## 10 p15_het_dlgn_vs_p15_het_scn 1127 1422 1231
## 11 p08_ko_dlgn_vs_p08_ko_scn 446 483 501
## 12 p15_ko_dlgn_vs_p15_ko_scn 1237 1303 1427
## edger_sigdown limma_sigup limma_sigdown
## 1 1127 1027 976
## 2 1479 969 1110
## 3 996 824 994
## 4 1187 787 888
## 5 1516 1312 1239
## 6 1643 1362 1371
## 7 1265 1117 1103
## 8 1346 976 1018
## 9 612 402 478
## 10 1619 1268 1421
## 11 573 529 746
## 12 1448 1267 1329
## Plot describing unique/shared genes in a differential expression table.

location_sig_full <- extract_significant_genes(
location_tables_full, according_to = "deseq",
excel = glue("17full_location_contrasts_tx/location_full_sig-v{ver}.xlsx"))
location_sig_full
## A set of genes deemed significant according to deseq.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## deseq_up deseq_down
## dr_p08_het 1138 1074
## dr_p15_het 1001 1314
## dr_p08_ko 960 914
## dr_p15_ko 882 1107
## sr_p08_het 1410 1414
## sr_p15_het 1383 1460
## sr_p08_ko 1181 1184
## sr_p15_ko 939 1135
## ds_p08_het 443 483
## ds_p15_het 1127 1422
## ds_p08_ko 446 483
## ds_p15_ko 1237 1303

location_full_upset <- upsetr_sig(location_sig_full)
location_full_intersects <- write_upset_groups(
location_full_upset,
excel = "excel/17full_location_contrasts_tx/location_full_gene_groups.xlsx")
location_tables <- list()
location_sig <- list()
location_gp <- list()
location_cp <- list()
for (k in seq_along(location_keepers)) {
name <- names(location_keepers)[k]
message("Examining ", name)
keeper <- location_keepers[name]
includes <- location_inclusions[[name]]
include_name <- paste0("inc_", name)
include_df_name <- paste0("df_", name)
include_df <- location_inclusions[[include_df_name]]
includes <- location_inclusions[[include_name]]
summary(rownames(location_sig_full[["deseq"]][["ups"]][[name]]) %in% includes)
include_filename <- glue("18location_contrasts_tx/{name}_including_wt_{lfc_cutoff}_decreased_table-v{ver}.xlsx")
include_sig_filename <- glue("18location_contrasts_tx/{name}_including_wt_{lfc_cutoff}_decreased_sig-v{ver}.xlsx")
location_tables[[name]] <- combine_de_tables(
location_de, extra_annot = include_df,
keepers = keeper, label_column = tx_label_column,
excel = include_filename, wanted_genes = includes)
print(location_tables[[name]])
location_sig[[name]] <- extract_significant_genes(
location_tables[[name]], according_to = "deseq",
excel = include_sig_filename)
print(location_sig[[name]])
num_rows <- nrow(location_sig[[name]][["deseq"]][["ups"]][[name]]) +
nrow(location_sig[[name]][["deseq"]][["downs"]][[name]])
message("There are ", num_rows, " significant up and down genes.")
if (num_rows > 10) {
location_gp[[name]] <- all_gprofiler(location_sig[[name]], species = "mmusculus")
location_cp[[name]] <- all_cprofiler(
location_sig[[name]], location_tables[[name]],
orgdb = "org.Mm.eg.db", go_level = go_level, orgdb_from = orgdb_from,
max_groupsize = max_groupsize, organism = "mouse")
cp_written <- write_all_cp(location_cp[[name]], prefix = "19")
gp_written <- write_all_gp(location_gp[[name]], prefix = "19")
}
}
## Examining dr_p08_het
## Looking for subscript invalid names, end of extract_keepers.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 p08_het_dlgn_vs_p08_het_retina 110 96 124
## edger_sigdown limma_sigup limma_sigdown
## 1 90 109 81
## `geom_line()`: Each group consists of only one observation.
## i Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.

## A set of genes deemed significant according to deseq.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## deseq_up deseq_down
## dr_p08_het 110 96

## There are 206 significant up and down genes.
## Examining dr_p15_het
## Looking for subscript invalid names, end of extract_keepers.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 p15_het_dlgn_vs_p15_het_retina 253 55 276
## edger_sigdown limma_sigup limma_sigdown
## 1 55 216 53
## `geom_line()`: Each group consists of only one observation.
## i Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.

## A set of genes deemed significant according to deseq.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## deseq_up deseq_down
## dr_p15_het 253 55

## There are 308 significant up and down genes.
## Examining dr_p08_ko
## Looking for subscript invalid names, end of extract_keepers.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 p08_ko_dlgn_vs_p08_ko_retina 258 67 276
## edger_sigdown limma_sigup limma_sigdown
## 1 67 210 72
## `geom_line()`: Each group consists of only one observation.
## i Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.

## A set of genes deemed significant according to deseq.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## deseq_up deseq_down
## dr_p08_ko 258 67

## There are 325 significant up and down genes.
## Examining dr_p15_ko
## Looking for subscript invalid names, end of extract_keepers.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 p15_ko_dlgn_vs_p15_ko_retina 334 96 359
## edger_sigdown limma_sigup limma_sigdown
## 1 100 281 93
## `geom_line()`: Each group consists of only one observation.
## i Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.

## A set of genes deemed significant according to deseq.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## deseq_up deseq_down
## dr_p15_ko 334 96

## There are 430 significant up and down genes.
## Examining sr_p08_het
## Looking for subscript invalid names, end of extract_keepers.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 p08_het_scn_vs_p08_het_retina 80 111 90
## edger_sigdown limma_sigup limma_sigdown
## 1 105 85 100
## `geom_line()`: Each group consists of only one observation.
## i Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.

## A set of genes deemed significant according to deseq.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## deseq_up deseq_down
## sr_p08_het 80 111

## There are 191 significant up and down genes.
## Examining sr_p15_het
## Looking for subscript invalid names, end of extract_keepers.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 p15_het_scn_vs_p15_het_retina 24 69 26
## edger_sigdown limma_sigup limma_sigdown
## 1 64 23 70
## `geom_line()`: Each group consists of only one observation.
## i Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.

## A set of genes deemed significant according to deseq.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## deseq_up deseq_down
## sr_p15_het 24 69

## There are 93 significant up and down genes.
## Examining sr_p08_ko
## Looking for subscript invalid names, end of extract_keepers.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 p08_ko_scn_vs_p08_ko_retina 112 76 122
## edger_sigdown limma_sigup limma_sigdown
## 1 71 114 60
## `geom_line()`: Each group consists of only one observation.
## i Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.

## A set of genes deemed significant according to deseq.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## deseq_up deseq_down
## sr_p08_ko 112 76

## There are 188 significant up and down genes.
## Examining sr_p15_ko
## Looking for subscript invalid names, end of extract_keepers.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 p15_ko_scn_vs_p15_ko_retina 11 20 10
## edger_sigdown limma_sigup limma_sigdown
## 1 20 11 16
## `geom_line()`: Each group consists of only one observation.
## i Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.

## A set of genes deemed significant according to deseq.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## deseq_up deseq_down
## sr_p15_ko 11 20

## There are 31 significant up and down genes.
## Examining ds_p08_het
## Looking for subscript invalid names, end of extract_keepers.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 p08_het_dlgn_vs_p08_het_scn 39 6 39
## edger_sigdown limma_sigup limma_sigdown
## 1 7 32 7
## `geom_line()`: Each group consists of only one observation.
## i Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.

## A set of genes deemed significant according to deseq.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## deseq_up deseq_down
## ds_p08_het 39 6

## There are 45 significant up and down genes.
## Examining ds_p15_het
## Looking for subscript invalid names, end of extract_keepers.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 p15_het_dlgn_vs_p15_het_scn 611 2 610
## edger_sigdown limma_sigup limma_sigdown
## 1 3 558 2
## `geom_line()`: Each group consists of only one observation.
## i Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.

## A set of genes deemed significant according to deseq.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## deseq_up deseq_down
## ds_p15_het 611 2

## There are 613 significant up and down genes.
## Examining ds_p08_ko
## Looking for subscript invalid names, end of extract_keepers.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown
## 1 p08_ko_dlgn_vs_p08_ko_scn 115 3 112 3
## limma_sigup limma_sigdown
## 1 87 6
## `geom_line()`: Each group consists of only one observation.
## i Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.

## A set of genes deemed significant according to deseq.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## deseq_up deseq_down
## ds_p08_ko 115 3

## There are 118 significant up and down genes.
## Examining ds_p15_ko
## Looking for subscript invalid names, end of extract_keepers.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown
## 1 p15_ko_dlgn_vs_p15_ko_scn 755 2 796 1
## limma_sigup limma_sigdown
## 1 641 0
## `geom_line()`: Each group consists of only one observation.
## i Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.

## A set of genes deemed significant according to deseq.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## deseq_up deseq_down
## ds_p15_ko 755 2

## There are 757 significant up and down genes.
Print out all the plots in a separate block.
for (k in seq_along(location_keepers)) {
name <- names(location_keepers)[k]
message("Examining ", name)
keeper <- location_keepers[name]
includes <- location_inclusions[[name]]
include_name <- paste0("inc_", name)
include_df_name <- paste0("df_", name)
include_df <- location_inclusions[[include_df_name]]
includes <- location_inclusions[[include_name]]
summary(rownames(location_sig_full[["deseq"]][["ups"]][[name]]) %in% includes)
num_rows <- nrow(location_sig[[name]][["deseq"]][["ups"]][[name]]) +
nrow(location_sig[[name]][["deseq"]][["downs"]][[name]])
nrow(location_sig[[name]][["deseq"]][["ups"]][[name]])
nrow(location_sig[[name]][["deseq"]][["downs"]][[name]])
message("There are ", num_rows, " significant up and down genes.")
num_objects <- length(location_cp[[name]])
if (num_objects == 0) {
warning("Something went wrong in all_cprofiler.")
} else {
upp <- which(grepl(x = names(location_cp[[name]]), pattern = "_up$"))
downp <- which(grepl(x = names(location_cp[[name]]), pattern = "_down$"))
if (length(upp) > 0) {
mf_sig <- location_cp[[name]][[upp]][["go_data"]][["MF_enrich"]]
cc_sig <- location_cp[[name]][[upp]][["go_data"]][["CC_enrich"]]
bp_sig <- location_cp[[name]][[upp]][["go_data"]][["BP_enrich"]]
mf_plots_up <- plot_enrichresult(mf_sig, showCategory = go_categories)
mf_tree_up_filename <- glue("19clusterProfiler_plots_tx/{name}_up_mf_sig_tree.pdf")
pp(file = mf_tree_up_filename)
try(print(mf_plots_up[["tree"]]), silent = TRUE)
plotted <- dev.off()
mf_bar_up_filename <- glue("19clusterProfiler_plots_tx/{name}_up_mf_sig_dot.pdf")
pp(file = mf_bar_up_filename)
try(print(mf_plots_up[["dot"]]), silent = TRUE)
plotted <- dev.off()
cc_plots_up <- plot_enrichresult(cc_sig, showCategory = go_categories)
cc_tree_up_filename <- glue("19clusterProfiler_plots_tx/{name}_up_cc_sig_tree.pdf")
pp(file = cc_tree_up_filename)
try(print(cc_plots_up[["tree"]]), silent = TRUE)
plotted <- dev.off()
cc_bar_up_filename <- glue("19clusterProfiler_plots_tx/{name}_up_cc_sig_dot.pdf")
pp(file = cc_bar_up_filename)
try(print(cc_plots_up[["dot"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_up <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_tree_up_filename <- glue("19clusterProfiler_plots_tx/{name}_up_bp_sig_tree.pdf")
pp(file = bp_tree_up_filename)
try(print(bp_plots_up[["tree"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_up <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_bar_up_filename <- glue("19clusterProfiler_plots_tx/{name}_up_bp_sig_dot.pdf")
pp(file = bp_bar_up_filename)
try(print(bp_plots_up[["dot"]]), silent = TRUE)
plotted <- dev.off()
}
if (length(downp) > 0) {
mf_sig <- location_cp[[name]][[downp]][["go_data"]][["MF_enrich"]]
cc_sig <- location_cp[[name]][[downp]][["go_data"]][["CC_enrich"]]
bp_sig <- location_cp[[name]][[downp]][["go_data"]][["BP_enrich"]]
mf_plots_down <- plot_enrichresult(mf_sig, showCategory = go_categories)
mf_tree_down_filename <- glue("19clusterProfiler_plots_tx/{name}_down_mf_sig_tree.pdf")
pp(file = mf_tree_down_filename)
try(print(mf_plots_down[["tree"]]), silent = TRUE)
plotted <- dev.off()
mf_bar_down_filename <- glue("19clusterProfiler_plots_tx/{name}_down_mf_sig_dot.pdf")
pp(file = mf_bar_down_filename)
try(print(mf_plots_down[["dot"]]), silent = TRUE)
plotted <- dev.off()
cc_plots_down <- plot_enrichresult(cc_sig, showCategory = 12)
cc_tree_down_filename <- glue("19clusterProfiler_plots_tx/{name}_down_cc_sig_tree.pdf")
pp(file = cc_tree_down_filename)
try(print(cc_plots_down[["tree"]]), silent = TRUE)
plotted <- dev.off()
cc_bar_down_filename <- glue("19clusterProfiler_plots_tx/{name}_down_cc_sig_dot.pdf")
pp(file = cc_bar_down_filename)
try(print(cc_plots_down[["dot"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_down <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_tree_down_filename <- glue("19clusterProfiler_plots_tx/{name}_down_bp_sig_tree.pdf")
pp(file = bp_tree_down_filename)
try(print(bp_plots_down[["tree"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_down <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_bar_down_filename <- glue("19clusterProfiler_plots_tx/{name}_down_bp_sig_dot.pdf")
pp(file = bp_bar_down_filename)
try(print(bp_plots_down[["dot"]]), silent = TRUE)
plotted <- dev.off()
}
}
}
## Examining dr_p08_het
## There are 206 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in pp(file = mf_tree_up_filename): The directory:
## 19clusterProfiler_plots_tx does not exist, will attempt to create it.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Examining dr_p15_het
## There are 308 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Examining dr_p08_ko
## There are 325 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in max(idx1, idx2): no non-missing arguments to max; returning -Inf
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## NULL
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Examining dr_p15_ko
## There are 430 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Examining sr_p08_het
## There are 191 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Examining sr_p15_het
## There are 93 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Examining sr_p08_ko
## There are 188 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Examining sr_p15_ko
## There are 31 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Examining ds_p08_het
## There are 45 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Examining ds_p15_het
## There are 613 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Examining ds_p08_ko
## There are 118 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Examining ds_p15_ko
## There are 757 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
Colenso sent a specific query of interest, comparing SCN vs. Retinas
at p08 in the heterozygotes including a set of genes of particular
interest. Perhaps I can use some of these as markers to quality control
my work in the future?
Here are the genes:
Opn4, Eomes, Trpc7, Oprm1, Nr4a3, Tbx20, Irx6, AW551984, Pcdh19,
Adcyap1, Baiap3, Chl1, Grin3a, Igf1, Gria1, Grin2d, Grin3a, Chrna6,
Chrna3, Htr5a, Htr2a, Htr7, Irx4, PlxnC1, Sema6d, Sema4f, Sema4a,
Sema6b, Lrrc4b, Lrrc58, Lrrc3b, Wnt4, Wnt9b, Ctxn3, Tenm1, Gna14, Rgs4,
Rgs6, Rgs5
table_input <- location_tables[["sr_p08_het"]]
table_name <- "sr_p08_het"
table <- table_input[["data"]][[table_name]]
interesting_genes <- c("Opn4", "Eomes", "Trpc7", "Oprm1", "Nr4a3", "Tbx20",
"Irx6", "AW551984", "Pcdh19", "Adcyap1r1", "Baiap3",
"Chl1", "Grin3a", "Igf1", "Gria1", "Grin2d", "Grin3a",
"Chrna6", "Chrna3", "Htr5a", "Htr2a", "Htr7", "Irx4",
"PlxnC1", "Sema6d", "Sema4f", "Sema4a", "Sema6b", "Lrrc4b",
"Lrrc58", "Lrrc3b", "Wnt4", "Wnt9b", "Ctxn3", "Tenm1", "Gna14",
"Rgs4", "Rgs6", "Rgs5", "Pou4f2", "Chrnb3", "Bcan")
sr_p08_het_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp",
color_low = colors[["het_retina"]], color_high = colors[["het_scn"]],
label_column = "external_transcript_name", label = interesting_genes, alpha = 1.0,
size = 4)
pp(file = "20location_ma_volcano_tx/sr_p08_het_volcano.pdf", width = 9, height = 9)
## Warning in pp(file = "20location_ma_volcano_tx/sr_p08_het_volcano.pdf", : The
## directory: 20location_ma_volcano_tx does not exist, will attempt to create it.
sr_p08_het_volcano[["plot"]]
plotted <- dev.off()
sr_p08_het_volcano[["plot"]]

sr_p08_het_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = colors[["het_retina"]], color_high = colors[["het_scn"]],
p_col = "deseq_adjp", label_column = "external_transcript_name", label = interesting_genes, outline = outline)
pp(file = "20location_ma_volcano_tx/sr_p08_het_ma.pdf", width = 9, height = 9)
sr_p08_het_ma[["plot"]]
plotted <- dev.off()
sr_p08_het_ma[["plot"]]

Also the ko
table_input <- location_tables[["sr_p15_ko"]]
table_name <- "sr_p15_ko"
table <- table_input[["data"]][[table_name]]
sr_p15_ko_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp",
color_low = colors[["ko_retina"]], color_high = colors[["ko_scn"]],
label_column = "external_transcript_name", label = interesting_genes, alpha = 1.0,
size = 4, min.segment.length = 0, point.padding = 0.2)
pp(file = "20location_ma_volcano_tx/sr_p15_ko_volcano.pdf", width = 12, height = 12)
sr_p15_ko_volcano[["plot"]]
plotted <- dev.off()
sr_p15_ko_volcano[["plot"]]

sr_p15_ko_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = colors[["ko_retina"]], color_high = colors[["ko_scn"]],
p_col = "deseq_adjp", label_column = "external_transcript_name", label = interesting_genes, outline = outline)
pp(file = "20location_ma_volcano_tx/sr_p15_ko_ma.pdf", width = 9, height = 9)
sr_p15_ko_ma[["plot"]]
plotted <- dev.off()
sr_p15_ko_ma[["plot"]]

Test a specific
location query for duplicated IDs
Let us see if any Ensembl gene IDs and/or MGI IDs are shared in the
worksheet location_sr_p08_ko_including_wt_0.1_decreased_sig up/down.
test_table_up <- location_sig[["sr_p08_ko"]][["deseq"]][["ups"]][[1]]
test_table_down <- location_sig[["sr_p08_ko"]][["deseq"]][["downs"]][[1]]
query <- list("up" = rownames(test_table_up),
"down" = rownames(test_table_down))
query_upset <- UpSetR::fromList(query)
UpSetR::upset(query_upset)
## `geom_line()`: Each group consists of only one observation.
## i Do you need to adjust the group aesthetic?

query <- list("up" = test_table_up[["external_transcript_name"]],
"down" = test_table_down[["external_transcript_name"]])
query_upset <- UpSetR::fromList(query)
UpSetR::upset(query_upset)
## `geom_line()`: Each group consists of only one observation.
## i Do you need to adjust the group aesthetic?

Repeat with the
strict filter
location_strict_tables <- list()
location_strict_sig <- list()
location_strict_gp <- list()
location_strict_cp <- list()
for (k in seq_along(location_keepers)) {
name <- names(location_keepers)[k]
message("Examining ", name)
keeper <- location_keepers[name]
includes <- location_inclusions_strict[[name]]
include_name <- paste0("inc_", name)
include_df_name <- paste0("df_", name)
include_df <- location_inclusions_strict[[include_df_name]]
includes <- location_inclusions_strict[[include_name]]
found_includes <- rownames(location_sig_full[["deseq"]][["ups"]][[name]]) %in% includes
summary(found_includes)
if (sum(found_includes) == 0) {
next
}
include_filename <- glue("21location_strict_contrasts_tx/{name}_including_wt_{lfc_cutoff}_decreased_table-v{ver}.xlsx")
include_sig_filename <- glue("21location_strict_contrasts_tx/{name}_including_wt_{lfc_cutoff}_decreased_sig-v{ver}.xlsx")
location_strict_tables[[name]] <- combine_de_tables(
location_de, extra_annot = include_df,
keepers = keeper, label_column = tx_label_column,
excel = include_filename, wanted_genes = includes)
print(location_strict_tables[[name]])
location_strict_sig[[name]] <- extract_significant_genes(
location_strict_tables[[name]], according_to = "deseq",
excel = include_sig_filename)
print(location_strict_sig[[name]])
num_rows <- nrow(location_strict_sig[[name]][["deseq"]][["ups"]][[name]]) +
nrow(location_strict_sig[[name]][["deseq"]][["downs"]][[name]])
message("There are ", num_rows, " significant up and down genes.")
if (num_rows > 10) {
location_strict_gp[[name]] <- all_gprofiler(location_strict_sig[[name]], species = "mmusculus")
location_strict_cp[[name]] <- all_cprofiler(
location_strict_sig[[name]], location_strict_tables[[name]],
orgdb = "org.Mm.eg.db", go_level = go_level, orgdb_from = orgdb_from,
max_groupsize = max_groupsize, organism = "mouse")
cp_written <- write_all_cp(location_strict_cp[[name]], prefix = "22", suffix = "strict")
gp_written <- write_all_gp(location_strict_gp[[name]], prefix = "22", suffix = "strict")
}
}
## Examining dr_p08_het
## Looking for subscript invalid names, end of extract_keepers.
## The result table is too small for meaningful comparisons.
## The first table has only: 22.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 p08_het_dlgn_vs_p08_het_retina 6 2 6
## edger_sigdown limma_sigup limma_sigdown
## 1 1 6 1
## `geom_line()`: Each group consists of only one observation.
## i Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.

## A set of genes deemed significant according to deseq.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## deseq_up deseq_down
## dr_p08_het 6 2

## There are 8 significant up and down genes.
## Examining dr_p15_het
## Looking for subscript invalid names, end of extract_keepers.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 p15_het_dlgn_vs_p15_het_retina 19 1 21
## edger_sigdown limma_sigup limma_sigdown
## 1 1 17 1
## `geom_line()`: Each group consists of only one observation.
## i Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.

## A set of genes deemed significant according to deseq.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## deseq_up deseq_down
## dr_p15_het 19 1

## There are 20 significant up and down genes.
## Examining dr_p08_ko
## Looking for subscript invalid names, end of extract_keepers.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 p08_ko_dlgn_vs_p08_ko_retina 36 1 38
## edger_sigdown limma_sigup limma_sigdown
## 1 1 27 1
## `geom_line()`: Each group consists of only one observation.
## i Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.

## A set of genes deemed significant according to deseq.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## deseq_up deseq_down
## dr_p08_ko 36 1

## There are 37 significant up and down genes.
## Examining dr_p15_ko
## Looking for subscript invalid names, end of extract_keepers.
## The result table is too small for meaningful comparisons.
## The first table has only: 16.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 p15_ko_dlgn_vs_p15_ko_retina 5 0 6
## edger_sigdown limma_sigup limma_sigdown
## 1 0 3 0
## Only dr_p15_ko_up has information, cannot create an UpSet.
## Plot describing unique/shared genes in a differential expression table.
## NULL
## A set of genes deemed significant according to deseq.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## deseq_up deseq_down
## dr_p15_ko 5 0

## There are 5 significant up and down genes.
## Examining sr_p08_het
## Examining sr_p15_het
## Examining sr_p08_ko
## Looking for subscript invalid names, end of extract_keepers.
## The result table is too small for meaningful comparisons.
## The first table has only: 3.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 p08_ko_scn_vs_p08_ko_retina 2 0 2
## edger_sigdown limma_sigup limma_sigdown
## 1 0 2 0
## Only sr_p08_ko_up has information, cannot create an UpSet.
## Plot describing unique/shared genes in a differential expression table.
## NULL
## A set of genes deemed significant according to deseq.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## deseq_up deseq_down
## sr_p08_ko 2 0

## There are 2 significant up and down genes.
## Examining sr_p15_ko
## Looking for subscript invalid names, end of extract_keepers.
## The result table is too small for meaningful comparisons.
## The first table has only: 1.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 p15_ko_scn_vs_p15_ko_retina 1 0 1
## edger_sigdown limma_sigup limma_sigdown
## 1 0 1 0
## Only sr_p15_ko_up has information, cannot create an UpSet.
## Plot describing unique/shared genes in a differential expression table.
## NULL
## A set of genes deemed significant according to deseq.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## deseq_up deseq_down
## sr_p15_ko 1 0

## There are 1 significant up and down genes.
## Examining ds_p08_het
## Examining ds_p15_het
## Examining ds_p08_ko
## Examining ds_p15_ko
Print out all the plots in a separate block.
for (k in seq_along(location_keepers)) {
name <- names(location_keepers)[k]
message("Examining ", name)
keeper <- location_keepers[name]
includes <- location_inclusions_strict[[name]]
include_name <- paste0("inc_", name)
include_df_name <- paste0("df_", name)
include_df <- location_inclusions_strict[[include_df_name]]
includes <- location_inclusions_strict[[include_name]]
summary(rownames(location_sig_full[["deseq"]][["ups"]][[name]]) %in% includes)
num_rows <- nrow(location_strict_sig[[name]][["deseq"]][["ups"]][[name]]) +
nrow(location_strict_sig[[name]][["deseq"]][["downs"]][[name]])
nrow(location_strict_sig[[name]][["deseq"]][["ups"]][[name]])
nrow(location_strict_sig[[name]][["deseq"]][["downs"]][[name]])
message("There are ", num_rows, " significant up and down genes.")
num_objects <- length(location_strict_cp[[name]])
if (num_objects == 0) {
warning("Something went wrong in all_cprofiler.")
} else {
upp <- which(grepl(x = names(location_strict_cp[[name]]), pattern = "_up$"))
downp <- which(grepl(x = names(location_strict_cp[[name]]), pattern = "_down$"))
if (length(upp) > 0) {
mf_sig <- location_strict_cp[[name]][[upp]][["go_data"]][["MF_enrich"]]
cc_sig <- location_strict_cp[[name]][[upp]][["go_data"]][["CC_enrich"]]
bp_sig <- location_strict_cp[[name]][[upp]][["go_data"]][["BP_enrich"]]
mf_plots_up <- plot_enrichresult(mf_sig, showCategory = go_categories)
mf_tree_up_filename <- glue("23clusterProfiler_plots_tx/{name}_up_mf_sig_tree.pdf")
pp(file = mf_tree_up_filename)
try(print(mf_plots_up[["tree"]]), silent = TRUE)
plotted <- dev.off()
mf_bar_up_filename <- glue("23clusterProfiler_plots_tx/{name}_up_mf_sig_dot.pdf")
pp(file = mf_bar_up_filename)
try(print(mf_plots_up[["dot"]]), silent = TRUE)
plotted <- dev.off()
cc_plots_up <- plot_enrichresult(cc_sig, showCategory = go_categories)
cc_tree_up_filename <- glue("23clusterProfiler_plots_tx/{name}_up_cc_sig_tree.pdf")
pp(file = cc_tree_up_filename)
try(print(cc_plots_up[["tree"]]), silent = TRUE)
plotted <- dev.off()
cc_bar_up_filename <- glue("23clusterProfiler_plots_tx/{name}_up_cc_sig_dot.pdf")
pp(file = cc_bar_up_filename)
try(print(cc_plots_up[["dot"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_up <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_tree_up_filename <- glue("23clusterProfiler_plots_tx/{name}_up_bp_sig_tree.pdf")
pp(file = bp_tree_up_filename)
try(print(bp_plots_up[["tree"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_up <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_bar_up_filename <- glue("23clusterProfiler_plots_tx/{name}_up_bp_sig_dot.pdf")
pp(file = bp_bar_up_filename)
try(print(bp_plots_up[["dot"]]), silent = TRUE)
plotted <- dev.off()
}
if (length(downp) > 0) {
mf_sig <- location_strict_cp[[name]][[downp]][["go_data"]][["MF_enrich"]]
cc_sig <- location_strict_cp[[name]][[downp]][["go_data"]][["CC_enrich"]]
bp_sig <- location_strict_cp[[name]][[downp]][["go_data"]][["BP_enrich"]]
mf_plots_down <- plot_enrichresult(mf_sig, showCategory = go_categories)
mf_tree_down_filename <- glue("23clusterProfiler_plots_tx/{name}_down_mf_sig_tree.pdf")
pp(file = mf_tree_down_filename)
try(print(mf_plots_down[["tree"]]), silent = TRUE)
plotted <- dev.off()
mf_bar_down_filename <- glue("23clusterProfiler_plots_tx/{name}_down_mf_sig_dot.pdf")
pp(file = mf_bar_down_filename)
try(print(mf_plots_down[["dot"]]), silent = TRUE)
plotted <- dev.off()
cc_plots_down <- plot_enrichresult(cc_sig, showCategory = 12)
cc_tree_down_filename <- glue("23clusterProfiler_plots_tx/{name}_down_cc_sig_tree.pdf")
pp(file = cc_tree_down_filename)
try(print(cc_plots_down[["tree"]]), silent = TRUE)
plotted <- dev.off()
cc_bar_down_filename <- glue("23clusterProfiler_plots_tx/{name}_down_cc_sig_dot.pdf")
pp(file = cc_bar_down_filename)
try(print(cc_plots_down[["dot"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_down <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_tree_down_filename <- glue("23clusterProfiler_plots_tx/{name}_down_bp_sig_tree.pdf")
pp(file = bp_tree_down_filename)
try(print(bp_plots_down[["tree"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_down <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_bar_down_filename <- glue("23clusterProfiler_plots_tx/{name}_down_bp_sig_dot.pdf")
pp(file = bp_bar_down_filename)
try(print(bp_plots_down[["dot"]]), silent = TRUE)
plotted <- dev.off()
}
}
}
## Examining dr_p08_het
## There are 8 significant up and down genes.
## Warning: Something went wrong in all_cprofiler.
## Examining dr_p15_het
## There are 20 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in pp(file = mf_tree_up_filename): The directory:
## 23clusterProfiler_plots_tx does not exist, will attempt to create it.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Examining dr_p08_ko
## There are 37 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Examining dr_p15_ko
## There are 5 significant up and down genes.
## Warning: Something went wrong in all_cprofiler.
## Examining sr_p08_het
## There are significant up and down genes.
## Warning: Something went wrong in all_cprofiler.
## Examining sr_p15_het
## There are significant up and down genes.
## Warning: Something went wrong in all_cprofiler.
## Examining sr_p08_ko
## There are 2 significant up and down genes.
## Warning: Something went wrong in all_cprofiler.
## Examining sr_p15_ko
## There are 1 significant up and down genes.
## Warning: Something went wrong in all_cprofiler.
## Examining ds_p08_het
## There are significant up and down genes.
## Warning: Something went wrong in all_cprofiler.
## Examining ds_p15_het
## There are significant up and down genes.
## Warning: Something went wrong in all_cprofiler.
## Examining ds_p08_ko
## There are significant up and down genes.
## Warning: Something went wrong in all_cprofiler.
## Examining ds_p15_ko
## There are significant up and down genes.
## Warning: Something went wrong in all_cprofiler.
Colenso sent a specific query of interest, comparing SCN vs. Retinas
at p08 in the heterozygotes including a set of genes of particular
interest. Perhaps I can use some of these as markers to quality control
my work in the future?
Here are the genes:
Opn4, Eomes, Trpc7, Oprm1, Nr4a3, Tbx20, Irx6, AW551984, Pcdh19,
Adcyap1, Baiap3, Chl1, Grin3a, Igf1, Gria1, Grin2d, Grin3a, Chrna6,
Chrna3, Htr5a, Htr2a, Htr7, Irx4, PlxnC1, Sema6d, Sema4f, Sema4a,
Sema6b, Lrrc4b, Lrrc58, Lrrc3b, Wnt4, Wnt9b, Ctxn3, Tenm1, Gna14, Rgs4,
Rgs6, Rgs5
table_input <- location_strict_tables[["sr_p08_het"]]
table_name <- "sr_p08_het"
table <- table_input[["data"]][[table_name]]
interesting_genes <- c("Opn4", "Eomes", "Trpc7", "Oprm1", "Nr4a3", "Tbx20",
"Irx6", "AW551984", "Pcdh19", "Adcyap1r1", "Baiap3",
"Chl1", "Grin3a", "Igf1", "Gria1", "Grin2d", "Grin3a",
"Chrna6", "Chrna3", "Htr5a", "Htr2a", "Htr7", "Irx4",
"PlxnC1", "Sema6d", "Sema4f", "Sema4a", "Sema6b", "Lrrc4b",
"Lrrc58", "Lrrc3b", "Wnt4", "Wnt9b", "Ctxn3", "Tenm1", "Gna14",
"Rgs4", "Rgs6", "Rgs5", "Pou4f2", "Chrnb3", "Bcan")
sr_p08_het_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp",
color_low = colors[["het_retina"]], color_high = colors[["het_scn"]],
label_column = tx_label_column, label = interesting_genes, alpha = 1.0,
size = 4)
## Error in `plot_volcano_condition_de()`:
## ! Column: deseq_logfc is not in the table.
pp(file = "24location_ma_volcano_strict_tx/sr_p08_het_volcano.pdf", width = 9, height = 9)
## Warning in pp(file = "24location_ma_volcano_strict_tx/sr_p08_het_volcano.pdf",
## : The directory: 24location_ma_volcano_strict_tx does not exist, will attempt
## to create it.
sr_p08_het_volcano[["plot"]]
plotted <- dev.off()
sr_p08_het_volcano[["plot"]]

sr_p08_het_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = colors[["het_retina"]], color_high = colors[["het_scn"]],
p_col = "deseq_adjp", label_column = tx_label_column, label = interesting_genes, outline = outline)
## The column: external_transcript_name is not in the data, using rownames.
## Warning in max(newdf[["avg"]]): no non-missing arguments to max; returning -Inf
## Warning in plot_ma_condition_de(table, table_name, expr_col = "deseq_basemean",
## : NAs introduced by coercion
## Error in `[[<-.data.frame`:
## ! replacement has 1 row, data has 0
pp(file = "24location_ma_volcano_strict_tx/sr_p08_het_ma.pdf", width = 9, height = 9)
sr_p08_het_ma[["plot"]]
plotted <- dev.off()
sr_p08_het_ma[["plot"]]

And time
time_tables_full <- combine_de_tables(
time_de, keepers = time_keepers,
label_column = tx_label_column,
excel = glue("25full_contrasts_time_tx/full_tables-v{ver}.xlsx"))
## Looking for subscript invalid names, end of extract_keepers.
time_sig_full <- extract_significant_genes(
time_tables_full, according_to = "deseq",
excel = glue("25full_contrasts_time_tx/full_sig-v{ver}.xlsx"))
time_tables <- list()
time_sig <- list()
time_gp <- list()
time_cp <- list()
for (k in seq_along(time_keepers)) {
name <- names(time_keepers)[k]
message("Examining ", name)
keeper <- time_keepers[name]
includes <- time_inclusions[[name]]
include_name <- paste0("inc_", name)
include_df_name <- paste0("df_", name)
include_df <- time_inclusions[[include_df_name]]
includes <- time_inclusions[[include_name]]
summary(rownames(time_sig_full[["deseq"]][["ups"]][[name]]) %in% includes)
include_filename <- glue("26time_contrasts_tx/{name}_including_wt_{lfc_cutoff}_decreased_table-v{ver}.xlsx")
include_sig_filename <- glue("26time_contrasts_tx/{name}_including_wt_{lfc_cutoff}_decreased_sig-v{ver}.xlsx")
time_tables[[name]] <- combine_de_tables(
time_de, extra_annot = include_df,
keepers = keeper, label_column = tx_label_column,
excel = include_filename, wanted_genes = includes)
print(time_tables[[name]])
time_sig[[name]] <- extract_significant_genes(
time_tables[[name]], according_to = "deseq",
excel = include_sig_filename)
print(time_sig[[name]])
num_rows <- nrow(time_sig[[name]][["deseq"]][["ups"]][[name]]) +
nrow(time_sig[[name]][["deseq"]][["downs"]][[name]])
message("There are ", num_rows, " significant up and down genes.")
if (num_rows > 10) {
time_gp[[name]] <- all_gprofiler(time_sig[[name]], species = "mmusculus")
gp_written <- write_all_gp(time_gp[[name]])
time_cp[[name]] <- all_cprofiler(
time_sig[[name]], time_tables[[name]], orgdb = "org.Mm.eg.db", organism = "mouse",
orgdb_from = orgdb_from, go_level = go_level, max_groupsize = max_groupsize)
cp_written <- write_all_cp(time_cp[[name]], prefix = "27")
gp_written <- write_all_gp(time_gp[[name]], prefix = "27")
}
}
## Examining t_het_dlgn
## Looking for subscript invalid names, end of extract_keepers.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 p15_het_dlgn_vs_p08_het_dlgn 281 9 255
## edger_sigdown limma_sigup limma_sigdown
## 1 9 197 8
## `geom_line()`: Each group consists of only one observation.
## i Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.

## A set of genes deemed significant according to deseq.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## deseq_up deseq_down
## t_het_dlgn 281 9

## There are 290 significant up and down genes.
## Examining t_ko_dlgn
## Looking for subscript invalid names, end of extract_keepers.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 p15_ko_dlgn_vs_p08_ko_dlgn 357 89 390
## edger_sigdown limma_sigup limma_sigdown
## 1 87 338 73
## `geom_line()`: Each group consists of only one observation.
## i Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.

## A set of genes deemed significant according to deseq.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## deseq_up deseq_down
## t_ko_dlgn 357 89

## There are 446 significant up and down genes.
## Examining t_het_retina
## Looking for subscript invalid names, end of extract_keepers.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 p15_het_retina_vs_p08_het_retina 30 103 30
## edger_sigdown limma_sigup limma_sigdown
## 1 116 24 102
## `geom_line()`: Each group consists of only one observation.
## i Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.

## A set of genes deemed significant according to deseq.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## deseq_up deseq_down
## t_het_retina 30 103

## There are 133 significant up and down genes.
## Examining t_ko_retina
## Looking for subscript invalid names, end of extract_keepers.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 p15_ko_retina_vs_p08_ko_retina 12 136 11
## edger_sigdown limma_sigup limma_sigdown
## 1 143 9 134
## `geom_line()`: Each group consists of only one observation.
## i Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.

## A set of genes deemed significant according to deseq.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## deseq_up deseq_down
## t_ko_retina 12 136

## There are 148 significant up and down genes.
## Examining t_het_scn
## Looking for subscript invalid names, end of extract_keepers.
## The result table is too small for meaningful comparisons.
## The first table has only: 17.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 p15_het_scn_vs_p08_het_scn 0 1 0
## edger_sigdown limma_sigup limma_sigdown
## 1 1 0 1
## Only t_het_scn_down has information, cannot create an UpSet.
## Plot describing unique/shared genes in a differential expression table.
## NULL
## A set of genes deemed significant according to deseq.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## deseq_up deseq_down
## t_het_scn 0 1

## There are 1 significant up and down genes.
## Examining t_ko_scn
## Looking for subscript invalid names, end of extract_keepers.
## The result table is too small for meaningful comparisons.
## The first table has only: 8.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown
## 1 p15_ko_scn_vs_p08_ko_scn 0 0 0 0
## limma_sigup limma_sigdown
## 1 0 0
## Only has information, cannot create an UpSet.
## Plot describing unique/shared genes in a differential expression table.
## NULL
## A set of genes deemed significant according to deseq.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## deseq_up deseq_down
## t_ko_scn 0 0
## There are 0 significant up and down genes.
Send the plots separately.
for (k in seq_along(time_keepers)) {
name <- names(time_keepers)[k]
message("Examining ", name)
keeper <- time_keepers[name]
includes <- time_inclusions[[name]]
include_name <- paste0("inc_", name)
include_df_name <- paste0("df_", name)
include_df <- time_inclusions[[include_df_name]]
includes <- time_inclusions[[include_name]]
num_rows <- nrow(time_sig[[name]][["deseq"]][["ups"]][[name]]) +
nrow(time_sig[[name]][["deseq"]][["downs"]][[name]])
message("There are ", num_rows, " significant up and down genes.")
num_objects <- length(time_cp[[name]])
if (num_objects == 0) {
warning("Something failed in all_cprofiler.")
} else {
upp <- which(grepl(x = names(time_cp[[name]]), pattern = "_up$"))
downp <- which(grepl(x = names(time_cp[[name]]), pattern = "_down$"))
if (length(upp) > 0) {
mf_sig <- time_cp[[name]][[upp]][["go_data"]][["MF_enrich"]]
cc_sig <- time_cp[[name]][[upp]][["go_data"]][["CC_enrich"]]
bp_sig <- time_cp[[name]][[upp]][["go_data"]][["BP_enrich"]]
mf_plots_up <- plot_enrichresult(mf_sig, showCategory = go_categories)
mf_tree_up_filename <- glue("28clusterProfiler_plots_tx/{name}_up_mf_sig_tree.pdf")
pp(file = mf_tree_up_filename)
try(print(mf_plots_up[["tree"]]), silent = TRUE)
plotted <- dev.off()
mf_bar_up_filename <- glue("28clusterProfiler_plots_tx/{name}_up_mf_sig_dot.pdf")
pp(file = mf_bar_up_filename)
try(print(mf_plots_up[["dot"]]), silent = TRUE)
plotted <- dev.off()
cc_plots_up <- plot_enrichresult(cc_sig, showCategory = go_categories)
cc_tree_up_filename <- glue("28clusterProfiler_plots_tx/{name}_up_cc_sig_tree.pdf")
pp(file = cc_tree_up_filename)
try(print(cc_plots_up[["tree"]]), silent = TRUE)
plotted <- dev.off()
cc_bar_up_filename <- glue("28clusterProfiler_plots_tx/{name}_up_cc_sig_dot.pdf")
pp(file = cc_bar_up_filename)
try(print(cc_plots_up[["dot"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_up <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_tree_up_filename <- glue("28clusterProfiler_plots_tx/{name}_up_bp_sig_tree.pdf")
pp(file = bp_tree_up_filename)
try(print(bp_plots_up[["tree"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_up <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_bar_up_filename <- glue("28clusterProfiler_plots_tx/{name}_up_bp_sig_dot.pdf")
pp(file = bp_bar_up_filename)
try(print(bp_plots_up[["dot"]]), silent = TRUE)
plotted <- dev.off()
}
if (length(downp) > 0) {
mf_sig <- time_cp[[name]][[downp]][["go_data"]][["MF_enrich"]]
cc_sig <- time_cp[[name]][[downp]][["go_data"]][["CC_enrich"]]
bp_sig <- time_cp[[name]][[downp]][["go_data"]][["BP_enrich"]]
mf_plots_down <- plot_enrichresult(mf_sig, showCategory = go_categories)
mf_tree_down_filename <- glue("28clusterProfiler_plots_tx/{name}_down_mf_sig_tree.pdf")
pp(file = mf_tree_down_filename)
try(print(mf_plots_down[["tree"]]), silent = TRUE)
plotted <- dev.off()
mf_bar_down_filename <- glue("28clusterProfiler_plots_tx/{name}_down_mf_sig_dot.pdf")
pp(file = mf_bar_down_filename)
try(print(mf_plots_down[["dot"]]), silent = TRUE)
plotted <- dev.off()
cc_plots_down <- plot_enrichresult(cc_sig, showCategory = go_categories)
cc_tree_down_filename <- glue("28clusterProfiler_plots_tx/{name}_down_cc_sig_tree.pdf")
pp(file = cc_tree_down_filename)
try(print(cc_plots_down[["tree"]]), silent = TRUE)
plotted <- dev.off()
cc_bar_down_filename <- glue("28clusterProfiler_plots_tx/{name}_down_cc_sig_dot.pdf")
pp(file = cc_bar_down_filename)
try(print(cc_plots_down[["dot"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_down <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_tree_down_filename <- glue("28clusterProfiler_plots_tx/{name}_down_bp_sig_tree.pdf")
pp(file = bp_tree_down_filename)
try(print(bp_plots_down[["tree"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_down <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_bar_down_filename <- glue("28clusterProfiler_plots_tx/{name}_down_bp_sig_dot.pdf")
pp(file = bp_bar_down_filename)
try(print(bp_plots_down[["dot"]]), silent = TRUE)
plotted <- dev.off()
}
}
}
## Examining t_het_dlgn
## There are 290 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in pp(file = mf_tree_up_filename): The directory:
## 28clusterProfiler_plots_tx does not exist, will attempt to create it.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Examining t_ko_dlgn
## There are 446 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Examining t_het_retina
## There are 133 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Examining t_ko_retina
## There are 148 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Arguments in `...` must be used.
## x Problematic argument:
## * by = "Count"
## i Did you misspell an argument name?
## Examining t_het_scn
## There are 1 significant up and down genes.
## Warning: Something failed in all_cprofiler.
## Examining t_ko_scn
## There are 0 significant up and down genes.
## Warning: Something failed in all_cprofiler.