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 3f764ee. 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/

Untracked files:
    Untracked:  data/Count_matrix2.csv

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 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

1️⃣ 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

πŸ“Œ 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)

# βœ… 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