Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • DESEQ2 control vs treat based on alphabetic order?

    Hello,

    I am using DESeq2 for differential expression analysis of RNA Seq data.

    My question is: which is considered "control" or "treated" in the "countData" and "condition" table.

    Let me explain.

    When having "countData" table in the format of "control" "control" "control" "control" "treated" "treated" "treated" "treated" table, a also assign the "condition" as follows:

    condition <- factor(c(rep("control", 4), rep("treat", 4)))

    Following analysis, I reach to the

    res <- results(dds)

    and
    head(res) gives

    log2 fold change (MAP): condition treat vs ctrl
    Wald test p-value: condition treat vs ctrl

    The exact same result I get when I reverse the "condition":

    condition <- factor(c(rep("treat", 4), rep("control", 4)))

    or when I reverse the countData.

    But when I set

    condition <- factor(c(rep("atreat", 4), rep("control", 4)))

    my head(res) gives

    log2 fold change (MAP): condition ctrl vs atreat
    Wald test p-value: condition ctrl vs atreat

    So it seems that the vs comment is based on alphabetic order?

  • #2
    Factors are ordered alphabetically in R unless you specify the order yourself:
    Code:
    condition <- factor(c(rep("WT",4),rep("Mut",4)), levels=c("WT","Mut"))
    Have a look at:
    Code:
    levels(condition)

    Comment


    • #3
      It's not DESeq2, but R's base function 'factor' which determines the order of levels in a factor.

      You can control the order of the levels either using the 'contrast' argument, or while you are setting up the factors.

      If you read over the DESeq2 vignette:

      vignette("DESeq2")

      We have in the beginning:

      "1.2.5 Note on factor levels

      In the three examples above, we applied the function factor to the column of interest in colData, supplying a character vector of levels. It is important to supply levels (otherwise the levels are chosen in alphabetical order) and to put the “control” or “untreated” level as the first element (”reference level”), so that the log2 fold changes produced by default will be the expected comparison against the reference level, that is log2 (treated/untreated). An R function for easily changing the reference level is relevel. An example of setting the reference level of a factor with relevel is..."
      Last edited by Michael Love; 06-26-2015, 10:21 AM.

      Comment


      • #4
        Thank you both.

        The:

        condition <- factor(c(rep("WT",4),rep("Mut",4)), levels=c("WT","Mut"))

        solved the problem.

        Comment

        Latest Articles

        Collapse

        • seqadmin
          Essential Discoveries and Tools in Epitranscriptomics
          by seqadmin




          The field of epigenetics has traditionally concentrated more on DNA and how changes like methylation and phosphorylation of histones impact gene expression and regulation. However, our increased understanding of RNA modifications and their importance in cellular processes has led to a rise in epitranscriptomics research. “Epitranscriptomics brings together the concepts of epigenetics and gene expression,” explained Adrien Leger, PhD, Principal Research Scientist...
          Yesterday, 07:01 AM
        • seqadmin
          Current Approaches to Protein Sequencing
          by seqadmin


          Proteins are often described as the workhorses of the cell, and identifying their sequences is key to understanding their role in biological processes and disease. Currently, the most common technique used to determine protein sequences is mass spectrometry. While still a valuable tool, mass spectrometry faces several limitations and requires a highly experienced scientist familiar with the equipment to operate it. Additionally, other proteomic methods, like affinity assays, are constrained...
          04-04-2024, 04:25 PM

        ad_right_rmr

        Collapse

        News

        Collapse

        Topics Statistics Last Post
        Started by seqadmin, 04-11-2024, 12:08 PM
        0 responses
        58 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 04-10-2024, 10:19 PM
        0 responses
        54 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 04-10-2024, 09:21 AM
        0 responses
        45 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 04-04-2024, 09:00 AM
        0 responses
        55 views
        0 likes
        Last Post seqadmin  
        Working...
        X