I have checked DEGs between Solvent Control (SC) of FP and LP and there are noticebale differences in terms of DEGs.
# Checking SC in FP and LP
# Read featureCounts table
counts = read.table("counts.txt", header=TRUE, sep="\t", row.names=1)
# Metadata
targets = data.frame(ID = c("YHDAA","YHDAB","YHDAC","YHDAD","YHDAE","YHDAF","YHDAG","YHDAH"),
Name = c("FP_SC_T1","FP_T1","FP_SC_T2","FP_T2", "LP_SC_T1","LP_T1","LP_SC_T2","LP_T2"),
phase = c("FP","FP","FP","FP","LP","LP","LP","LP"),
Group = c("FP_SC","FP","FP_SC","FP","LP_SC","LP","LP_SC","LP"),
condition = c("SC","Treated","SC","Treated","SC","Treated","SC","Treated"))
#converting 'NA' values to 0
counts[is.na(counts)] <- 0
#make sample_info and counts in same order
counts = counts[, targets$ID]
# Remove genes with 0 counts
keep_genes <- rowSums(counts(dds)) > 0
dds <- dds[ keep_genes, ]
# genes to have more than a sum total of 10 reads of support in all samples
dds = dds[rowSums(counts(dds)) > 10, ]
dds = DESeq(dds, betaPrior=FALSE, parallel=TRUE, BPPARAM=SnowParam(5))
res = results(dds, contrast = c("Group", "FP_SC", "LP_SC"), parallel = TRUE)
This has identified quite a good number of DEGs.
Next approach,
#D ESeq2 object with interaction design
dds = DESeqDataSetFromMatrix(countData = counts, colData = sample_info, design = ~ phase * condition)
# Equivalent to: ~ phase + condition + phase:condition
How do I calculate the res here by negating the SC effect?
res <- results(dds, name = "phaseLP.conditionTreated")