Hello,
I was wondering whether there is any way to read several sra and convert them in R?
There are quite some links here but none helps me out
Hello,
I was wondering whether there is any way to read several sra and convert them in R?
There are quite some links here but none helps me out
This solved my problem using Mac
Open a terminal
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
then
brew install sratoolkit
Then you can use the command line given by fridaymeetssunday or Devon Ryan
Not that it makes any sense but:
system(sprintf("fastq-dump --fasta %s", sra_file_name_or_accession))
@Devon Ryan why it does not make any sense? My main problem now is how to import the sra file in R. because this function is working only if you have already loaded the files in R
This doesn't require loading anything other than a file name or accession number into R (presumably done via SRAdb). The system()
command just runs fastq-dump from the command line. You're actually using the command line, just from R. So while technically this is using R, it's also cheating by not doing so. This sort of thing is convenient if you need to automagically download and process stuff from SRA, but there are probably more convenient APIs for doing this than in R.
Look through some threads here where people discuss languages for writing pipelines. R comes up as an option, since you can do things like I did above, however there's a reason it's not a popular method (it ends up not being that convenient).
@Devon Ryan sorry for basic questions! I see, however, I will check whether I see any differences in result using other ways than R or not . if this is a command line, then why I cannot get it run
> system(sprintf("fastq-dump --fasta %s", SRR000648.lite.sra))
Error in sprintf("fastq-dump --fasta %s", SRR000648.lite.sra) :
object 'SRR000648.lite.sra' not found
@Matt Shirley not really I have tried to link the full path to the file but other types of error come up like sh: fastq-dump: command not found
Not in R as such, but of you can use the package SRAdb to download the SRA and then:
system("fastq-dump SRR000648.lite.sra")
As simple as that.
@fridaymeetssunday Seems like yours does not work or I am doing something wrong
> system("fastq-dump SRR000648.lite.sra")
sh: fastq-dump: command not found
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Why use R for this task?
@Ram there are many available functions to work this out in unix etc. I am interested in R since I want to do all my analysis in R and not jumping from one to another! These days I sleep with R and wake up with R :-p so that is why I am searching for it in R :-D