text: user2005: There is a normalized expression matrix. I split it into two and want to do DE on the two cells' subsets. I am having trouble transforming it into the format that DESeq2 would accept. The function that I would think I need to use is the following:
  dds <- DESeqDataSetFromMatrix(countData = cts,
                            colData = coldata,
                            design= ~ batch + condition) 
  
  It would be perfect if I could somehow feed two matrixes separately, but I can not find it. Any suggestions would be greatly appreciated.
  
  Update
  
  I tried the following:
  cells <- c(cell_names, cell_names_cyt)
  groups <- c(rep("NE", times=length(cell_names)), rep("EX", 
  times=length(cell_names_cyt)))
  
  colData <- data.frame(
    Cells <- cells,
    Groups <- groups
  )
  
  dds <- DESeqDataSetFromMatrix(countData = df,
                            colData = colData,
                            design= ~ Groups)
  
  But getting the error:
  
  Error in DESeqDataSet(se, design = design, ignoreRank) : 
      some values in assay are not integers
  
  Of course, they are floats since I already normalized the matrices.
  
  Update
  
  I did the following since I am using Seurat:
  df <- as.data.frame(as.matrix(seurat_object@raw.data))
  df <- df[,colnames(df) %in% cells]
  
  But then the following:
  dds <- DESeqDataSetFromMatrix(countData = df,
                            colData = colData,
                            design= ~ Groups)
  
  Gave me an error:
  
  Error in DESeqDataSet(se, design = design, ignoreRank) : all variables in design formula must be columns in colData
  
  
  user2388: 
  Error in DESeqDataSet(se, design = design, ignoreRank) : all variables
    in design formula must be columns in colData
  
  I think that means just what it says...you don't have a "Groups" column in coldata.  Did you spotcheck your ColData data frame to make sure it looks the way it should?
  > cells <- c("1","2","3")
  > groups <- c("a", "b", "c")
  > test <- data.frame(Cells <- cells, Groups <- groups)
  > test
    Cells....cells Groups....groups
  1              1                a
  2              2                b
  3              3                c
  > colnames(test)
  [1] "Cells....cells"   "Groups....groups"
  
  
original_text: 2005: <p>There is a <code>normalized</code> expression matrix. I split it into two and want to do <code>DE</code> on the two cells' subsets. I am having trouble transforming it into the format that <code>DESeq2</code> would accept. The function that I would think I need to use is the following:</p>
  
  <pre><code>dds &lt;- DESeqDataSetFromMatrix(countData = cts,
                            colData = coldata,
                            design= ~ batch + condition) 
  </code></pre>
  
  <p>It would be perfect if I could somehow feed two matrixes separately, but I can not find it. Any suggestions would be greatly appreciated.</p>
  
  <blockquote>
    <p>Update</p>
  </blockquote>
  
  <p>I tried the following:</p>
  
  <pre><code>cells &lt;- c(cell_names, cell_names_cyt)
  groups &lt;- c(rep("NE", times=length(cell_names)), rep("EX", 
  times=length(cell_names_cyt)))
  
  colData &lt;- data.frame(
    Cells &lt;- cells,
    Groups &lt;- groups
  )
  
  dds &lt;- DESeqDataSetFromMatrix(countData = df,
                            colData = colData,
                            design= ~ Groups)
  </code></pre>
  
  <p>But getting the error:</p>
  
  <blockquote>
    <p>Error in DESeqDataSet(se, design = design, ignoreRank) : 
      some values in assay are not integers</p>
  </blockquote>
  
  <p>Of course, they are floats since I already normalized the matrices.</p>
  
  <blockquote>
    <p>Update</p>
  </blockquote>
  
  <p>I did the following since I am using <code>Seurat</code>:</p>
  
  <pre><code>df &lt;- as.data.frame(as.matrix(seurat_object@raw.data))
  df &lt;- df[,colnames(df) %in% cells]
  </code></pre>
  
  <p>But then the following:</p>
  
  <pre><code>dds &lt;- DESeqDataSetFromMatrix(countData = df,
                            colData = colData,
                            design= ~ Groups)
  </code></pre>
  
  <p>Gave me an error:</p>
  
  <blockquote>
    <p>Error in DESeqDataSet(se, design = design, ignoreRank) : all variables in design formula must be columns in colData</p>
  </blockquote>
   2388: <blockquote>
    <p>Error in DESeqDataSet(se, design = design, ignoreRank) : all variables
    in design formula must be columns in colData</p>
  </blockquote>
  
  <p>I think that means just what it says...you don't have a "Groups" column in coldata.  Did you spotcheck your ColData data frame to make sure it looks the way it should?</p>
  
  <pre><code>&gt; cells &lt;- c("1","2","3")
  &gt; groups &lt;- c("a", "b", "c")
  &gt; test &lt;- data.frame(Cells &lt;- cells, Groups &lt;- groups)
  &gt; test
    Cells....cells Groups....groups
  1              1                a
  2              2                b
  3              3                c
  &gt; colnames(test)
  [1] "Cells....cells"   "Groups....groups"
  </code></pre>
  