I'm running DESeq2 on a small RNA seq experiment. The coldata has 87 samples total and begins like this:
Sample |
BMI |
Diagnosis |
Particle |
1 |
Obese |
PCOS |
MP |
10 |
Obese |
PCOS |
MP |
11 |
Obese |
PCOS |
EV |
12 |
Obese |
PCOS |
FFD |
14 |
Obese |
PCOS |
MP |
15 |
Obese |
PCOS |
EV |
16 |
Obese |
PCOS |
FFD |
18 |
Lean |
PCOS |
MP |
19 |
Lean |
PCOS |
EV |
2 |
Obese |
PCOS |
EV |
20 |
Lean |
PCOS |
FFD |
21 |
Lean |
PCOS |
MP |
22 |
Lean |
PCOS |
EV |
23 |
Lean |
PCOS |
FFD |
24 |
Lean |
PCOS |
MP |
25 |
Lean |
PCOS |
EV |
26 |
Lean |
PCOS |
FFD |
27 |
Lean |
PCOS |
MP |
28 |
Lean |
PCOS |
EV |
29 |
Lean |
PCOS |
FFD |
3 |
Obese |
PCOS |
FFD |
My two main comparisons, Lean vs Obese and PCOS vs non-PCOS work fine, which I can summarize with this:
dds <- DESeqDataSetFromMatrix(countData = cts_df_ordered, colData = coldata_ordered_trim, design = ~ Particle + BMI + Diagnosis) dds$Diagnosis <- factor(dds$Diagnosis, levels = c("PCOS","non-PCOS")) dds$BMI <- factor(dds$BMI, levels = c("Lean","Obese")) dds$Particle <- factor(dds$Particle, levels = c("MP","FFD","EV")) dds <- DESeq(dds) resDIAG <- results(dds) resresOrdered <- resDIAG[order(resDIAG$pvalue),] summary(resDIAG) sum(resDIAG$padj < 0.05, na.rm=TRUE) resBMI <- results(dds, contrast=c("BMI","Lean","Obese")) summary(resBMI) sum(resBMI$padj < 0.05, na.rm=TRUE)
Then I tried to subset the dds to make these same two comparisons but within each particle, starting with MP:
dds_MP <- dds[, dds$Particle %in% c("MP")] dds_MP$Particle <- droplevels(dds_MP$Particle) dds_MP <- DESeq(dds_MP)
Giving the error:
using pre-existing size factors estimating dispersions found already estimated dispersions, replacing these Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levels
I'm also looking to make PCAs which only include the particle type of interest, which I was doing for the complete dataset using the below code:
vsd <- vst(dds, blind=FALSE) plotPCA(vsd, intgroup=c("BMI","Diagnosis"))
How can I subset the 3 particle types (MP, FFD, EV) and compare PCOS v non-PCOS and Lean vs Obese within particle type followed by PCA? Thanks in advance for your time and help.
Thanks Michael, I rebuilt my dds and ran again without that factor like so and it worked:
Your hard work and continued support on this package is amazing, much appreciated!
Stewart
Is there any way of subset the 3 particles without rebuilding dds, like just modifying the design of the original dds?
No, to have the entire analysis only consider a subset of samples you have to subset the dds.
Is there any way of subset the 3 particles without rebuilding dds, like just modifying the design of the original dds?