Sra-Toolkit 2.3.1 Fastq-Dump Multiplefiles At Once Windows Command Line
3
1
Entering edit mode
11.7 years ago
deepbiofever ▴ 10

I am not software professional so bare with me if I am asking some silly questions.

I have downloaded SRP003329 study, which contains 20 sub-directory with .sra files. Now I am able to convert all these files individually into fastq format using fastq-dump command.

/bin/fastq-dump -A [file name] [File path] -O [output path]

but I want to know how I can do the same for all the .sra files in my dir SRP003329 at once. something like find all .sra files in my directory and fastq-dump all at once.

Thanks Deep

sra • 16k views
ADD COMMENT
5
Entering edit mode
11.7 years ago

I don't know what your tree looks like, but on a general note this should work.

Using for loop;

for i in SRP003329/*/*.sra; do fastq-dump -A $i ; done

Using GNU-Parallel

# replace the j with number of free processors in your computer
parallel -j 5 'fastq-dump {}' ::: SRP003329/*/*.sra

I don't give the output file name, it automatically takes care of it, produces file name with .fastq extension but same name.

ADD COMMENT
4
Entering edit mode
11.7 years ago

Sounds like you just need to learn how to do shell scripting. Perhaps changing to that directory and typing the following will work:

for /D %%d in (*) do ( 
    cd %%d
    for %%f in (*.sra) do (
        fastq-dump %%f
    )
    cd .. 
)

You should, of course, change the fastq-dump command to whatever exactly you need. BTW, your life is going to be more difficult if you stick to windows. You'll find much of this sort of thing to be less clunky on Linux and Mac OSX.

ADD COMMENT
0
Entering edit mode

+1 for making me realize the Windows shell can be used for something

ADD REPLY
0
Entering edit mode

Thanks, I still wouldn't recommend it. It seems clunky.

ADD REPLY
0
Entering edit mode
6.2 years ago

Create a notepad file and open it. In the file, write:

FOR %%x IN (X:\sourcepath\*.sra) DO (X:\SRAToolkitpath\fastq-dump -O X:\destionationpath %%x)pause

Save the file. Change the file extension from ".txt" to ".bat".

Run the windows cmd with administrator rights.

In the cmd, go to the SRA Toolkit folder, where you should also have the .bat file you just created. Once in the SRA Toolkit folder, run the .bat file by typing its name and hitting "enter" (be careful with spaces and stuff in the filename).

You can customize the settings of the fastq conversion by specifying between "fastq-dump" and "-O X:..." (check the SRA Toolkit docu for details).

ADD COMMENT
0
Entering edit mode

Hi,

How is your answer an enhancement/value-add over Devon's (which is over 5 years old at the moment)? If you were to mention that, it would be easier for people looking for a solution to pick yours (assuming it addresses a gap in logic that Devon's answer doesn't address).

ADD REPLY

Login before adding your answer.

Traffic: 1730 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6