我是R的新手,正在尝试对RNA-seq数据集(30个不同的gene.result文件)进行无监督的层次聚类。
我正在输入以下代码:
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)
这将返回:
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
我已经搜寻了为什么我可能会因DESeq软件包而收到此错误,但似乎无法弄清楚为什么...
任何帮助将不胜感激!