My plan is to do differential expression analysis with DESeq2 package from the count data that I have obtained from Kallisto software (alignment-free tool). I have two samples. So, I did as below:
> datadir <- "/scratch/gh/" > meta <- read.delim(paste0(datadir, "/se/se_meta.txt"), header = TRUE, as.is = TRUE) > rownames(meta) <- meta$names > meta$trt <- factor(meta$trt) > meta$cell <- factor(meta$cell) # > library(tximport) > files <- list.files("/scratch/gh/se/kallisto/", pattern = ".*-abundance.tsv", full.names = TRUE) > tx <- suppressMessages(tximport(files = files, type = "kallisto", txOut = TRUE)) ### The tx object contains the transcript expression extimates of my two samples. > tx.counts <- round(tx$counts) > colnames(tx.counts) <- sub("_.*","",basename(files)) # ### Next, I summarised them at the gene level: > tx2gene <- data.frame( TX=rownames(tx.counts), GENEID=sub("\\.\\d+$","",rownames(tx.counts))) # > count.table <- round(summarizeToGene(tx, tx2gene)$counts) > colnames(count.table) <- sub("_.*","",basename(files)) # > class(count.table)  "matrix" #
Now, to be able to do differential expression analysis with DESeq2 package, I need to build a DESeqDataSet objest from my count matrix which is count.table. However, when I run the below code, I get the following ERROR:
# > stopifnot(all(colnames(count.table) == rownames(meta))) Error: all(colnames(count.table) == rownames(meta)) is not TRUE
I also ran the below codes to see what is different between my rownames(meta) and colnames(count.table):
> colnames(count.table)  "SRR6822797-sortmerna-trimmomatic-abundance.tsv"  "SRR6822798-sortmerna-trimmomatic-abundance.tsv" > rownames(meta)  "SRR6822797" "SRR6822798"
I think to fix this ERROR, I need to have my colnames(count.table) as exactly like my rownames(meta). Would you please help me how to make the output of my colnames(count.table) as "SRR6822797" "SRR6822798" ?
Thank you very much.