RUVseq how to automatically create model.matrix with all unwanted factors of variation
1
0
Entering edit mode
lucap • 0
@lucap-20484
Last seen 7 months ago
Italy

Hi there, I am trying to automate an RNA-seq protocol based on the normalisation function RUVs which determines k factors of unwanted variation in your dataset that are then fitted in the model.matrix that you provide to edgeR in a way like this design <- model.matrix(~0+treatments + W_1 + W_2 + W_3 + W_4 + W_5, data=pData(set)). This example has k=5 factors of unwanted variation (stored in my pData(set) object). If with another dataset I had three factors of unwanted variation, then the code would be design <- model.matrix(~0+treatments + W_1 + W_2 + W_3, data=pData(set)). How can I have a "generalised" version of the code that accounts for all the unwanted factors of variation in my pData(set) object without the need to manually type them into the formula?

Thanks in advance Luca

RUVseq model.matrix edger • 1.3k views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 9 hours ago
United States

If you already know that you will be using 'treatments' and W1 ... WN, you can just extract them from the column names of your pData object:

ws <- grep("W_", colnames(pData(set)), value = TRUE)
form <- as.formula(paste("~ 0 + treatments +", paste(ws, collapse = " + ")))
design <- model.matrix(form, pData(set))

ADD COMMENT
0
Entering edit mode

That's exactly what I needed! Thanks man! :D

ADD REPLY

Login before adding your answer.

Traffic: 712 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6