Last updated: 2025-02-06

Checks: 7 0

Knit directory: CX5461_Project/

This reproducible R Markdown analysis was created with workflowr (version 1.7.1). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20250129) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 8bfc319. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .RData
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/

Note that any generated files, e.g.Β HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/DGE_Analysis.Rmd) and HTML (docs/DGE_Analysis.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd 8bfc319 sayanpaul01 2025-02-06 wflow_publish("analysis/DGE_Analysis.Rmd")
html 12a9a6b sayanpaul01 2025-02-06 Build site.
Rmd eebe7d2 sayanpaul01 2025-02-06 wflow_publish("analysis/DGE_Analysis.Rmd")
html 1ab310a sayanpaul01 2025-02-06 Build site.
Rmd 4306834 sayanpaul01 2025-02-06 Added mean-variance trend plot
html f59d02b sayanpaul01 2025-02-06 Build site.
Rmd 3f764ee sayanpaul01 2025-02-06 Added DGE Analysis with structured chunks
html d6850ef sayanpaul01 2025-02-06 Build site.
Rmd d31730d sayanpaul01 2025-02-06 Added DGE Analysis with structured chunks

πŸ“Œ Differential Gene Expression Analysis

πŸ“Œ Load Required Libraries

# Load necessary packages
library(edgeR)
Warning: package 'edgeR' was built under R version 4.3.1
Warning: package 'limma' was built under R version 4.3.1
library(limma)
library(data.table)
Warning: package 'data.table' was built under R version 4.3.2
library(tidyverse)
Warning: package 'tidyverse' was built under R version 4.3.2
Warning: package 'ggplot2' was built under R version 4.3.3
Warning: package 'tidyr' was built under R version 4.3.3
Warning: package 'readr' was built under R version 4.3.3
Warning: package 'purrr' was built under R version 4.3.1
Warning: package 'dplyr' was built under R version 4.3.2
Warning: package 'stringr' was built under R version 4.3.2
Warning: package 'lubridate' was built under R version 4.3.1
library(ggplot2)
library(dplyr)
library(scales)
Warning: package 'scales' was built under R version 4.3.2
library(biomaRt)
Warning: package 'biomaRt' was built under R version 4.3.2
library(Homo.sapiens)
Warning: package 'AnnotationDbi' was built under R version 4.3.2
Warning: package 'BiocGenerics' was built under R version 4.3.1
Warning: package 'Biobase' was built under R version 4.3.1
Warning: package 'IRanges' was built under R version 4.3.1
Warning: package 'S4Vectors' was built under R version 4.3.1
Warning: package 'OrganismDbi' was built under R version 4.3.1
Warning: package 'GenomicFeatures' was built under R version 4.3.3
Warning: package 'GenomeInfoDb' was built under R version 4.3.3
Warning: package 'GenomicRanges' was built under R version 4.3.1

πŸ“ Load Data

πŸ“Œ Normalize and Filter Counts

πŸ“Œ Prepare DGEList Object

# Subset count matrix based on filtered CPM matrix
x <- counts_matrix[row.names(filcpm_matrix),]
dim(x)
[1] 14279   108
# Modify Metadata
Metadata_2 <- Metadata
rownames(Metadata_2) <- Metadata_2$Sample_bam
colnames(x) <- Metadata_2$Sample_ID
rownames(Metadata_2) <- Metadata_2$Sample_ID

Metadata_2$Drug_time <- make.names(Metadata_2$Drug_time)
Metadata_2$Ind <- as.character(Metadata_2$Ind)

# βœ… Create DGEList object
dge <- DGEList(counts = x)
dge$samples$group <- factor(Metadata_2$Drug_time)
dge <- calcNormFactors(dge, method = "TMM")

# βœ… Check normalization factors
dge$samples
                             group lib.size norm.factors
CX-5461_0.1_3_17-3   CX.5461_0.1_3 21200035    1.0102693
DOX_0.5_24_17-3         DOX_0.5_24 16563771    1.1076182
DOX_0.5_24_87-1         DOX_0.5_24 21656653    0.9933568
VEH_0.1_24_87-1         VEH_0.1_24 22426842    0.9766783
VEH_0.5_24_87-1         VEH_0.5_24 22162275    0.9924549
CX-5461_0.1_48_87-1 CX.5461_0.1_48 22187620    0.9683497
CX-5461_0.5_48_87-1 CX.5461_0.5_48 20782167    0.9814665
DOX_0.1_48_87-1         DOX_0.1_48 25382841    1.0011030
DOX_0.5_48_87-1         DOX_0.5_48 19863531    1.0541528
VEH_0.1_48_87-1         VEH_0.1_48 21473253    1.0138011
VEH_0.5_48_87-1         VEH_0.5_48 20337337    1.0219756
VEH_0.1_24_17-3         VEH_0.1_24 15750538    0.9952313
VEH_0.5_24_17-3         VEH_0.5_24 15638967    1.0367909
CX-5461_0.1_48_17-3 CX.5461_0.1_48 18465522    0.9543636
CX-5461_0.5_48_17-3 CX.5461_0.5_48 16876134    0.9636074
DOX_0.1_48_17-3         DOX_0.1_48 20609601    0.9839708
DOX_0.5_48_17-3         DOX_0.5_48 18829944    1.1876478
VEH_0.1_48_17-3         VEH_0.1_48 24712537    0.9804184
VEH_0.5_48_17-3         VEH_0.5_48 17006648    0.9707617
CX-5461_0.1_3_84-1   CX.5461_0.1_3 17178171    1.0219387
CX-5461_0.5_3_17-3   CX.5461_0.5_3 17694385    1.0103837
CX-5461_0.5_3_84-1   CX.5461_0.5_3 17261114    1.0060170
DOX_0.1_3_84-1           DOX_0.1_3 17352493    0.9911466
DOX_0.5_3_84-1           DOX_0.5_3 17757477    1.0034479
VEH_0.1_3_84-1           VEH_0.1_3 19305213    1.0354377
VEH_0.5_3_84-1           VEH_0.5_3 17297185    1.0285524
CX-5461_0.1_24_84-1 CX.5461_0.1_24 23860498    0.9857321
CX-5461_0.5_24_84-1 CX.5461_0.5_24 19482159    0.9638391
DOX_0.1_24_84-1         DOX_0.1_24 19659504    0.9565317
DOX_0.5_24_84-1         DOX_0.5_24 17875612    1.0212021
VEH_0.1_24_84-1         VEH_0.1_24 16449210    0.9998393
DOX_0.1_3_17-3           DOX_0.1_3 16400599    0.9962197
VEH_0.5_24_84-1         VEH_0.5_24 18783630    0.9616033
CX-5461_0.1_48_84-1 CX.5461_0.1_48 13781326    0.9400278
CX-5461_0.5_48_84-1 CX.5461_0.5_48 20232591    0.9563694
DOX_0.1_48_84-1         DOX_0.1_48 16028063    0.9651474
DOX_0.5_48_84-1         DOX_0.5_48 16269098    1.0652791
VEH_0.1_48_84-1         VEH_0.1_48 15276408    0.9612979
VEH_0.5_48_84-1         VEH_0.5_48 17447290    1.0050272
CX-5461_0.1_3_90-1   CX.5461_0.1_3 15807726    0.9991915
CX-5461_0.5_3_90-1   CX.5461_0.5_3 17946649    0.9956913
DOX_0.1_3_90-1           DOX_0.1_3 20294777    0.9830679
DOX_0.5_3_17-3           DOX_0.5_3 18191217    0.9080939
DOX_0.5_3_90-1           DOX_0.5_3 20699125    0.9833929
VEH_0.1_3_90-1           VEH_0.1_3 20027541    0.9953796
VEH_0.5_3_90-1           VEH_0.5_3 17833214    1.0003025
CX-5461_0.1_24_90-1 CX.5461_0.1_24 15094639    1.0102577
CX-5461_0.5_24_90-1 CX.5461_0.5_24 17758047    1.0114258
DOX_0.1_24_90-1         DOX_0.1_24 16921727    0.9900805
DOX_0.5_24_90-1         DOX_0.5_24 19271264    1.0068767
VEH_0.1_24_90-1         VEH_0.1_24 20601703    0.9898691
VEH_0.5_24_90-1         VEH_0.5_24 19875553    1.0060950
CX-5461_0.1_48_90-1 CX.5461_0.1_48 23817456    1.0255425
VEH_0.1_3_17-3           VEH_0.1_3 26353255    0.9919794
CX-5461_0.5_48_90-1 CX.5461_0.5_48 18651093    1.0370010
DOX_0.1_48_90-1         DOX_0.1_48 17767662    1.0233343
DOX_0.5_48_90-1         DOX_0.5_48 20031141    1.1189284
VEH_0.1_48_90-1         VEH_0.1_48 19523120    1.0484497
VEH_0.5_48_90-1         VEH_0.5_48 17657193    1.0550052
CX-5461_0.1_3_75-1   CX.5461_0.1_3 20046785    0.9894881
CX-5461_0.5_3_75-1   CX.5461_0.5_3 19885297    0.9767025
DOX_0.1_3_75-1           DOX_0.1_3 18575114    0.9755788
DOX_0.5_3_75-1           DOX_0.5_3 15260497    0.9562336
VEH_0.1_3_75-1           VEH_0.1_3 19040007    0.9839769
VEH_0.5_3_17-3           VEH_0.5_3 18217503    0.9735069
VEH_0.5_3_75-1           VEH_0.5_3 21311999    0.9663251
CX-5461_0.1_24_75-1 CX.5461_0.1_24 19256517    1.0184093
CX-5461_0.5_24_75-1 CX.5461_0.5_24 14304255    1.0186309
DOX_0.1_24_75-1         DOX_0.1_24 21875105    1.0386302
DOX_0.5_24_75-1         DOX_0.5_24 17032433    0.9686987
VEH_0.1_24_75-1         VEH_0.1_24 19796422    1.0295019
VEH_0.5_24_75-1         VEH_0.5_24 21524523    1.0376940
CX-5461_0.1_48_75-1 CX.5461_0.1_48 20955873    0.9752971
CX-5461_0.5_48_75-1 CX.5461_0.5_48 19924867    0.9768371
DOX_0.1_48_75-1         DOX_0.1_48 17698471    1.0369925
CX-5461_0.1_24_17-3 CX.5461_0.1_24 18239213    0.9808618
DOX_0.5_48_75-1         DOX_0.5_48 15422887    1.0296304
VEH_0.1_48_75-1         VEH_0.1_48 21014387    1.0100812
VEH_0.5_48_75-1         VEH_0.5_48 21346438    1.0015670
CX-5461_0.1_3_78-1   CX.5461_0.1_3 20824890    0.9686975
CX-5461_0.5_3_78-1   CX.5461_0.5_3 19425405    1.0100551
DOX_0.1_3_78-1           DOX_0.1_3 18950843    0.9933529
DOX_0.5_3_78-1           DOX_0.5_3 21654404    0.9808038
VEH_0.1_3_78-1           VEH_0.1_3 20054872    0.9802655
VEH_0.5_3_78-1           VEH_0.5_3 17661233    1.0220629
CX-5461_0.1_24_78-1 CX.5461_0.1_24 16754941    0.9785599
CX-5461_0.5_24_17-3 CX.5461_0.5_24 16014473    1.0010257
CX-5461_0.5_24_78-1 CX.5461_0.5_24 16077548    0.9819166
DOX_0.1_24_78-1         DOX_0.1_24 27842910    0.9788383
DOX_0.5_24_78-1         DOX_0.5_24  6326261    1.0007627
VEH_0.1_24_78-1         VEH_0.1_24 18032196    0.9767098
VEH_0.5_24_78-1         VEH_0.5_24 18727398    0.9931695
CX-5461_0.1_48_78-1 CX.5461_0.1_48 21292146    1.0036183
CX-5461_0.5_48_78-1 CX.5461_0.5_48 18392707    0.9988905
DOX_0.1_48_78-1         DOX_0.1_48 18735925    1.0433629
DOX_0.5_48_78-1         DOX_0.5_48 16079343    1.1063695
VEH_0.1_48_78-1         VEH_0.1_48 20500742    1.0149206
DOX_0.1_24_17-3         DOX_0.1_24 23900805    1.0243090
VEH_0.5_48_78-1         VEH_0.5_48 18433692    1.0396358
CX-5461_0.1_3_87-1   CX.5461_0.1_3 19664754    0.9573708
CX-5461_0.5_3_87-1   CX.5461_0.5_3 21451819    1.0192062
DOX_0.1_3_87-1           DOX_0.1_3 20624889    0.9539861
DOX_0.5_3_87-1           DOX_0.5_3 22838835    0.9919424
VEH_0.1_3_87-1           VEH_0.1_3 17616767    0.9841881
VEH_0.5_3_87-1           VEH_0.5_3 22148086    1.0203028
CX-5461_0.1_24_87-1 CX.5461_0.1_24 30093416    0.9439250
CX-5461_0.5_24_87-1 CX.5461_0.5_24 22093483    0.9589794
DOX_0.1_24_87-1         DOX_0.1_24 21415578    0.9549937

πŸ“Œ Create Design Matrix

# βœ… Create Design Matrix
design <- model.matrix(~ 0 + Metadata_2$Drug_time)
colnames(design) <- gsub("Metadata_2\\$Drug_time", "", colnames(design))
design
    CX.5461_0.1_24 CX.5461_0.1_3 CX.5461_0.1_48 CX.5461_0.5_24 CX.5461_0.5_3
1                0             1              0              0             0
2                0             0              0              0             0
3                0             0              0              0             0
4                0             0              0              0             0
5                0             0              0              0             0
6                0             0              1              0             0
7                0             0              0              0             0
8                0             0              0              0             0
9                0             0              0              0             0
10               0             0              0              0             0
11               0             0              0              0             0
12               0             0              0              0             0
13               0             0              0              0             0
14               0             0              1              0             0
15               0             0              0              0             0
16               0             0              0              0             0
17               0             0              0              0             0
18               0             0              0              0             0
19               0             0              0              0             0
20               0             1              0              0             0
21               0             0              0              0             1
22               0             0              0              0             1
23               0             0              0              0             0
24               0             0              0              0             0
25               0             0              0              0             0
26               0             0              0              0             0
27               1             0              0              0             0
28               0             0              0              1             0
29               0             0              0              0             0
30               0             0              0              0             0
31               0             0              0              0             0
32               0             0              0              0             0
33               0             0              0              0             0
34               0             0              1              0             0
35               0             0              0              0             0
36               0             0              0              0             0
37               0             0              0              0             0
38               0             0              0              0             0
39               0             0              0              0             0
40               0             1              0              0             0
41               0             0              0              0             1
42               0             0              0              0             0
43               0             0              0              0             0
44               0             0              0              0             0
45               0             0              0              0             0
46               0             0              0              0             0
47               1             0              0              0             0
48               0             0              0              1             0
49               0             0              0              0             0
50               0             0              0              0             0
51               0             0              0              0             0
52               0             0              0              0             0
53               0             0              1              0             0
54               0             0              0              0             0
55               0             0              0              0             0
56               0             0              0              0             0
57               0             0              0              0             0
58               0             0              0              0             0
59               0             0              0              0             0
60               0             1              0              0             0
61               0             0              0              0             1
62               0             0              0              0             0
63               0             0              0              0             0
64               0             0              0              0             0
65               0             0              0              0             0
66               0             0              0              0             0
67               1             0              0              0             0
68               0             0              0              1             0
69               0             0              0              0             0
70               0             0              0              0             0
71               0             0              0              0             0
72               0             0              0              0             0
73               0             0              1              0             0
74               0             0              0              0             0
75               0             0              0              0             0
76               1             0              0              0             0
77               0             0              0              0             0
78               0             0              0              0             0
79               0             0              0              0             0
80               0             1              0              0             0
81               0             0              0              0             1
82               0             0              0              0             0
83               0             0              0              0             0
84               0             0              0              0             0
85               0             0              0              0             0
86               1             0              0              0             0
87               0             0              0              1             0
88               0             0              0              1             0
89               0             0              0              0             0
90               0             0              0              0             0
91               0             0              0              0             0
92               0             0              0              0             0
93               0             0              1              0             0
94               0             0              0              0             0
95               0             0              0              0             0
96               0             0              0              0             0
97               0             0              0              0             0
98               0             0              0              0             0
99               0             0              0              0             0
100              0             1              0              0             0
101              0             0              0              0             1
102              0             0              0              0             0
103              0             0              0              0             0
104              0             0              0              0             0
105              0             0              0              0             0
106              1             0              0              0             0
107              0             0              0              1             0
108              0             0              0              0             0
    CX.5461_0.5_48 DOX_0.1_24 DOX_0.1_3 DOX_0.1_48 DOX_0.5_24 DOX_0.5_3
1                0          0         0          0          0         0
2                0          0         0          0          1         0
3                0          0         0          0          1         0
4                0          0         0          0          0         0
5                0          0         0          0          0         0
6                0          0         0          0          0         0
7                1          0         0          0          0         0
8                0          0         0          1          0         0
9                0          0         0          0          0         0
10               0          0         0          0          0         0
11               0          0         0          0          0         0
12               0          0         0          0          0         0
13               0          0         0          0          0         0
14               0          0         0          0          0         0
15               1          0         0          0          0         0
16               0          0         0          1          0         0
17               0          0         0          0          0         0
18               0          0         0          0          0         0
19               0          0         0          0          0         0
20               0          0         0          0          0         0
21               0          0         0          0          0         0
22               0          0         0          0          0         0
23               0          0         1          0          0         0
24               0          0         0          0          0         1
25               0          0         0          0          0         0
26               0          0         0          0          0         0
27               0          0         0          0          0         0
28               0          0         0          0          0         0
29               0          1         0          0          0         0
30               0          0         0          0          1         0
31               0          0         0          0          0         0
32               0          0         1          0          0         0
33               0          0         0          0          0         0
34               0          0         0          0          0         0
35               1          0         0          0          0         0
36               0          0         0          1          0         0
37               0          0         0          0          0         0
38               0          0         0          0          0         0
39               0          0         0          0          0         0
40               0          0         0          0          0         0
41               0          0         0          0          0         0
42               0          0         1          0          0         0
43               0          0         0          0          0         1
44               0          0         0          0          0         1
45               0          0         0          0          0         0
46               0          0         0          0          0         0
47               0          0         0          0          0         0
48               0          0         0          0          0         0
49               0          1         0          0          0         0
50               0          0         0          0          1         0
51               0          0         0          0          0         0
52               0          0         0          0          0         0
53               0          0         0          0          0         0
54               0          0         0          0          0         0
55               1          0         0          0          0         0
56               0          0         0          1          0         0
57               0          0         0          0          0         0
58               0          0         0          0          0         0
59               0          0         0          0          0         0
60               0          0         0          0          0         0
61               0          0         0          0          0         0
62               0          0         1          0          0         0
63               0          0         0          0          0         1
64               0          0         0          0          0         0
65               0          0         0          0          0         0
66               0          0         0          0          0         0
67               0          0         0          0          0         0
68               0          0         0          0          0         0
69               0          1         0          0          0         0
70               0          0         0          0          1         0
71               0          0         0          0          0         0
72               0          0         0          0          0         0
73               0          0         0          0          0         0
74               1          0         0          0          0         0
75               0          0         0          1          0         0
76               0          0         0          0          0         0
77               0          0         0          0          0         0
78               0          0         0          0          0         0
79               0          0         0          0          0         0
80               0          0         0          0          0         0
81               0          0         0          0          0         0
82               0          0         1          0          0         0
83               0          0         0          0          0         1
84               0          0         0          0          0         0
85               0          0         0          0          0         0
86               0          0         0          0          0         0
87               0          0         0          0          0         0
88               0          0         0          0          0         0
89               0          1         0          0          0         0
90               0          0         0          0          1         0
91               0          0         0          0          0         0
92               0          0         0          0          0         0
93               0          0         0          0          0         0
94               1          0         0          0          0         0
95               0          0         0          1          0         0
96               0          0         0          0          0         0
97               0          0         0          0          0         0
98               0          1         0          0          0         0
99               0          0         0          0          0         0
100              0          0         0          0          0         0
101              0          0         0          0          0         0
102              0          0         1          0          0         0
103              0          0         0          0          0         1
104              0          0         0          0          0         0
105              0          0         0          0          0         0
106              0          0         0          0          0         0
107              0          0         0          0          0         0
108              0          1         0          0          0         0
    DOX_0.5_48 VEH_0.1_24 VEH_0.1_3 VEH_0.1_48 VEH_0.5_24 VEH_0.5_3 VEH_0.5_48
1            0          0         0          0          0         0          0
2            0          0         0          0          0         0          0
3            0          0         0          0          0         0          0
4            0          1         0          0          0         0          0
5            0          0         0          0          1         0          0
6            0          0         0          0          0         0          0
7            0          0         0          0          0         0          0
8            0          0         0          0          0         0          0
9            1          0         0          0          0         0          0
10           0          0         0          1          0         0          0
11           0          0         0          0          0         0          1
12           0          1         0          0          0         0          0
13           0          0         0          0          1         0          0
14           0          0         0          0          0         0          0
15           0          0         0          0          0         0          0
16           0          0         0          0          0         0          0
17           1          0         0          0          0         0          0
18           0          0         0          1          0         0          0
19           0          0         0          0          0         0          1
20           0          0         0          0          0         0          0
21           0          0         0          0          0         0          0
22           0          0         0          0          0         0          0
23           0          0         0          0          0         0          0
24           0          0         0          0          0         0          0
25           0          0         1          0          0         0          0
26           0          0         0          0          0         1          0
27           0          0         0          0          0         0          0
28           0          0         0          0          0         0          0
29           0          0         0          0          0         0          0
30           0          0         0          0          0         0          0
31           0          1         0          0          0         0          0
32           0          0         0          0          0         0          0
33           0          0         0          0          1         0          0
34           0          0         0          0          0         0          0
35           0          0         0          0          0         0          0
36           0          0         0          0          0         0          0
37           1          0         0          0          0         0          0
38           0          0         0          1          0         0          0
39           0          0         0          0          0         0          1
40           0          0         0          0          0         0          0
41           0          0         0          0          0         0          0
42           0          0         0          0          0         0          0
43           0          0         0          0          0         0          0
44           0          0         0          0          0         0          0
45           0          0         1          0          0         0          0
46           0          0         0          0          0         1          0
47           0          0         0          0          0         0          0
48           0          0         0          0          0         0          0
49           0          0         0          0          0         0          0
50           0          0         0          0          0         0          0
51           0          1         0          0          0         0          0
52           0          0         0          0          1         0          0
53           0          0         0          0          0         0          0
54           0          0         1          0          0         0          0
55           0          0         0          0          0         0          0
56           0          0         0          0          0         0          0
57           1          0         0          0          0         0          0
58           0          0         0          1          0         0          0
59           0          0         0          0          0         0          1
60           0          0         0          0          0         0          0
61           0          0         0          0          0         0          0
62           0          0         0          0          0         0          0
63           0          0         0          0          0         0          0
64           0          0         1          0          0         0          0
65           0          0         0          0          0         1          0
66           0          0         0          0          0         1          0
67           0          0         0          0          0         0          0
68           0          0         0          0          0         0          0
69           0          0         0          0          0         0          0
70           0          0         0          0          0         0          0
71           0          1         0          0          0         0          0
72           0          0         0          0          1         0          0
73           0          0         0          0          0         0          0
74           0          0         0          0          0         0          0
75           0          0         0          0          0         0          0
76           0          0         0          0          0         0          0
77           1          0         0          0          0         0          0
78           0          0         0          1          0         0          0
79           0          0         0          0          0         0          1
80           0          0         0          0          0         0          0
81           0          0         0          0          0         0          0
82           0          0         0          0          0         0          0
83           0          0         0          0          0         0          0
84           0          0         1          0          0         0          0
85           0          0         0          0          0         1          0
86           0          0         0          0          0         0          0
87           0          0         0          0          0         0          0
88           0          0         0          0          0         0          0
89           0          0         0          0          0         0          0
90           0          0         0          0          0         0          0
91           0          1         0          0          0         0          0
92           0          0         0          0          1         0          0
93           0          0         0          0          0         0          0
94           0          0         0          0          0         0          0
95           0          0         0          0          0         0          0
96           1          0         0          0          0         0          0
97           0          0         0          1          0         0          0
98           0          0         0          0          0         0          0
99           0          0         0          0          0         0          1
100          0          0         0          0          0         0          0
101          0          0         0          0          0         0          0
102          0          0         0          0          0         0          0
103          0          0         0          0          0         0          0
104          0          0         1          0          0         0          0
105          0          0         0          0          0         1          0
106          0          0         0          0          0         0          0
107          0          0         0          0          0         0          0
108          0          0         0          0          0         0          0
attr(,"assign")
 [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
attr(,"contrasts")
attr(,"contrasts")$`Metadata_2$Drug_time`
[1] "contr.treatment"

πŸ“Œ Voom Transformation and Linear Modeling

# βœ… Duplicate Correlation for Individual Effect
corfit <- duplicateCorrelation(object = dge$counts, design = design, block = Metadata_2$Ind)

# βœ… Voom Transformation
v <- voom(dge, design, block = Metadata_2$Ind, correlation = corfit$consensus.correlation, plot = TRUE)

Version Author Date
d6850ef sayanpaul01 2025-02-06
# βœ… Fit Linear Model
fit <- lmFit(v, design, block = Metadata_2$Ind, correlation = corfit$consensus.correlation)

πŸ“Œ Create Contrast Matrix

contrast_matrix <- makeContrasts(
  CX_0.1_3vsVEH_0.1_3 = CX.5461_0.1_3 - VEH_0.1_3,
  CX_0.1_24vsVEH_0.1_24 = CX.5461_0.1_24 - VEH_0.1_24,
  CX_0.1_48vsVEH_0.1_48 = CX.5461_0.1_48 - VEH_0.1_48,
  CX_0.5_3vsVEH_0.5_3 = CX.5461_0.5_3 - VEH_0.5_3,
  CX_0.5_24vsVEH_0.5_24 = CX.5461_0.5_24 - VEH_0.5_24,
  CX_0.5_48vsVEH_0.5_48 = CX.5461_0.5_48 - VEH_0.5_48,
  DOX_0.1_3vsVEH_0.1_3 = DOX_0.1_3 - VEH_0.1_3,
  DOX_0.1_24vsVEH_0.1_24 = DOX_0.1_24 - VEH_0.1_24,
  DOX_0.1_48vsVEH_0.1_48 = DOX_0.1_48 - VEH_0.1_48,
  DOX_0.5_3vsVEH_0.5_3 = DOX_0.5_3 - VEH_0.5_3,
  DOX_0.5_24vsVEH_0.5_24 = DOX_0.5_24 - VEH_0.5_24,
  DOX_0.5_48vsVEH_0.5_48 = DOX_0.5_48 - VEH_0.5_48,
  levels = design
)

πŸ“Œ Fit Model and Generate Results

# βœ… Apply Contrasts
fit2 <- contrasts.fit(fit, contrast_matrix)
fit2 <- eBayes(fit2)

πŸ“Œ Mean-Variance Trend Plot

# Plot Mean-Variance Trend
plotSA(fit2, main = "Final model: Mean-Variance trend")

Version Author Date
1ab310a sayanpaul01 2025-02-06

πŸ“ŒSummary of Results

# βœ… Summary of Results
results_summary <- decideTests(fit2, adjust.method = "BH", p.value = 0.05)
summary(results_summary)
       CX_0.1_3vsVEH_0.1_3 CX_0.1_24vsVEH_0.1_24 CX_0.1_48vsVEH_0.1_48
Down                     0                   204                   294
NotSig               14278                 14074                 13961
Up                       1                     1                    24
       CX_0.5_3vsVEH_0.5_3 CX_0.5_24vsVEH_0.5_24 CX_0.5_48vsVEH_0.5_48
Down                     1                   259                   337
NotSig               14277                 14001                 13909
Up                       1                    19                    33
       DOX_0.1_3vsVEH_0.1_3 DOX_0.1_24vsVEH_0.1_24 DOX_0.1_48vsVEH_0.1_48
Down                      1                   2528                   1696
NotSig                14277                   9215                  10818
Up                        1                   2536                   1765
       DOX_0.5_3vsVEH_0.5_3 DOX_0.5_24vsVEH_0.5_24 DOX_0.5_48vsVEH_0.5_48
Down                    476                   5067                   5177
NotSig                13746                   4451                   4151
Up                       57                   4761                   4951

sessionInfo()
R version 4.3.0 (2023-04-21 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 11 x64 (build 22631)

Matrix products: default


locale:
[1] LC_COLLATE=English_United States.utf8 
[2] LC_CTYPE=English_United States.utf8   
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.utf8    

time zone: America/Chicago
tzcode source: internal

attached base packages:
[1] stats4    stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
 [1] Homo.sapiens_1.3.1                     
 [2] TxDb.Hsapiens.UCSC.hg19.knownGene_3.2.2
 [3] org.Hs.eg.db_3.18.0                    
 [4] GO.db_3.18.0                           
 [5] OrganismDbi_1.44.0                     
 [6] GenomicFeatures_1.54.4                 
 [7] GenomicRanges_1.54.1                   
 [8] GenomeInfoDb_1.38.8                    
 [9] AnnotationDbi_1.64.1                   
[10] IRanges_2.36.0                         
[11] S4Vectors_0.40.1                       
[12] Biobase_2.62.0                         
[13] BiocGenerics_0.48.1                    
[14] biomaRt_2.58.2                         
[15] scales_1.3.0                           
[16] lubridate_1.9.3                        
[17] forcats_1.0.0                          
[18] stringr_1.5.1                          
[19] dplyr_1.1.4                            
[20] purrr_1.0.2                            
[21] readr_2.1.5                            
[22] tidyr_1.3.1                            
[23] tibble_3.2.1                           
[24] ggplot2_3.5.1                          
[25] tidyverse_2.0.0                        
[26] data.table_1.14.10                     
[27] edgeR_4.0.1                            
[28] limma_3.58.1                           
[29] workflowr_1.7.1                        

loaded via a namespace (and not attached):
 [1] DBI_1.2.3                   bitops_1.0-7               
 [3] RBGL_1.78.0                 rlang_1.1.3                
 [5] magrittr_2.0.3              git2r_0.35.0               
 [7] matrixStats_1.4.1           compiler_4.3.0             
 [9] RSQLite_2.3.3               getPass_0.2-4              
[11] png_0.1-8                   callr_3.7.6                
[13] vctrs_0.6.5                 pkgconfig_2.0.3            
[15] crayon_1.5.3                fastmap_1.1.1              
[17] dbplyr_2.5.0                XVector_0.42.0             
[19] Rsamtools_2.18.0            promises_1.3.0             
[21] rmarkdown_2.29              tzdb_0.4.0                 
[23] graph_1.80.0                ps_1.8.1                   
[25] bit_4.0.5                   xfun_0.50                  
[27] zlibbioc_1.48.0             cachem_1.0.8               
[29] jsonlite_1.8.9              progress_1.2.3             
[31] blob_1.2.4                  later_1.3.2                
[33] DelayedArray_0.28.0         BiocParallel_1.36.0        
[35] parallel_4.3.0              prettyunits_1.2.0          
[37] R6_2.5.1                    bslib_0.8.0                
[39] stringi_1.8.3               rtracklayer_1.62.0         
[41] jquerylib_0.1.4             SummarizedExperiment_1.32.0
[43] Rcpp_1.0.12                 knitr_1.49                 
[45] Matrix_1.6-1.1              httpuv_1.6.15              
[47] timechange_0.3.0            tidyselect_1.2.1           
[49] abind_1.4-8                 rstudioapi_0.17.1          
[51] yaml_2.3.10                 codetools_0.2-20           
[53] curl_6.0.1                  processx_3.8.5             
[55] lattice_0.22-5              withr_3.0.2                
[57] KEGGREST_1.42.0             evaluate_1.0.3             
[59] BiocFileCache_2.10.2        xml2_1.3.6                 
[61] Biostrings_2.70.1           BiocManager_1.30.25        
[63] pillar_1.10.1               filelock_1.0.3             
[65] MatrixGenerics_1.14.0       whisker_0.4.1              
[67] generics_0.1.3              rprojroot_2.0.4            
[69] RCurl_1.98-1.13             hms_1.1.3                  
[71] munsell_0.5.1               glue_1.7.0                 
[73] tools_4.3.0                 BiocIO_1.12.0              
[75] locfit_1.5-9.8              GenomicAlignments_1.38.2   
[77] fs_1.6.3                    XML_3.99-0.17              
[79] grid_4.3.0                  colorspace_2.1-0           
[81] GenomeInfoDbData_1.2.11     restfulr_0.0.15            
[83] cli_3.6.1                   rappdirs_0.3.3             
[85] S4Arrays_1.2.1              gtable_0.3.6               
[87] sass_0.4.9                  digest_0.6.34              
[89] SparseArray_1.2.4           rjson_0.2.23               
[91] memoise_2.0.1               htmltools_0.5.8.1          
[93] lifecycle_1.0.4             httr_1.4.7                 
[95] statmod_1.5.0               bit64_4.0.5