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
                        Beyond CRISPR/Cas9: Understand, Choose, and Use the Right Genome Editing Tool
                        by SEQadmin2



                        CRISPR/Cas9 sparked the gene editing revolution for both research and therapeutics.1 But this system still showed severe issues that limited its applications. The most prominent were the heavy reliance on PAM sequences, delivery limitations, double-stranded breaks that prompt unintended edits and cell death, and editing inefficiency (both in targeting and in knock-in reliability).

                        Despite this, “CRISPR helped turn genome editing from a specialized technique into
                        ...
                        07-31-2026, 11:01 AM
                      • SEQadmin2
                        Proteomic Platforms: How to Choose the Right Analytical Strategy to Improve Detection and Clinical Applications
                        by SEQadmin2


                        Proteomics platforms are evolving rapidly, with advances in mass spectrometry and affinity-based approaches expanding what researchers can detect and at what scale. As the field moves toward deeper proteome coverage and clinical applications, scientists face an increasingly complex landscape of tools. This article will explore how researchers are navigating these choices to find the right platform for their work.

                        The systematic characterization of the human proteome has
                        ...
                        07-20-2026, 11:48 AM
                      • SEQadmin2
                        Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
                        by SEQadmin2



                        Genomics studies in neuroscience face a special challenge due to the brain’s complexity and scarcity of samples. Mapping changes in cell type and state using conventional next-generation sequencing methods remains challenging. Advances in technologies like single-cell sequencing, spatial transcriptomics, and long-read sequencing have opened the door to deeper studies of the brain and diseases like Alzheimer’s, amyotrophic lateral sclerosis (ALS), and schizophrenia.
                        ...
                        07-09-2026, 11:10 AM

                      ad_right_rmr

                      Collapse

                      News

                      Collapse

                      Topics Statistics Last Post
                      Started by SEQadmin2, Yesterday, 07:41 AM
                      0 responses
                      12 views
                      0 reactions
                      Last Post SEQadmin2  
                      Started by SEQadmin2, 08-03-2026, 10:13 AM
                      0 responses
                      27 views
                      0 reactions
                      Last Post SEQadmin2  
                      Started by SEQadmin2, 07-31-2026, 02:55 AM
                      0 responses
                      39 views
                      0 reactions
                      Last Post SEQadmin2  
                      Started by SEQadmin2, 07-24-2026, 12:17 PM
                      0 responses
                      25 views
                      0 reactions
                      Last Post SEQadmin2  
                      Working...