-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrough-draft_handle-tables_establish-study-design.R
622 lines (499 loc) · 19.7 KB
/
rough-draft_handle-tables_establish-study-design.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
# rough-draft_handle-tables_establish-study-design.R
# KA
# 2023-0403
# Get situated ===============================================================
# Load necessary libraries
library(DESeq2)
library(edgeR)
library(EnhancedVolcano)
library(GenomicRanges)
library(ggrepel)
library(IRanges)
library(PCAtools)
library(readxl)
library(sva)
library(tidyverse)
# Set options
options(scipen = 999)
options(ggrepel.max.overlaps = Inf)
# Set working directory
if(stringr::str_detect(getwd(), "kalavattam")) {
p_local <- "/Users/kalavattam/Dropbox/FHCC"
} else {
p_local <- "/Users/kalavatt/projects-etc"
}
p_wd <- "2022-2023_RRP6-NAB3/results/2023-0215"
setwd(paste(p_local, p_wd, sep = "/"))
getwd()
rm(p_local, p_wd)
# Load in and process `htseq-count` table ====================================
# Load in htseq-count table --------------------------------------------------
p_hc <- "outfiles_htseq-count/already/combined-SC-KL-20S/UT_prim_UMI"
f_hc <- "all-samples.combined-SC-KL-20S.hc-strd-eq.mRNA.tsv"
t_hc <- readr::read_tsv(
paste(p_hc, f_hc, sep = "/"), show_col_types = FALSE
) %>%
dplyr::slice(-1)
rm(p_hc, f_hc)
# Clean up tibble column names -----------------------------------------------
colnames(t_hc) <- colnames(t_hc) %>%
gsub("\\.UT_prim_UMI\\.hc-strd-eq\\.tsv$", "", .) %>%
gsub("\\.UT_prim_UMI\\.hc-strd-op\\.tsv$", "", .)
t_hc$features <- t_hc$features %>%
gsub("^transcript\\:", "", .) %>%
gsub("_mRNA", "", .)
# To associate features (mRNA) with metadata, load combined_SC_KL_20S.gff3 ---
p_gff3 <- "./infiles_gtf-gff3/already"
f_gff3 <- "combined_SC_KL_20S.gff3"
t_gff3 <- rtracklayer::import(paste(p_gff3, f_gff3, sep = "/")) %>%
as.data.frame() %>%
dplyr::as_tibble()
rm(p_gff3, f_gff3)
# Subset combined_SC_KL_20S.gff3 for ID "mRNA" -------------------------------
#+ (specified in the call to htseq-count)
t_gff3 <- t_gff3[t_gff3$type == "mRNA", ]
t_gff3$ID <- t_gff3$ID %>%
gsub("^transcript\\:", "", .) %>%
gsub("_mRNA", "", .)
# Subset tibble to keep only relevant columns --------------------------------
keep <- c(
"seqnames", "start", "end", "width", "strand", "type", "ID", "biotype",
"Name"
)
t_gff3 <- t_gff3[, colnames(t_gff3) %in% keep] %>%
dplyr::rename(length = width)
rm(keep)
# Convert column Name from list to character vector --------------------------
#+ ...and replace empty fields NA character values
t_gff3$Name <- ifelse(
as.character(t_gff3$Name) == "character(0)",
NA_character_,
as.character(t_gff3$Name)
)
# Rename column "seqnames" to "chr" and column "Name" to "names" -------------
t_gff3 <- t_gff3 %>% dplyr::rename(
c(chr = seqnames, names = Name, features = ID)
)
# Join t_hc and t_gff3 -------------------------------------------------------
t_hc <- dplyr::full_join(t_gff3, t_hc, by = "features") %>%
dplyr::rename(feature = features)
rm(t_gff3)
# Order tibble by chromosome names and feature start positions ---------------
chr_SC <- c(
"I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII",
"XIII", "XIV", "XV", "XVI", "Mito"
)
chr_KL <- c("A", "B", "C", "D", "E", "F")
chr_20S <- "20S"
chr_order <- c(chr_SC, chr_KL, chr_20S)
t_hc$chr <- t_hc$chr %>% as.factor()
t_hc$chr <- ordered(t_hc$chr, levels = chr_order)
t_hc <- t_hc %>% dplyr::arrange(chr, start)
# Categorize chromosomes by genome of origin ---------------------------------
t_hc$genome <- ifelse(
t_hc$chr %in% chr_SC,
"S_cerevisiae",
ifelse(
t_hc$chr %in% chr_KL,
"K_lactis",
ifelse(
t_hc$chr %in% chr_20S,
"20S",
NA
)
)
) %>%
as.factor()
rm(chr_KL, chr_SC, chr_20S, chr_order)
# Move the new column "genome" to a better location in the tibble ------------
t_hc <- t_hc %>% dplyr::relocate("genome", .before = "chr")
# Filter rows containing htseq-count metrics (m_hc) --------------------------
m_hc <- t_hc %>% dplyr::filter(grepl("__", feature)) %>%
dplyr::select(-c(colnames(t_hc[c(1:7, 9:10)])))
t_hc <- t_hc %>% dplyr::filter(!grepl("__", feature))
# Create a "complete" vector of feature names --------------------------------
#+ Also, move columns to better locations within the tibble
t_hc$complete <- ifelse(!is.na(t_hc$names), t_hc$names, t_hc$feature)
t_hc <- t_hc %>%
dplyr::relocate(c(names, complete), .after = feature) %>%
dplyr::relocate(type, .after = complete)
# Record tibble t_hc positional information in a GRanges object ===============
#+ (pos_info will be used in DESeq2 processing, post-processing, etc.)
pos_info <- GenomicRanges::GRanges(
seqnames = t_hc$chr,
ranges = IRanges::IRanges(t_hc$start, t_hc$end),
strand = t_hc$strand,
length = t_hc$length,
feature = t_hc$feature,
names = t_hc$names,
complete = t_hc$complete,
biotype = t_hc$biotype,
type = t_hc$type,
genome = t_hc$genome
)
pos_info
# Load in Excel spreadsheet of samples names and variables ===================
p_xl <- "notebook" #INPATH
f_xl <- "variables.xlsx" #INFILE
t_xl <- readxl::read_xlsx(
paste(p_xl, f_xl, sep = "/"), sheet = "master", na = "NA"
)
rm(p_xl, f_xl)
# Make a master model matrix =================================================
# Columns 12 through to the last column are composed of sample feature counts;
#+ get these column names into a vector
samples <- colnames(t_hc)[12:length(colnames(t_hc))]
# Convert the vector of column names to a list by splitting each element at
#+ its underscores; thus, each vector element becomes a list of eight strings,
#+ with one string for 'strain', one for 'state', etc.; these
samples <- stringr::str_split(samples, "_")
# Convert the list to a dataframe, transpose it, then convert it to a tibble
#+ [R fun fact: 'tibble' data types can't be built directly from 'list' data
#+ types; in fact, it can difficult to build 'dataframe' types from 'list'
#+ types as well; the reason we have no issues doing this is because we have
#+ ensured ahead of time that each list element has the same number of
#+ subelements (8); the difficulty arises when lists elements have varying
#+ numbers of subelements]
samples <- samples %>%
as.data.frame(
.,
# Using numeric column names here because the columns will soon be
#+ transposed to rows, and I don't want the rows to have proper names
col.names = c(seq(1, 62)),
# Using proper row names here because the rows will soon be transposed
#+ to columns, and I *do* want the columns to have proper names
row.names = c(
"strain", "state", "time", "kit", "transcription", "auxin",
"timecourse", "replicate", "technical"
)
) %>%
t() %>%
tibble::as_tibble()
# Add a keys variable for quickly accessing combinations of variable values
keys <- vector(mode = "character")
for(i in seq(1, nrow(samples))) {
# i <- 1
keys[i] <- paste(
samples[i, 1], samples[i, 2], samples[i, 3],
samples[i, 4], samples[i, 5], samples[i, 6],
samples[i, 7], samples[i, 8], samples[i, 9],
sep = "_"
)
}
keys <- keys %>% as.data.frame()
colnames(keys) <- "keys"
samples <- dplyr::bind_cols(samples, keys) %>%
dplyr::relocate("keys", .before = "strain")
rm(i)
# Add Alison's original samples names to the 'samples' dataframe using the
#+ 't_xl' dataframe; here, we're just adding the original sample names, but we
#+ could potentially add in other information stored in the Excel file
t_xl <- t_xl %>%
dplyr::rename(keys = name) %>%
dplyr::select(., c(keys, sample_name))
samples <- dplyr::full_join(samples, t_xl, by = "keys")
rm(t_xl, keys)
# Assess factors for study design ============================================
# colnames(samples)
# cat("\n")
#
# cat("strain")
# table(as.factor(samples$strain))
# cat("\n")
#
# cat("state")
# table(as.factor(samples$state))
# cat("\n")
#
# cat("time")
# table(as.factor(samples$time))
# cat("\n")
#
# cat("kit")
# table(as.factor(samples$kit))
# cat("\n")
#
# cat("transcription")
# table(as.factor(samples$transcription))
# cat("\n")
#
# cat("auxin")
# table(as.factor(samples$auxin))
# cat("\n")
#
# cat("timecourse")
# table(as.factor(samples$timecourse))
# cat("\n")
#
# cat("replicate")
# table(as.factor(samples$replicate))
# cat("\n")
#
# cat("technical")
# table(as.factor(samples$technical))
# cat("\n")
# Isolate samples by figure plans/requirements ===============================
samples_fig_1_5 <- samples %>%
dplyr::filter(grepl("ovn", kit))
# batch-effect FALSE NA
# third-rep FALSE NA
# pairwise FALSE NA
# groupwise TRUE all
samples_fig_2 <- samples %>%
dplyr::filter(grepl("DS", state)) %>%
dplyr::filter(!grepl("t4", strain))
# batch-effect TRUE WT_DSp48_day4_tcn_SS_aux-F_tc-T_rep1_tech2
# third-rep FALSE NA
# pairwise TRUE #TODO
# groupwise TRUE all
samples_fig_3 <- samples %>%
dplyr::filter(!grepl("DS", state)) %>%
dplyr::filter(!grepl("CU", sample_name)) %>%
dplyr::filter(grepl("tcn", kit)) %>%
dplyr::filter(grepl("r6|WT", strain))
# batch-effect TRUE r6-n_Q_day8_tcn_SS_aux-F_tc-F_rep1_tech2
# third-rep FALSE NA
# pairwise TRUE #TODO
# groupwise #MAYBE #TODO
samples_fig_4 <- samples %>%
dplyr::filter(grepl("o-|n3-", strain))
# batch-effect FALSE NA
# third-rep TRUE n3-d_Q_day7_tcn_N_aux-T_tc-F_rep3_tech1
# pairwise TRUE #TODO
# groupwise #MAYBE #TODO
# Read in functions ==========================================================
get_object_name <- function(object) {
return(deparse(substitute(object)))
}
make_col_data <- function(tibble_samples) {
col_data <- tibble_samples %>%
# lapply(., gsub, pattern = "-", replacement = "") %>%
as.data.frame() %>%
tibble::column_to_rownames(., var = "keys") %>%
droplevels()
return(col_data)
}
make_dds_model_intercept <- function(counts_data, col_data, pos_info) {
dds <- DESeq2::DESeqDataSetFromMatrix(
countData = counts_data,
colData = col_data,
design = ~1,
rowRanges = pos_info
)
return(dds)
}
# Initialize and populate list for study-design data/metadata ================
sec_a <- "a_overview"
sec_b <- paste0("b_", get_object_name(samples_fig_1_5))
sec_c <- paste0("c_", get_object_name(samples_fig_2))
sec_d <- paste0("d_", get_object_name(samples_fig_3))
sec_e <- paste0("e_", get_object_name(samples_fig_4))
# rm(list = grep("sec_", names(.GlobalEnv), value = TRUE))
design <- list()
design[[sec_a]][["counts_metadata"]] <- t_hc
design[[sec_a]][["metrics"]] <- m_hc
design[[sec_a]][["positional"]] <- pos_info
design[[sec_a]][[get_object_name(samples)]] <- samples
design[[sec_b]][["samples"]] <- samples_fig_1_5
design[[sec_c]][["samples"]] <- samples_fig_2
design[[sec_d]][["samples"]] <- samples_fig_3
design[[sec_e]][["samples"]] <- samples_fig_4
# Determine and record relevant data, metadata for each sample ===============
# samples_fig_1_5 ------------------------------------------------------------
# Subset t_hc by relevant samples ------------------------
datasets <- samples_fig_1_5$keys
keep <- c(colnames(t_hc)[1:11], datasets)
t_hc_fig_1_5 <- t_hc[, colnames(t_hc) %in% keep]
rm(keep)
# Create a dds object ------------------------------------
counts_data <- t_hc_fig_1_5[, datasets] %>%
as.data.frame() %>%
sapply(., as.integer)
col_data <- make_col_data(samples_fig_1_5)
dds_intcp <- make_dds_model_intercept(counts_data, col_data, pos_info)
dds_intcp <- BiocGenerics::estimateSizeFactors(
dds_intcp[dds_intcp@rowRanges$genome == "K_lactis", ]
)
# Evaluate K. lactis-based size factors
size_factors <- dds_intcp$sizeFactor
# Save the size factors, etc. to object 'design' ---------
design[[sec_b]][[get_object_name(datasets)]] <- datasets
design[[sec_b]][["counts_metadata"]] <- t_hc_fig_1_5
design[[sec_b]][["metrics"]] <- m_hc[, colnames(m_hc) %in% c("feature", datasets)]
design[[sec_b]][["positional"]] <- pos_info
design[[sec_b]][[get_object_name(counts_data)]] <- counts_data
design[[sec_b]][[get_object_name(col_data)]] <- col_data
design[[sec_b]][[get_object_name(dds_intcp)]] <- dds_intcp
design[[sec_b]][[get_object_name(size_factors)]] <- size_factors
rm(datasets, t_hc_fig_1_5, counts_data, col_data, dds_intcp, size_factors)
# samples_fig_2 --------------------------------------------------------------
# Subset t_hc by relevant samples ------------------------
datasets <- samples_fig_2$keys
keep <- c(colnames(t_hc)[1:11], datasets)
t_hc_fig_2 <- t_hc[, colnames(t_hc) %in% keep]
rm(keep)
# Create a dds object ------------------------------------
counts_data <- t_hc_fig_2[, datasets] %>%
as.data.frame() %>%
sapply(., as.integer)
col_data <- make_col_data(samples_fig_2)
dds_intcp <- make_dds_model_intercept(counts_data, col_data, pos_info)
dds_intcp <- BiocGenerics::estimateSizeFactors(
dds_intcp[dds_intcp@rowRanges$genome == "K_lactis", ]
)
# Evaluate K. lactis-based size factors
size_factors <- dds_intcp$sizeFactor
# Determine pairwise combinations for DE analyses --------
exp_details <- list()
comb_num <- outer("r6-n", samples_fig_2$state, "paste") %>%
as.character() %>%
unique()
comb_denom <- outer("WT", samples_fig_2$state, "paste") %>%
as.character() %>%
unique()
comb_pairwise <- outer(comb_num, comb_denom, "paste")
table_models <- matrix(data = NA, nrow = 4, ncol = 4)
for(i in 1:ncol(comb_pairwise)) {
for(j in 1:ncol(comb_pairwise)) {
# i <- 1
# j <- 1
tbl_num <- samples_fig_2 %>%
dplyr::filter(
grepl(
paste0("^", unlist(stringr::str_split(comb_pairwise[i, j], " "))[1], "$"), strain
)
) %>%
dplyr::filter(
grepl(paste0("^", unlist(stringr::str_split(comb_pairwise[i, j], " "))[2], "$"), state)
) %>%
dplyr::select(keys, strain, state, technical)
tbl_denom <- samples_fig_2 %>%
dplyr::filter(
grepl(paste0("^", unlist(stringr::str_split(comb_pairwise[i, j], " "))[3], "$"), strain)
) %>%
dplyr::filter(
grepl(paste0("^", unlist(stringr::str_split(comb_pairwise[i, j], " "))[4], "$"), state)
) %>%
dplyr::select(keys, strain, state, technical)
# rstudio-pubs-static.s3.amazonaws.com/329027_593046fb6d7a427da6b2c538caf601e1.html
if(any(c(tbl_num$technical, tbl_denom$technical) %in% "tech2")) {
if(unique(tbl_num$state) == unique(tbl_denom$state)) {
table_models[i, j] <- "~ technical + strain"
} else {
table_models[i, j] <- "\'~ technical + strain + state\', \'~ technical + strain + state + strain:state\', \'~ technical + state + strain\', etc."
}
} else {
if(unique(tbl_num$state) == unique(tbl_denom$state)) {
table_models[i, j] <- "~ state"
} else {
table_models[i, j] <- "\'~ strain + state\', \'~ strain + state + strain:state\', \'~ state + strain\', etc."
}
}
exp_details[["numerator"]][[paste(i, "by", j)]] <- tbl_num
exp_details[["denominator"]][[paste(i, "by", j)]] <- tbl_denom
}
}
exp_details[["combinations"]] <- comb_pairwise
exp_details[["models"]] <- table_models
rm(comb_pairwise, tbl_num, tbl_denom, table_models, i, j)
# Save the size factors, etc. to object 'design' ---------
design[[sec_c]][[get_object_name(datasets)]] <- datasets
design[[sec_c]][["counts_metadata"]] <- t_hc_fig_2
design[[sec_c]][["metrics"]] <- m_hc[, colnames(m_hc) %in% c("feature", datasets)]
design[[sec_c]][["positional"]] <- pos_info
design[[sec_c]][[get_object_name(counts_data)]] <- counts_data
design[[sec_c]][[get_object_name(col_data)]] <- col_data
design[[sec_c]][[get_object_name(dds_intcp)]] <- dds_intcp
design[[sec_c]][[get_object_name(size_factors)]] <- size_factors
design[[sec_c]][[get_object_name(exp_details)]] <- exp_details
rm(
datasets, t_hc_fig_2, counts_data, col_data, dds_intcp, size_factors,
exp_details
)
#INPROGRESS #PICKUPHERE
# samples_fig_3 --------------------------------------------------------------
# Subset t_hc by relevant samples ------------------------
datasets <- samples_fig_3$keys
keep <- c(colnames(t_hc)[1:11], datasets)
t_hc_fig_3 <- t_hc[, colnames(t_hc) %in% keep]
rm(keep)
# Create a dds object ------------------------------------
counts_data <- t_hc_fig_3[, datasets] %>%
as.data.frame() %>%
sapply(., as.integer)
col_data <- make_col_data(samples_fig_3)
dds_intcp <- make_dds_model_intercept(counts_data, col_data, pos_info)
dds_intcp <- BiocGenerics::estimateSizeFactors(
dds_intcp[dds_intcp@rowRanges$genome == "K_lactis", ]
)
# Evaluate K. lactis-based size factors
size_factors <- dds_intcp$sizeFactor
# Determine pairwise combinations for DE analyses --------
exp_details <- list()
comb_num <- outer("r6-n", samples_fig_3$state, "paste") %>%
as.character() %>%
unique()
comb_denom <- outer("WT", samples_fig_3$state, "paste") %>%
as.character() %>%
unique()
comb_pairwise <- outer(comb_num, comb_denom, "paste")
table_models <- matrix(data = NA, nrow = 4, ncol = 4)
for(i in 1:ncol(comb_pairwise)) {
for(j in 1:ncol(comb_pairwise)) {
# i <- 1
# j <- 1
tbl_num <- samples_fig_3 %>%
dplyr::filter(
grepl(
paste0("^", unlist(stringr::str_split(comb_pairwise[i, j], " "))[1], "$"), strain
)
) %>%
dplyr::filter(
grepl(paste0("^", unlist(stringr::str_split(comb_pairwise[i, j], " "))[2], "$"), state)
) %>%
dplyr::select(keys, strain, state, technical)
tbl_denom <- samples_fig_3 %>%
dplyr::filter(
grepl(paste0("^", unlist(stringr::str_split(comb_pairwise[i, j], " "))[3], "$"), strain)
) %>%
dplyr::filter(
grepl(paste0("^", unlist(stringr::str_split(comb_pairwise[i, j], " "))[4], "$"), state)
) %>%
dplyr::select(keys, strain, state, technical)
# rstudio-pubs-static.s3.amazonaws.com/329027_593046fb6d7a427da6b2c538caf601e1.html
if(any(c(tbl_num$technical, tbl_denom$technical) %in% "tech2")) {
if(unique(tbl_num$state) == unique(tbl_denom$state)) {
table_models[i, j] <- "~ technical + strain"
} else {
table_models[i, j] <- "\'~ technical + strain + state\', \'~ technical + strain + state + strain:state\', \'~ technical + state + strain\', etc."
}
} else {
if(unique(tbl_num$state) == unique(tbl_denom$state)) {
table_models[i, j] <- "~ state"
} else {
table_models[i, j] <- "\'~ strain + state\', \'~ strain + state + strain:state\', \'~ state + strain\', etc."
}
}
exp_details[["numerator"]][[paste(i, "by", j)]] <- tbl_num
exp_details[["denominator"]][[paste(i, "by", j)]] <- tbl_denom
}
}
exp_details[["combinations"]] <- comb_pairwise
exp_details[["models"]] <- table_models
rm(comb_pairwise, tbl_num, tbl_denom, table_models, i, j)
# Save the size factors, etc. to object 'design' ---------
design[[sec_c]][[get_object_name(datasets)]] <- datasets
design[[sec_c]][["counts_metadata"]] <- t_hc_fig_3
design[[sec_c]][["metrics"]] <- m_hc[, colnames(m_hc) %in% c("feature", datasets)]
design[[sec_c]][["positional"]] <- pos_info
design[[sec_c]][[get_object_name(counts_data)]] <- counts_data
design[[sec_c]][[get_object_name(col_data)]] <- col_data
design[[sec_c]][[get_object_name(dds_intcp)]] <- dds_intcp
design[[sec_c]][[get_object_name(size_factors)]] <- size_factors
design[[sec_c]][[get_object_name(exp_details)]] <- exp_details
rm(
datasets, t_hc_fig_3, counts_data, col_data, dds_intcp, size_factors,
exp_details
)
# rm(design)
# rm(list = grep("samples_fig", names(.GlobalEnv), value = TRUE))