DESeq2 Error in `.rowNamesDF<-`(x, value = value): Invalid 'row.names' length
1
0
Entering edit mode
ussarizona ▴ 10
@ff20d7e7
Last seen 4 days ago
The Netherlands

I am new to RNAseq and started to analyze my dataset using DESeq2. I first run the DESeqDataSetFromMatrix function and found the error message

Error in DESeqDataSetFromMatrix(countData = HitCount, colData = myCondition,  : 
ncol(countData) == nrow(colData) is not TRUE

In addition, if I run the following code I get this warning:

all(colnames(HitCount) == myCondition$SampleID)
[1] FALSE
Warning message:
In colnames(HitCount) == myCondition$SampleID :
  longer object length is not a multiple of shorter object length

I then searched online and arranged my code as follow:

myCondition <- read_excel("ConditionTable.xlsx")
View(myCondition)
head(myCondition)

HitCount <- read_excel("HitCounts_30mpi.xlsx", col_names = TRUE,
                       col_types = c("text", "numeric", "numeric",
                                     "numeric", "numeric", "numeric",
                                     "numeric", "numeric", "numeric", 
                                     "numeric"))
View(HitCount)
head(HitCount)
rownames(HitCount) <- HitCount[,1]
HitCount <- HitCount[,-1]
head(HitCount)

all(colnames(HitCount) == myCondition$SampleID)

str(HitCount)

dds <- DESeqDataSetFromMatrix(countData = HitCount,
                              colData = myCondition,
                              design = ~ Condition)

dds <- DESeq(dds)

However, I do get the following error when running rownames(HitCount) <- HitCount[,1]:

Error in .rowNamesDF<-`(x, value = value) : 
invalid lenght in 'row.names'

This does not stop R to in the calculation but I get in my results that the row names are changed in numbers. Do you know how I can keep the original row names and having DESeqDataSetFromMatrix TRUE?

This is a piece of my excel file:

Gene_ID CTRL_1 CTRL_2 CTRL_3 SXM_1 SXM_2 SXM_3 XS_1 XS_2 XS_3
VDAG_00XX1 661 558 555 509 325 338 526 611 419 2

VDAG_00XX2 1920 1545 1457 2033 1160 1231 1691 1689 1496 3

VDAG_00XX3 568 568 514 946 718 728 1805 1920 1549 4

VDAG_00XX4 6774 6676 7036 5335 4079 3917 8557 9658 7973

DESeq2 • 684 views
ADD COMMENT
0
Entering edit mode
@mikelove
Last seen 10 minutes ago
United States

Starting from the very top, do you understand the error? You need to provide sample info that matches 1-to-1 the columns of the counts matrix. You had unequal samples in the counts matrix and in the sample info table, indicating a problem.

ADD COMMENT
1
Entering edit mode

Hi Michael,

Yes, I could figure it out what does the error mean. In my matrix I had the first colum GeneID while in my condition I only had the different treatment, CTRL, SXM, XS. I found out that I had to start from the second colum of my .csv file. In this way the condition and the matrix file matched. Now I do not get anymore that error and when I do run the code, GeneID names are kept.

ADD REPLY

Login before adding your answer.

Traffic: 714 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6