Question: Problem with DESeq package: ncol(countData) == nrow(colData) is not TRUE
0
gravatar for lmck0705
11 days ago by
lmck07050
lmck07050 wrote:

Hi, I am new to R and trying to carry out unsupervised hierarchical clustering on an RNA-seq data set (30 different gene.result files).

I am inputting this code:

samples<-read.table("RNAseq_sample3.txt",sep="\t",header=T, fill=TRUE)

files <- list.files("./",pattern=".genes.results")

names(files) <-samples$sample

txi.rsem <- tximport(files, type = "rsem", txIn = FALSE, txOut = FALSE)

txi.rsem$length[txi.rsem$length == 0] <- 1

ddsTxi <- DESeqDataSetFromTximport(txi.rsem, countData = colData = samples,design = ~ Condition)

ddsLRT <- DESeq(ddsTxi, test="LRT", reduced= ~ 1)

resLRT <- results(ddsLRT)

resOrdered <- resLRT[order(resLRT$padj),]

topgenes <- head(rownames(resOrdered),100)

mat <- assay(vsd)[topgenes,]

mat <- mat - rowMeans(mat)

pheatmap(mat,color = colorRampPalette(c("darkblue", "white", "darkred"))(100),border_color = NA,cluster_cols = T,fontsize_row=5,fontsize_col=6)

head(as.data.frame(resOrdered),100)

And this is being returned:

txi.rsem <- tximport(files, type = "rsem", txIn = FALSE, txOut = FALSE) reading in files with read_tsv 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

txi.rsem$length[txi.rsem$length == 0] <- 1

ddsTxi <- DESeqDataSetFromTximport(txi.rsem,colData = samples,design = ~ Condition) 
Error in DESeqDataSetFromMatrix(countData = counts, colData = colData, : ncol(countData) == nrow(colData) is not TRUE

I have googled around why I might be getting this error with the DESeq package but can't seem to work out why...

Any help would be much appreciated!

rna-seq rstudio deseq R • 78 views
ADD COMMENTlink modified 11 days ago • written 11 days ago by lmck07050
1

Output of colnames(txi.rsem$counts) and the content of samples? It is pretty simple, the colData (samples) must have the same numbers of rows as txi has columns, because colData must describe each sample in txi, so what the samples are in terms of group information (=which group does each sample belong to, and which samples are replicates for the same group).

ADD REPLYlink written 11 days ago by ATpoint36k

Sorry, I made a mistake. My input was this:

samples<-read.table("RNAseq_sample3.txt",sep="\t",header=T, fill=TRUE)
files <- list.files("./",pattern=".genes.results")

names(files) <-samples$sample
txi.rsem <- tximport(files, type = "rsem", txIn = FALSE, txOut = FALSE)
txi.rsem$length[txi.rsem$length == 0] <- 1
ddsTxi <- DESeqDataSetFromTximport(txi.rsem, colData = samples,design = ~ Condition)


ddsLRT <- DESeq(ddsTxi, test="LRT", reduced= ~ 1)
resLRT <- results(ddsLRT)

resOrdered <- resLRT[order(resLRT$padj),]

topgenes <- head(rownames(resOrdered),100)
mat <- assay(vsd)[topgenes,] 
mat <- mat - rowMeans(mat)

pheatmap(mat,color = colorRampPalette(c("darkblue", "white", "darkred"))(100),border_color = NA,cluster_cols = T,fontsize_row=5,fontsize_col=6)

head(as.data.frame(resOrdered),100)
ADD REPLYlink written 11 days ago by lmck07050

Follow-up on why this condition is not returning TRUE:

ncol(countData) == nrow(colData)

In your code, these objects are:

ncol(txi.rsem) == nrow(samples)
ADD REPLYlink written 11 days ago by Kevin Blighe61k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1703 users visited in the last hour