Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rozitaa
    Member
    • Jun 2013
    • 51

    #31
    Originally posted by Michael Love View Post
    hi rozitaa,

    The issue here is that there are more animals in certain tissues. So when the R function model.matrix tries to form the model matrix internal to the DESeq() function, this results in a column of zeros for the nested animal 6, tissue A combination for example.

    There is an easy solution though. In the next release of Bioconductor, which will be released 17 April 2015, and has DESeq2 v1.8, you can provide a custom model matrix to DESeq(). (You can test the development version of DESeq2 v1.7 already, but this requires downloading the development version of R, and this is not impossible but not always easy.)

    So all you need to do is to remove these interaction columns which have no samples:

    Code:
    design <- ~ gut_microbiota + gut_microbiota:animal.nested + gut_microbiota:tissue
    mm <- model.matix(design, data=colData(dds))
    ## remove columns of mm which have all zeros:
    (all.zero <- apply(mm, 2, function(x) all(x == 0)))
    mm <- mm[, !all.zero]
    dds <- DESeq(dds, design=mm, betaPrior=FALSE)
    We do have to turn off the log2 fold change shrinkage for this options though (betaPrior=FALSE). But the inference and results tables work the same.

    Thanks a lot Micheal! I got the idea!

    The only problem that I have now is I am using HTSeq-count data this my code:
    Code:
    design <- ~ gut_microbiota + gut_microbiota:animal.nested + gut_microbiota:tissue
    mm <- model.matrix(design, data=sample_table)
    (all.zero <- apply(mm, 2, function(x) all(x == 0)))
    mm <- as.data.frame(mm[, !all.zero])
    dds = DESeqDataSetFromHTSeqCount(sampleTable=sample_table, directory='~/htseq/', design=mm)
    But I get an error:
    Code:
    Error in terms.default(object, data = data) : 
      no terms component nor attribute
    Is it because of the way I am fitting the design matrix into the htseq-count data?

    Comment

    • Michael Love
      Senior Member
      • Jul 2013
      • 333

      #32
      So, again, you'll only be able to do this custom model matrix in version 1.8.

      packageVersion("DESeq2")

      Additionally, you can only provide the matrix to the 'full' argument of DESeq(). In order to construct a DESeqDataSet object, you can use design=~1, because this will be ignored and the custom matrix will be used instead.
      Last edited by Michael Love; 03-31-2015, 05:46 AM.

      Comment

      • rozitaa
        Member
        • Jun 2013
        • 51

        #33
        Originally posted by Michael Love View Post
        So, again, you'll only be able to do this custom model matrix in version 1.8.

        packageVersion("DESeq2")

        Additionally, you can only provide the matrix to DESeq(). In order to construct a DESeqDataSet object, you can use design=~1, because this will be ignored and the custom matrix will be used instead.
        I see!! I cannot wait till April 17th since I have deadline. And it is hard for me to install the developmental version of R! Is there any other solution for my problem?

        Comment

        • Michael Love
          Senior Member
          • Jul 2013
          • 333

          #34
          "Now I would like to see DE genes resulted from comparing of every gut_microbiota status (B, C, D, E) to the baseline (A) on each tissue separately."

          Sorry, reading over your column data and question more carefully, I realized that this advice about nesting doesn't apply to your experimental design. The nesting approach works for experimental designs where the comparison of interest is nested within individuals/animal. For example if you wanted to compare tissue differences for each microbiota. However, you want to compare microbiota differences for each tissue. The problem for analysis with the nesting approach is that you cannot control for the animal-specific effects and compare across microbiota, because these variables are confounded. Whereas, animal and tissue are not confounded, which allows the nesting approach to work.

          I'd recommend you subset each tissue into 3 DESeqDataSets and run a design of ~ gut_microbiota for each.

          Comment

          • rozitaa
            Member
            • Jun 2013
            • 51

            #35
            Originally posted by Michael Love View Post
            I'd recommend you subset each tissue into 3 DESeqDataSets and run a design of ~ gut_microbiota for each.
            Thanks a lot Micheal!

            Comment

            • lbragg
              Member
              • Sep 2009
              • 14

              #36
              Originally posted by Michael Love View Post
              Also, I had to update that custom line of size factor code for when all rows have a zero. If you were using that line of code to avoid the issue that all rows of your count matrix have one or more zeros, you should get the edited version:



              We're implementing a solution here which was on the list of todos for a while now, but it won't be out for 6 months. Typical RNA-Seq doesn't have this issue, but since phyloseq we are seeing more metagenomics datasets which often have no genes without a zero.
              Hi there,

              I have a metatranscriptomic dataset where every gene has at least one zero count. I tried the geoMeans function you've supplied via the link, but I keep getting the following error:

              Code:
              dds = estimateSizeFactors(dds, geoMeans=geoMeans)
              Error in if (any(value <= 0)) { : missing value where TRUE/FALSE needed
              This is using DESeq2 1.8.1 on R 3.2.

              Happy to provide a MRE if you like.

              Lauren

              Comment

              • Michael Love
                Senior Member
                • Jul 2013
                • 333

                #37
                what does summary(geoMeans) give you?
                Last edited by Michael Love; 06-23-2015, 05:28 AM. Reason: replying to wrong post

                Comment

                • lbragg
                  Member
                  • Sep 2009
                  • 14

                  #38
                  Originally posted by Michael Love View Post
                  what does summary(geoMeans) give you?
                  Code:
                  summary(geoMeans)
                     Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
                    1.414   2.289   2.828   3.731   4.000  28.650

                  Comment

                  • Michael Love
                    Senior Member
                    • Jul 2013
                    • 333

                    #39
                    Another test (I suspect there is a column with all zeros):

                    table(colSums(counts(dds)) == 0)

                    Comment

                    • lbragg
                      Member
                      • Sep 2009
                      • 14

                      #40
                      Originally posted by Michael Love View Post
                      Another test (I suspect there is a column with all zeros):

                      table(colSums(counts(dds)) == 0)
                      You're right, there is one sample with all zeros. Thanks.
                      Last edited by lbragg; 06-25-2015, 02:31 PM.

                      Comment

                      Latest Articles

                      Collapse

                      • SEQadmin2
                        Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
                        by SEQadmin2



                        Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

                        Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
                        ...
                        10-14-2026, 09:55 AM
                      • SEQadmin2
                        New Genomics Technologies Take Aim at Long-Standing Limits
                        by SEQadmin2


                        Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

                        We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
                        ...
                        09-28-2026, 10:25 AM

                      ad_right_rmr

                      Collapse

                      News

                      Collapse

                      Topics Statistics Last Post
                      Started by SEQadmin2, Yesterday, 11:13 AM
                      0 responses
                      16 views
                      0 reactions
                      Last Post SEQadmin2  
                      Started by SEQadmin2, Yesterday, 10:48 AM
                      0 responses
                      17 views
                      0 reactions
                      Last Post SEQadmin2  
                      Started by SEQadmin2, 10-15-2026, 10:52 AM
                      0 responses
                      35 views
                      0 reactions
                      Last Post SEQadmin2  
                      Started by SEQadmin2, 10-14-2026, 05:39 AM
                      0 responses
                      42 views
                      0 reactions
                      Last Post SEQadmin2  
                      Working...