Hi,
I am working with multi-factor RNA-Seq experiment in EdgeR
to find diff. expressed genes. The samples were processed in different batches (see below). I am trying to compare two different effects of Treatment A, and B paired samples. Additionally, I am also interested in comparisons of two groups Group_1 and Group_2, though the main goal is to compare between Treatment B vs. A.. I have a question about creating a right design matrix for the comparisonsa and use it in estimateDisp
and glmQLFit
.
g.Treatments <- factor(Samples$Treatments)
g.Groups <- factor(Samples$Groups)
g.Batch <- factor(Samples$Batch)
y <- DGEList(counts = data_counts, group = group.Treatments, remove.zeros = TRUE)
I am interested in comparing 2 Treatment, and find diff exp genes:
des_treat.1 <- model.matrix(~Batch+Individuals+Treatments)
(OR)
des_treat.2 <- model.matrix(~Individuals+Batch+Treatments)
I am interested in comparing 2 groups, and find diff exp genes:
des_group.1 <- model.matrix(~Batch+Groups)
(OR)
des_group.1 <- model.matrix(~Groups)
OR, use all comparison in same line, is it possible?
des_treat.group.1 <- model.matrix(~Batch+Individual+Treatments+Groups)
des_treat.group.2 <- model.matrix(~Individual+Batch+Treatments+Groups)
Samples
#> Individuals Treatments Groups Batch
#> ID_1 1 A Group_1 1
#> ID_2 1 B Group_1 1
#> ID_3 2 A Group_2 2
#> ID_4 2 B Group_2 2
#> ID_5 3 A Group_1 1
#> ID_6 3 B Group_1 1
#> ID_7 4 A Group_2 2
#> ID_8 4 B Group_2 2
#> ID_9 5 A Group_1 1
#> ID_10 5 B Group_1 1
#> ID_11 6 A Group_2 2
#> ID_12 6 B Group_2 2
Thank you,
Abdul
Gordon Smyth perfect, this very helpful., but only issue is batch factor in my data as the samples were processed in two batches.
Section 3.5 "Comparisons both between and within subjects"
design <- model.matrix(~Patient) design <- cbind(design, Healthy.Hormone, Disease1.Hormone, Disease2.Hormone)
Inclusion of batch factor
Assuming there is a batch effect, in Section 3.5 "Comparisons both between and within subjects" example; does the below formula looks fine?