Go Back   SEQanswers > Bioinformatics > Bioinformatics

Similar Threads
Thread Thread Starter Forum Replies Last Post
DESeq2: struggle to add multiple variables to DESeqDataSet JonB Bioinformatics 4 06-09-2014 01:00 PM
DESeq2 multiple levels id0 Bioinformatics 3 05-30-2014 11:31 AM
Are Cuffdiff q-values and p-values reliable when multiple treatments are analyzed? gwilymh Bioinformatics 1 03-16-2014 11:32 AM
Creating a data.frame for DESeq2 KHubbard Bioinformatics 3 10-11-2013 11:16 PM
cummeRbund andplotting for selected treatments among multiple treatments ataheri RNA Sequencing 1 04-10-2013 06:41 PM

Thread Tools
Old 07-15-2014, 10:55 PM   #1
Location: Toronto

Join Date: May 2012
Posts: 18
Exclamation DESeq2 error in data.frame (multiple treatments and multiple replicates)

I have a text file, containing read counts per gene for each treatments and control, with the following column

[Gene Symbol] [C1] [C2] [C3] [A1] [A2] [A3] [B1] [B2] [B3]
  • C is Control
  • A is Treatment 1
  • B is Treatment 2
-> Each of C, A an B have 3 replicates

When I do data.frame it generates an error

library( "DESeq2" )
mydata = read.table("matrix.txt", header=TRUE)
col1 <- mydata[,1]

## Error message
ExpDesign = data.frame(row.names=col1, condition=c("C", "C", "C", "A", "A", "A", "B", "B", "B")
Error in data.frame(row.names = col1, condition = c("C", "C", "C", "A",  : 
  row names supplied are of the wrong length
## The following is what I would next if I didn't have any error message
countdata <- assay( mydata )
head( countdata )
coldata <- colData( mydata )
rownames( coldata ) <- coldata$run
colnames( countdata ) <- coldata$run
head( coldata[ , c("C", "C", "C", "A", "A", "A", "B", "B", "B") ] )
Eventually the goal is to have a heatmap with each replicates in the control, treatment A and B.

I think the problem comes from the fact that I should subset my data, though I have no clue how to do to that. Any suggestions on where is the error message coming from and how to subset data? (If I should ever subset that..)

Last edited by KYR; 07-15-2014 at 10:57 PM. Reason: typo
KYR is offline   Reply With Quote
Old 07-16-2014, 06:35 AM   #2
Michael Love
Senior Member
Location: Boston

Join Date: Jul 2013
Posts: 333

This is your countData, which has as many rows as genes:

mydata = read.table("matrix.txt", header=TRUE)
col1 <- mydata[,1]
It looks like this will be the colData (sample information table).

ExpDesign = data.frame(row.names=col1, condition=c("C", "C", "C", "A", "A", "A", "B", "B", "B")
...which has as many rows as samples.

So the error comes when you try to name the rows of your colData using the gene names in col1.

You will also get an error later when you try to run
assay( mydata )
because mydata is a data.frame. assay() is a function for getting a matrix from SummarizedExperiment objects. You can just use
as.matrix( mydata )
in order to supply a matrix to DESeqDataSet.
Michael Love is offline   Reply With Quote


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT -8. The time now is 10:47 PM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO