This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Creating a matrix for edgeR/limma import

Hey there

I'm trying to make a DE analysis of a few RNA-seq samples. I used the "Rsubread" package to get the featureCounts from my bam* files and later retrieved the DGElist

I want to use the DGElist for differential expression by either using edgeR or limma but I'm having problems creating a design matrix. Here's my DGElist data:

An object of class "DGEList"
$counts
                     control1.sorted.bam                   control2.sorted.bam                    sample1.sorted.bam
497097                      1                                                3                                               5
100503874                 3                                                5                                               2
100038431                 0                                                0                                               0
19888                        0                                                0                                               0
20671                        4                                                2                                               3
27395                    4534                                            4622                                          5092
          sample2.sorted.bam
497097                     3
100503874                5
100038431                0
19888                       0
20671                      2
27395                   4622

$samples
                                group           lib.size              norm.factors
control1.sorted.bam     1              26756231             1
control2.sorted.bam     1              13181727             1
sample1.sorted.bam     2              28977272            1
sample2.sorted.bam     2              29549367            1

$genes
     GeneID                Length
1    497097                3634
2 100503874              3259
3 100038431              1634
4     19888                  9747
5     20671                  3130
6     27395                  4203

Control1/2 as well as Sample1/2 are biological replicates. Any advice on how to create a design matrix would be much appreciated

Thanks

rna-seq r
Do you mean a design matrix?

Exactly. Sorry for not making it clear

1 answer

design <- model.matrix(~c(0,0,1,1))

Thanks. this is what I get:

$design
                    (Intercept) group2
control1.sorted.bam           1      0
control2.sorted.bam           1      0
sample1.sorted.bam            1      1
sample2.sorted.bam            1      1
attr(,"assign")
[1] 0 1
attr(,"contrasts")
attr(,"contrasts")$group
[1] "contr.treatment"

Would you reckon creating a contrast matrix or can I leave it like this?

There's no point in a contrast matrix, the group2 coefficient is already testing what you want.

Log in to answer this question.