Problem with DESeq package: ncol(countData) == nrow(colData) is not TRUE

Hi,

I am new to R and trying to carry out 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, 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:

setwd("C:/Users/lmck0/Desktop/RNAseq_gene_results")
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)
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!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.