**70**wrote:

Dear all,
I have three question about RNASeq analysis of my data using DESeq2. Lets say i have 4 groups and wanna see DE for each combinations of the groups (**By specifying the contrast in results function of DESeq2**). So i used the default setting of DESeq considering intersect/base level (while betaPrior=TRUE; default). **But i am wondering why my model.matrix is not the same as condition in dds object. ?**

**question 1:**

```
dds <- DESeqDataSetFromMatrix(countData= filtered, colData=DataFrame(group), design = ~ group)
deseq <- DESeq(object = dds, fitType = "local", betaPrior=TRUE)
## get contrast
resultsNames(deseq)
[1] "Intercept" "groupA" "groupB" "groupC"
[5] "groupD"
> model.matrix(~group)
(Intercept) groupB groupC groupD
1 1 0 0 0
2 1 0 0 0
3 1 0 0 0
4 1 1 0 0
5 1 1 0 0
6 1 1 0 0
7 1 0 1 0
8 1 0 1 0
9 1 0 1 0
10 1 0 0 1
11 1 0 0 1
12 1 0 0 1
attr(,"assign")
[1] 0 1 1 1
attr(,"contrasts")
attr(,"contrasts")$group
[1] "contr.treatment"
```

I was hoping group A must be my base level but after seeing resultsNames(deseq) output, got surprised !!! Why ??? Please someone explain ??

**question 2:**

can i use design = ~0+group in dds object with betaPrior = FALSE (without using base level) in order to use different different contrast in results function ?? This way i will get all 6 combination of contrast of my 4 groups (A;B;C;D).

**question 3:**

If Answer is YES for question 1, so I also want to remove batch from my dataset using SVA package. Therefore i need design.matrix as the same as fro deseq design, i tried as follow but got error:

```
> dds <- DESeqDataSetFromMatrix(countData= filtered, colData=DataFrame(group), design = ~ 0+group)
converting counts to integer mode
> dds <- estimateSizeFactors(dds)
> dat <- counts(dds, normalized=TRUE)
> idx <- rowMeans(dat) > 1
> dat <- dat[idx,]
> ## log2 transform in order to use sva instead svaseq
> dat <- log2(dat)
> mod <- model.matrix(~0+group, colData(dds))
> #mod0 <- cbind(mod[,1])
> sva.dat <- sva(dat, mod, mod0=NULL, n.sv=3)
Number of significant surrogate variables is: 3
Iteration (out of 5 ):1
Error in solve.default(t(mod) %*% mod) :
system is computationally singular: reciprocal condition number = 1.38778e-17
```

**Any idea, how to use sva having without base model/NULL model ??** **I assume this error happened due to model.matrix i.e. mod.**

Thanks

**92k**• written 3.4 years ago by unique379 •

**70**

This was cross posted on Bioconductor support:

https://support.bioconductor.org/p/84725/

1.9k