Question: is there any way to covert SRA files to Fasta in R ?
2
gravatar for Mo
6.0 years ago by
Mo920
/
Mo920 wrote:

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 

Sra Format Usage - How To

https://biostar.usegalaxy.org/p/8226/

R rna-seq sra fasta • 3.9k views
ADD COMMENTlink modified 6.0 years ago • written 6.0 years ago by Mo920
2

Why use R for this task?

ADD REPLYlink written 6.0 years ago by Ram32k
1

@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

ADD REPLYlink written 6.0 years ago by Mo920
3
gravatar for Mo
6.0 years ago by
Mo920
/
Mo920 wrote:

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 

 

ADD COMMENTlink modified 6.0 years ago • written 6.0 years ago by Mo920

You answered your own question... extra points for that :)

To be fair we should have explicitly told you that you needed fastq-dump in your system to execute that command.

ADD REPLYlink written 6.0 years ago by A. Domingues2.4k
2
gravatar for Devon Ryan
6.0 years ago by
Devon Ryan98k
Freiburg, Germany
Devon Ryan98k wrote:

Not that it makes any sense but:

system(sprintf("fastq-dump --fasta %s", sra_file_name_or_accession))
ADD COMMENTlink modified 6.0 years ago • written 6.0 years ago by Devon Ryan98k

@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 

ADD REPLYlink written 6.0 years ago by Mo920
2

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).
 

ADD REPLYlink written 6.0 years ago by Devon Ryan98k

@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

ADD REPLYlink written 6.0 years ago by Mo920

I think you need the full path to the file. The system call does not start from the current R session working directory.

ADD REPLYlink written 6.0 years ago by Matt Shirley9.5k

@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

ADD REPLYlink written 6.0 years ago by Mo920

My advice at this point: try running the command in your unix shell first. It seems that you have not installed the SRA toolkit, or that the shell invoked by R's system call does not find your PATH env variable, or both. 

ADD REPLYlink written 6.0 years ago by Matt Shirley9.5k

Dump the command in to your system. :)

ADD REPLYlink written 6.0 years ago by geek_y11k
2
gravatar for A. Domingues
6.0 years ago by
A. Domingues2.4k
Dresden, Germany
A. Domingues2.4k wrote:

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.

 

ADD COMMENTlink modified 6.0 years ago • written 6.0 years ago by A. Domingues2.4k

Looks like I posted just after you clicked on the question :P

ADD REPLYlink written 6.0 years ago by Devon Ryan98k
1

Pretty much ;) The time it took me to add the link to SRAdb was enough to be thwarted!

ADD REPLYlink written 6.0 years ago by A. Domingues2.4k

@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

ADD REPLYlink modified 6.0 years ago • written 6.0 years ago by Mo920
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1995 users visited in the last hour
_