RUVg weights in DESeq2
2
0
Entering edit mode
@jordanramilowski-8593
Last seen 8.7 years ago
Japan

Hello,

I am looking to test the mean effect of the treatment (n=1-5; depending on the case) against NC (negative controls), which can be summarized as:

H0: 1/n(treatment_1—NC)+1/n(treatment_2—NC)…+…1/n(treatment_n—NC)=0.

The DESeq2 code I am running is then:

dds <- DESeqDataSetFromMatrix(countData , DataFrame(treatment), ~0+treatment)

dds <- DESeq(dds, betaPrior=F)

coeff=1/length(treatment)

contrast=c(rep(coeff,length(treatment)),-1) ; for n=2 => contrast= (0.5,0.5,-1)

res=results(dds, contrast=contrast,independentFiltering=T,alpha=0.05)

Now, however, I am also trying to incorporate the ‘RUVg’ weights (W_1 object returned from RUVg) into my design and am not sure what is the best way to handle such situation (as above, am still interested in the mean effect of the treatment) Would the DE steps be as follows?

dds <- DESeqDataSetFromMatrix(countData , DataFrame(treatment), ~0+treatment +W_1)

dds <- DESeq(dds, betaPrior=F, quiet=F)

But now, how do I  specify the 'contrast' argument in the 'results' that incorporates the weights? 

Below is the example for two groups of treatment (4 samples) against NC (8 samples) and the associated RUVg weights with each sample (all weights add up to 0).

                         treatment                     W_1

sample1           treatment_1               -0.07130978

sample2           treatment_1               -0.554794325

sample3           treatment_2               0.009349808

sample4           treatment_2               -0.277423111

sample5           NC                                0.466231365

sample6           NC                               -0.115094698

*****               ****                             ******

sample12         NC                               -0.136884239

Thank you very much for any help in advance.

Best regards,

Jordan

deseq2 ruvg • 1.8k views
ADD COMMENT
0
Entering edit mode
@mikelove
Last seen 1 day ago
United States

It should work the same as with a simple design like ~ batch + condition. When you go to form a contrast of condition B vs A, you only concern yourself with these coefficients, and the batch variable has hopefully accounted for extra unwanted variation, which allows you to recover the condition effect. I don't think your contrast would change after including variables which keep track of systematic unwanted variation.

ADD COMMENT
0
Entering edit mode
@jordanramilowski-8593
Last seen 8.7 years ago
Japan

Thanks for your reply Michael.

Here am specifying my groups explicitly by setting the intercept to 0 (~0+treatment +W_1) so  in the contrast argument I have to include an additional term for 'W_1' as otherwise I get an error  (W_1 is a part of the design now) : 

  dds <- DESeqDataSetFromMatrix(countData=countData,colData=pData(my.RUVg),design=~0+group+W_1)
  dds <- DESeq(dds,betaPrior=F,quiet=F)

> contrast
[1]  0.5  0.5 -1.0

  >res=results(dds, contrast=contrast)

Error in checkContrast(contrast, resNames) : 
  numeric contrast vector should have one element for every element of 'resultsNames(object)'

> resultsNames(dds)
[1] "treatment_1" "treatment_2" "NC"         "W_1"  

From what you are saying I am suspecting that the correct way of handing my case would be with the 'contrast': 

> contrast
[1]  0.5  0.5 -1.0 0.0

Which seems to produce a reasonable output:

> summary(res)

out of 61318 with nonzero total read count
adjusted p-value < 0.1
LFC > 0 (up)     : 426, 0.69% 
LFC < 0 (down)   : 1004, 1.6% 
outliers [1]     : 0, 0% 
low counts [2]   : 49054, 80% 
(mean count < 37.7)

This I hope is statistically correct and tests the difference between the mean effect of 'treatment_1' and 'treatment_2' against the NC taking the numeric 'W_1' into account:

>colData(dds)      
DataFrame with 12 rows and 3 columns      
  group W_1 sizeFactor
  <factor> <numeric> <numeric>
sample1 treatment_1 0.04512578 1.0314956
sample2 treatment_1 0.58272001 1.5146905
sample3 treatment_2 -0.09151904 0.9424918
sample4 treatment_2 0.26718661 1.195949
sample5 NC -0.43239408 0.7901761
... ... ... ...
sample8 NC -0.258298 0.8897863
sample9 NC -0.365703 0.8333432
sample10 NC -0.271715 0.8640606
sample11 NC 0.2828354 1.1966906
sample12 NC 0.1348213 1.0714227
       

Best,

Jordan

ADD COMMENT
0
Entering edit mode

Yes that's correct. The new term gets a 0 in the contrast.

ADD REPLY

Login before adding your answer.

Traffic: 817 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