Got it. Thank you so much. I wasn't able to catch it from vignettes page as it was written in little complicated manner and my R knowledge is very basic, not advanced. Thanks again :)
Hi everyone,
I am working with RNA-seq data analysis. I want to convert transcript counts to gene counts. I have estimate counts of transcript using Kallisto and I want to use tximport R package to get counts for gene instead of transcripts.
Basically, I have an input tsv file like this:
ENST00000431440.2 0
ENST00000390583.1 1
ENST00000390584.1 5.5
ENST00000390585.1 2.5
ENST00000430425.1 0
and I want the output with gene ids in the first column and their counts in the 2nd column.
From the vignettes page of tximport R package here: (https://bioconductor.org/packages/release/bioc/vignettes/tximport/inst/doc/tximport.html#kallisto), I very much got how to do this task using tximport but I am not understanding how to prepare the input object. I got that I have to use this:
txi.kallisto <- tximport(files, type = "kallisto", tx2gene = tx2gene, ignoreAfterBar = TRUE)
but what is files in this command and how can I prepare this input object in my situation. If someone can please help me with this.
TIA
1 answer
files for tximport should be a character vector of filenames for the transcript-level abundances (as described in the function documentation/usage), i.e.
files <- c("sample_1.abundance.tsv", "sample_2.abundance.tsv")
One easy option is to have all of the abundance.tsv files in a directory and use list.files to read all the filenames into a vector.
A small educational note: if an answer was helpful, you should upvote it; if the answer resolved your question, you should mark it as accepted. You can accept more than one answer if they all work. If an answer was not really helpful or did not work, provide detailed feedback so others know not to use that answer. 
Log in to answer this question.
This works for me, maybe you can try it: