DESeq2: relevel() unsuccessfully setting control group
2
0
Entering edit mode
vanbelj ▴ 10
@vanbelj-21216
Last seen 4 months ago

I recently rewrote my R code so that it can be used with new dataset. In doing so, I changed the nomenclature of my sample Groups (used in Design). For some reason, the "Control vs. Treated" comparison is now being made, instead of the intended "Treated vs. Control".

Before -> Now
Auxin_00min -> Control
Auxin_20min -> Auxin

Note that alphabetically, the prior nomenclature naturally ordered Auxin_00min before Auxin_20min. However, I had always included a relevel step, just in case, and always got the expected comparison (Auxin_20min vs. Auxin_00min).

control_name = "Auxin_0min"
dds <- DESeqDataSetFromTximport(txi, colData = samples, design = ~Treatment)
relevel(dds$Treatment, ref = control_name)
## [1] Auxin_0min  Auxin_0min  Auxin_0min  Auxin_20min Auxin_20min Auxin_20min
## Levels: Auxin_0min Auxin_20min

dds <- DESeq(dds)
results <- results(dds, alpha = 0.05)
resOrdered <- results[order(results$padj, -results$log2FoldChange), ]  #Order by increasing padj, decreasing LFC
resOrdered

## log2 fold change (MLE): Treatment Auxin 20min vs Auxin 0min 
## Wald test p-value: Treatment Auxin 20min vs Auxin 0min 
## DataFrame with 6530 rows and 6 columns
##          baseMean log2FoldChange     lfcSE        stat       pvalue
##         <numeric>      <numeric> <numeric>   <numeric>    <numeric>
## YLR044C   1794.59       -3.39792 0.0829905    -40.9434  0.00000e+00
## YHR174W   1641.12       -2.90740 0.0798101    -36.4289 1.48365e-290
## YGR254W   1776.95       -3.07650 0.0852199    -36.1007 2.21288e-285

Alphabetically, the new nomenclature orders Auxin before Control, but the relevel step should solve that issue. I receive no errors, but the results reveal that the incorrect "Control vs Auxin" comparison has been made.

UPDATE: changing groups with relevel() worked in no capacity - not even when trying to set ref="Auxin". However, changing 'Auxin' to 'Treated' so that it once again fell alphabetically after 'Control' caused the expected 'Treatment vs. Control' comparison to be made again. So I'm fairly certain there is some issue with relevel.

control_name = "Control"
dds <- DESeqDataSetFromTximport(txi, colData = samples, design = ~Treatment)
relevel(dds$Treatment, ref = control_name)
## [1] Control Control Control Auxin   Auxin   Auxin  
## Levels: Control Auxin

dds <- DESeq(dds)
results <- results(dds, alpha = 0.05)
resOrdered <- results[order(results$padj, -results$log2FoldChange), ]  #Order by increasing padj, decreasing LFC
resOrdered

## log2 fold change (MLE): Treatment Control vs Auxin 
## Wald test p-value: Treatment Control vs Auxin 
## DataFrame with 6530 rows and 6 columns
##            baseMean log2FoldChange     lfcSE         stat       pvalue
##           <numeric>      <numeric> <numeric>    <numeric>    <numeric>
## YLR044C     1794.59        3.39792 0.0829905      40.9435  0.00000e+00
## YHR174W     1641.12        2.90740 0.0798101      36.4289 1.48361e-290
## YGR254W     1776.95        3.07650 0.0852199      36.1007 2.21281e-285
DESeq2 • 228 views
ADD COMMENT
1
Entering edit mode
@mikelove
Last seen 19 hours ago
United States

It should work, maybe try again and watch out for error messages.

Eg your results() call has unmatched parens so if I ran it as you’ve posted it wouldn’t be creating a new object.

ADD COMMENT
0
Entering edit mode

Hi Michael,

Those were copy-paste errors. I'm running this within Rmarkdown and was copying and pasting from the completed report. The first step in the Rmarkdown code clear the environment, so there's no carry over from prior work. The report completes successfully and I get all of my exports.

Since changing the word 'Auxin' to 'Treatment' reestablishes the original alphabetic order and simultaneously reverts the comparison to the expected 'Treatment vs. Control', I'm fairly certain that the issue is with relevel.

Here's a summary of different Group namings and the comparisons they yielded:

(Control)       (Treated)      Comparison Yielded  
Auxin_0min      Auxin_20min    Auxin_20min vs. Auxin_0min  
Control         Auxin          Control vs. Auxin  
Control         Treated        Treated vs. Auxin

All of these were run with relevel set to the value listed under (Control).

ADD REPLY
1
Entering edit mode

I just noticed you are not storing your relevel command. That function (nor others in R) does not modify arguments in place.

E.g. if you have x, then:

f(x)

Typically will not modify x (unless the developers are doing something very unexpected vis a vis the language).

ADD REPLY
0
Entering edit mode

lol. Did I mention I’m a beginner? 4 hours of troubleshooting to find out I needed to save as a variable. I believe that is the weekend calling me. :P

ADD REPLY
0
Entering edit mode
@23dce7cb
Last seen 4 months ago

Untuk Kamu yang sedang terkategori pemeran pendatang baru di situs NAGAPOKER online, Kamu wajib lebih aktif menekuni tips- tips main poker. Bagaikan pendatang baru Kamu wajib dapat memilah tipe game dengan metode yang relatif gampang, perihal itu dimaksudkan supaya Kamu bebas dari kegagalan. Kamu pula wajib aktif menanya pada sahabat Kamu yang telah lama main di situs poker online buat menaikkan wawasan sekeliling poker online. Banyak belajar serta aktif membaca postingan sekeliling poker pula jadi salah satu usaha supaya Kamu bisa lekas menguasai hal metode main di situs poker. Di dasar ialah panduan bermain di situs poker untuk pendatang baru.

Merupakan Situs Poker Resmi Indonesia terlengkap, agen poker resmi terbaik yang ada di Indonesia. menyediakan permainan kartu remi dan domino terbaik dan teraman di Indonesia. Untuk mendaftar, bergabung dan bermain kartu online bersama kami sangatlah mudah, cepat dan pastinya aman.

https://18.139.218.157

ADD COMMENT

Login before adding your answer.

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