# Batch Command Help

• Born
• Posts: 2

3+ Months Ago

Hi Guys,

I would like to run fastq-dump (software from the NIH that changes the format of DNA sequencing data) and repeat it (when the last process is complete) until all the .sra files in a directory are reformatted to fastq.

I have downloaded a study and the sra files are organize in a series of folders: SRP*\SRS*\SRX*\SRR*\SRA*.sra

I can easily put all the sra files into one folder (if needed) but I can't make fastq-dump do anything more than one-at-time conversion.

For example, currently I am using at windows cmd line for the file SRRXXXXX1.sra in the same folder as the fastq-dump app:

fastq-dump --split-files --gzip SRRXXXXX1.sra

I get SRRXXXX1.fastq.gzip but SRRXXXXX2.sra is left alone.

I wish I could run: fastq-dump --split-files --gzip *.sra

or fastq-dump --split-files --gzip SRP*\SRS*\SRX*\SRR*\SRA*.sra

but it doesn't appear fastq-dump supports *.sra

I am inept at batching files. I just need simple code to run fastq-dump --split-files --gzip SRXXXXX1.sra

and repeat for the next .sra file when the last file is completed (can't do at the same time, it's 200G of data).

FYI, This is for windows 7 64 bit and I have no training in programing.

Thanks!!!

I can't post a real link to the software description. If you need more info, just change the X to a v and this link will work: http://www.ncbi.nlm.nih.goX/Traces/sra/ ... fastq-dump
• Guru
• Posts: 1289
• Loc: Sydney

3+ Months Ago

If you can get it working on linux using bash would be something like this
Code: [ Select ]
for fn in *.sra
do
../bin64/fastq-dump $fn done 1. for fn in *.sra 2. do 3. ../bin64/fastq-dump$fn
4. done
• Born
• Posts: 2

3+ Months Ago

Zealous wrote:
If you can get it working on linux using bash would be something like this
Code: [ Select ]
for fn in *.sra
do
../bin64/fastq-dump $fn done 1. for fn in *.sra 2. do 3. ../bin64/fastq-dump$fn
4. done

Any equivalents to bash on windows? I am not setup to run linux or bash. Not sure where to even start with that.
• Brewmaster
• Posts: 6274
• Loc: Seattle, WA

3+ Months Ago

Create a file called "fastq-dump-all.cmd" (or anything you want, as long as the extension is .cmd) with the following:

Code: [ Select ]
FOR /R C:\dir\with\files %%G IN (*.sra) DO (
C:\path\to\fastq-dump --split-files --gzip %%G
)
1. FOR /R C:\dir\with\files %%G IN (*.sra) DO (
2.   C:\path\to\fastq-dump --split-files --gzip %%G
3. )

Replace "C:\dir\with\files" with the actual directory containing the files. Replace "C:\path\to\fastq-dump" with the actual path to the fastq-dump executable. You can find this by typing "where fastq-dump" in a Command Prompt.

Save the file and run it from the command line, or just double-click it.

## Post Information

• Total Posts in this topic: 4 posts
• Users browsing this forum: No registered users and 32 guests
• You cannot post new topics in this forum
• You cannot reply to topics in this forum
• You cannot edit your posts in this forum
• You cannot delete your posts in this forum
• You cannot post attachments in this forum