This is a test version of Biostars. For the public version, visit https://www.biostars.org.
rna seq design matrix

Hi all, I have RNA-seq data and it is composed of one control group and two knockout groups, to simplify my samples are detailed below;

Control_1
Control_2
AKT_KO_g1_1
AKT_KO_g1_2
AKT_KO_g2_1
AKT_KO_g2_2

These are my samples (in duplicates), so to compare all KO samples with controls and in the same time I want to compare g1 and g2 samples how should I design my matrix?

I have an idea about this but I have never analyzed a data like this before

matrix

sample     KO      gRNA
Control_1     1     0     0
Control_2    1     0     0
AKT_KO_g1_1     1     0     0
AKT_KO_g1_2     1     0     0
AKT_KO_g2_1     1     0     1
AKT_KO_g2_2     1     0     1

But when I design like this in gRNA column g2 will be compared with both g1 and Control. How can I overcome this? Thanks in advance

edger deseq2 modelmatrix dge rna-seq

You need to design your matrix adequately. Everything is well explained in this tutorial : https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7873980/ The key is to use contrasts

df=data.frame(Genotype=c("Control","Control","KO_g1","KO_g1","KO_g2","KO_g2"))
design=model.matrix(~0+Genotype,df)

...

my.contrasts <- makeContrasts(Control=(GenotypeKO_g1+GenotypeKO_g2)/2-GenotypeControl,
                              g1vg2=GenotypeKO_g2-GenotypeKO_g1,
                              levels=colnames(design))

1 answer

Have you read the DESeq2 vignette? You don't have to make a model matrix at all, just specify what to compare to what with contrasts.

Log in to answer this question.