I'd like to extract count information from my DESeqDataSet that has been averaged by Treatment. I'd like to do the same for my rlog normalized counts. I know how to access the counts data in each case, but I'm unsure how to group samples by Treatment before generating averages. I'd like to be able to recycle this regardless of Treatment names.
Thanks for any help.
>samples
| Identifier | Treatment |
|--------------|-----------|
| Control_Rep1 | Control |
| Ethanol_Rep1 | Ethanol |
| Control_Rep2 | Control |
| Ethanol_Rep2 | Ethanol |
| Control_Rep3 | Control |
| Ethanol_Rep3 | Ethanol |
control_name <- "Control"
dds$Treatment <- relevel(dds$Treatment, ref = control_name)
dds <- DESeqDataSetFromTximport(txi,
colData = samples,
design = ~ Treatment)
>head(counts(dds_filtered), 3)
| | Control_Rep1 | Ethanol_Rep1 | Control_Rep2 | Ethanol_Rep2 | Control_Rep3 | Ethanol_Rep3 |
|--------|--------------|--------------|--------------|--------------|--------------|--------------|
| Q0120 | 22 | 29 | 25 | 39 | 13 | 23 |
| R0010W | 3694 | 6205 | 3322 | 7110 | 4985 | 10513 |
| R0020C | 3024 | 3564 | 2799 | 4191 | 5030 | 6214 |
>Desired_Table
| | Control | Ethanol |
|--------|------------|------------|
| Q0120 | 20 | 30.3333333 |
| R0010W | 4000.33333 | 7942.66667 |
| R0020C | 3617.66667 | 4656.33333 |
Looks like that is for an S3 class, whereas the DESeq2 datasets are all S4
It accepts a count matrix, so take the transformed (or whatever) counts and feed it into that function. As said,
?avereps
:Don't concern yourself with these class definitions, as an end user you almost never have to care about it.