This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Tximport > DESeq2 (sample names)

Using R and tximport, I have read in 6 t_data.ctab files to create a DESeqDataSet by using DESeqDataSetFromTximport.

When plotting heatmaps etc, the sample names are '1', '2', '3', '4', '5', '6'. I suspect it has something to do with reading in the ctab files, when I run txi$counts the column headers are:

         [,1]  [,2]  [,3]  [,4]  [,5]  [,6]

I'm basing this on the bioconductor vignette: "The user should make sure the rownames of sampleTable align with the colnames of txi$counts, if there are colnames."

data <- c("/Users/Desktop/read_tables/H84S2Ctrl_S7/t_data.ctab",
      "/Users/Desktop/read_tables/H84WTCtrl_S1/t_data.ctab",
      "/Users/Desktop/read_tables/H85S2Ctrl_S8/t_data.ctab",
      "/Users/Desktop/read_tables/H85WTCtrl_S2/t_data.ctab",
      "/Users/Desktop/read_tables/H86S2Ctrl_S9/t_data.ctab",
      "/Users/Desktop/read_tables/H86WTCtrl_S3/t_data.ctab")

tmp <- read.table(data[1], header = TRUE)
tx2gene <- tmp[, c("t_name", "gene_name")]
txi <- tximport(data, type = "stringtie", tx2gene = tx2gene)
sampleNames <- c("S2Ctrl_7", "WTCtrl_1", "S2Ctrl_8", "WTCtrl_2", "S2Ctrl_9", "WTCtrl_3")
sampleGroup <- c("S2", "WT", "S2", "WT", "S2", "WT")
sampleTable <- data.frame(sampleName = sampleNames, type = sampleGroup)
rownames(sampleTable) <- colnames(txi$counts)
ddsTxi <- DESeqDataSetFromTximport(txi, sampleTable, design = ~ type)
dds <- DESeq(ddsTxi)

How can I assign the correct sample names and not 1, 2, 3, 4....?

Thank you in advance for your time

tximport deseq2 rna-seq

1 answer

Adding:

names(data) <- c("S2Ctrl_7", "WTCtrl_1", "S2Ctrl_8", "WTCtrl_2", "S2Ctrl_9", "WTCtrl_3")

below 'data' did the trick for anyone who has the same problem down the line..

Log in to answer this question.