You've got some weird things goin on in this snippet:
You should avoid using setwd, does /path/quant even exists?
you're overriding dir function with the content of its result
Your csv file is ; separated?
As Kevin mentioned your files vector is empty, pay attention that you print the output of list.files() but never use this output, make sure you don't assume it's like dir
All that you need to use, from any directory, is list.files(). Once you have list.files() listing the relative paths of your quant.sf files, then everything else should be easy.
Take a look at this example, where I start at my command prompt, and then move to R:
BASH
pwd
/home/kblighe/Escritorio/DGERObj
ls -l packages/
total 26456
-rw-rw-r-- 1 kblighe kblighe 484419 May 31 2019 DGEobj_0.9.38.tar.gz
-rw-rw-r-- 1 kblighe kblighe 484224 Jun 5 2019 DGEobj_0.9.39.tar.gz
-rw-rw-r-- 1 kblighe kblighe 264419 Jun 11 2019 DGEobj_0.9.42.tar.gz
-rw-rw-r-- 1 kblighe kblighe 12870772 May 31 2019 DGE.Tools2_0.9.76.tar.gz
-rw-rw-r-- 1 kblighe kblighe 12870795 Jun 11 2019 DGE.Tools2_0.9.78.tar.gz
-rw-rw-r-- 1 kblighe kblighe 53180 May 31 2019 JRTutil_0.9.38.tar.gz
Okay, so in the first step after setting the path to directory containing quant.sf,list.files() just gives the names of the folders in that directories with one folder having quant.sf file.
Do you know how Salmon output looks like? Each folder is a library with a quant.sf file. You should list the files in the head directory (that contains all the Salmon results) and work from there. Make sure you don't mix dirs. Take your time, you'll figure it out eventually.
Thank you! As I said above I think there might be a problem as I ran salmon for multiple files together and have only one quant.sf. Now I am trying to run an array to produce different quant.sf files for each pair of files.
>all(file.exists(my.files))
TRUE
Now I am trying to create tx2gene using:
TxDb <- makeTxDbFromGFF(file = "/path/gene_models.gff")
k <- keys(TxDb, keytype = "TXNAME")
tx2gene <- select(TxDb, k, "GENEID", "TXNAME")
head(tx2gene)
But I got error:
> tx2gene <- select(TxDb, k, "GENEID", "TXNAME")
Error in UseMethod("select_") :
no applicable method for 'select_' applied to an object of class "c('TxDb', 'AnnotationDb', 'envRefClass', '.environment', 'refClass', 'environment', 'refObject', 'AssayData')"
You've got some weird things goin on in this snippet:
/path/quant
even exists?dir
function with the content of its result;
separated?files
vector is empty, pay attention that you print the output oflist.files()
but never use this output, make sure you don't assume it's likedir
Thank you! 1. I took out setwd. 2. I changed the output file name. 3. Yes. 4.
files
vector actually shows the file and run names. But I get:For Salmon, you basically just need the following components (I have taken this from one of my previous datasets):
Thank you! I have this:
But I am still getting:
I am not what is going wrong.
Do these files exist under
getwd()
?getwd()
shows thedir
name wherequant.sf
is located.All that you need to use, from any directory, is
list.files()
. Once you havelist.files()
listing the relative paths of your quant.sf files, then everything else should be easy.Take a look at this example, where I start at my command prompt, and then move to R:
BASH
R
Okay, so in the first step after setting the path to directory containing
quant.sf,
list.files()
just gives the names of the folders in that directories with one folder havingquant.sf
file.Do you know how Salmon output looks like? Each folder is a library with a
quant.sf
file. You should list the files in the head directory (that contains all the Salmon results) and work from there. Make sure you don't mix dirs. Take your time, you'll figure it out eventually.Okay. I ran salmon for multiple files together and have one quant.sf. Do I need to run it individually for each paired end fastq file.
No, you should run it separately for each sample, it may have a few files if it was sequenced in different lanes.
Side note: use
read.csv2
when we have";"
as a separator.The error implies that the length of
files
is not equal to 100. So, please check the contents of thefiles
variable.