![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to convert sra-lite format to fastq? | tbusch0000 | Bioinformatics | 23 | 08-21-2013 09:53 PM |
Convert fastq from NCBI SRA to fasta and qual? | kmkocot | Bioinformatics | 7 | 10-09-2012 10:15 AM |
Is it possible to convert FASTQ/FASTA files in HDF5 format? | vincebaby6 | Pacific Biosciences | 5 | 08-30-2012 07:30 AM |
How convert multiple .sra files into .fastq in one go? | TuA | Bioinformatics | 5 | 05-27-2011 09:32 AM |
Question about using sra_toolkit to transform the SRA format into FASTQ format | areyousad | Bioinformatics | 0 | 05-16-2010 11:56 PM |
![]() |
|
Thread Tools |
![]() |
#1 |
Junior Member
Location: texas Join Date: Jul 2013
Posts: 6
|
![]()
Hi guys,
I am trying to write a for loop in the terminal (im on a mac) to convert several .sra files to fastq format. SO this command works for just a single file: ./sratoolkit.2.3.2-5-mac-64/bin/fastq-dump ./SRR770514.sra Now I'm trying to use a for loop to do the same thing for multiple files. This is what I have: for fn in *.sra do ./sratoolkit.2.3.2-5-mac-64/bin/fastq-dump ./"$fn".sra done but its not working...i've tried several variations..like "$fn.sra" and even tried without the quotes but nothing works..please help |
![]() |
![]() |
![]() |
#2 |
Senior Member
Location: bethesda Join Date: Feb 2009
Posts: 700
|
![]()
get rid of the ".sra" at the end of the command line in the middle of the for loop.
You can debug by just using ls instead of the fastqdump command ... like this ... |
![]() |
![]() |
![]() |
#3 |
Junior Member
Location: texas Join Date: Jul 2013
Posts: 6
|
![]()
hmm that didnt work either
and how do I debug using ls? |
![]() |
![]() |
![]() |
#4 |
Senior Member
Location: bethesda Join Date: Feb 2009
Posts: 700
|
![]()
Get this to work
for fn in *.sra do ls -l ${fn} done |
![]() |
![]() |
![]() |
#5 |
Junior Member
Location: texas Join Date: Jul 2013
Posts: 6
|
![]()
I think the terminal is just not responding to for loops...i dont get an error or anything either
any other ideas? |
![]() |
![]() |
![]() |
#6 |
Senior Member
Location: bethesda Join Date: Feb 2009
Posts: 700
|
![]()
What shell are you running?
type "echo $SHELL" at the command prompt. The syntax I provided is "bash shell". You can run bash by simply typing "bash" and hit return at the command line. |
![]() |
![]() |
![]() |
#7 |
Junior Member
Location: texas Join Date: Jul 2013
Posts: 6
|
![]()
it says /bin/bash when i run echo $SHELL
|
![]() |
![]() |
![]() |
#8 |
Senior Member
Location: East Coast USA Join Date: Feb 2008
Posts: 7,087
|
![]()
Have you tried providing full path to the SRA files in the for loop?
Code:
for fn in *.sra do ./sratoolkit.2.3.2-5-mac-64/bin/fastq-dump /full_path_to/"$fn".sra done |
![]() |
![]() |
![]() |
#9 |
Senior Member
Location: US Join Date: Jan 2009
Posts: 392
|
![]()
Try this, its what I use.
Code:
DIR="$1/*.sra" for file in $DIR do /path/to/fastq-dump $file done |
![]() |
![]() |
![]() |
#10 |
@jamimmunology
Location: London Join Date: Nov 2012
Posts: 96
|
![]()
I feel like we've missed the easiest solution:
Code:
fastq-dump * |
![]() |
![]() |
![]() |
#11 |
Junior Member
Location: texas Join Date: Jul 2013
Posts: 6
|
![]()
Hi Jamie. You mean type the code just like that? with no loop or any of the other code?
|
![]() |
![]() |
![]() |
#12 |
@jamimmunology
Location: London Join Date: Nov 2012
Posts: 96
|
![]()
Just like that - works fine in bash anyway. If you have any files that aren't .sras in the directory you'll have to get a bit more specific, like so (with a little bit of tidying up after):
Code:
fastq-dump *.sra rm *.sra |
![]() |
![]() |
![]() |
#13 |
Member
Location: Canada Join Date: Apr 2013
Posts: 26
|
![]()
If you have multiple cores, this could be even better:
find . -name *.sra | xargs -P $NUM_CORES -n 1 fastq-dump My disk can easily handle 16 simultaneous dumps. Cheers, GH Last edited by genomeHunter; 07-25-2013 at 08:46 AM. Reason: Added find. |
![]() |
![]() |
![]() |
#14 |
@jamimmunology
Location: London Join Date: Nov 2012
Posts: 96
|
![]()
Just noticed that the solution I posted earlier doesn't work if you use the --split flag; when required I use this:
Code:
for i in *sra; do fastq-dump --split-3 $i; done |
![]() |
![]() |
![]() |
#15 |
Member
Location: Sherbrooke / Canada Join Date: Jun 2012
Posts: 72
|
![]() |
![]() |
![]() |
![]() |
Thread Tools | |
|
|