2
$\begingroup$

I have multiple SRR files to download, and their accession is in a list:

SRR9004325
SRR9004326
SRR9004327

I read the NCBI document but don't find how to achieve this using the command "fastq-dump".

And I noticed that if I use the command prefetch, I can download from the list file:

prefetch --option-file SraAccList.txt

So is there any parameter in "fastq-dump" to download accessions stored in a file?

As @terdon said, it is better to use fasterq-dump, and the command: fasterq-dump --option-file SraAccList.txt doesn't work. When I try it, I just get the usage message:

$ fasterq-dump --option-file SraAccList.txt

Usage:
  fasterq-dump <path> [options]
  fasterq-dump <accession> [options]

Options:
  -F|--format                      format (special, fastq, default=fastq) 
  -o|--outfile                     output-file 
  -O|--outdir                      output-dir 
  -b|--bufsize                     size of file-buffer dflt=1MB 
  -c|--curcache                    size of cursor-cache dflt=10MB 
  -m|--mem                         memory limit for sorting dflt=100MB 
  -t|--temp                        where to put temp. files dflt=curr dir 
  -e|--threads                     how many thread dflt=6 
  -p|--progress                    show progress 
  -x|--details                     print details 
  -s|--split-spot                  split spots into reads 
  -S|--split-files                 write reads into different files 
  -3|--split-3                     writes single reads in special file 
  --concatenate-reads              writes whole spots into one file 
  -Z|--stdout                      print output to stdout 
  -f|--force                       force to overwrite existing file(s) 
  --skip-technical                 skip technical reads 
  --include-technical              include technical reads 
  -M|--min-read-len                filter by sequence-len 
  --table                          which seq-table to use in case of pacbio 
  -B|--bases                       filter by bases 
  -A|--append                      append to output-file 
  --fasta                          produce FASTA output 
  --fasta-unsorted                 produce FASTA output, unsorted 
  --fasta-ref-tbl                  produce FASTA output from REFERENCE tbl 
  --fasta-concat-all               concatenate all rows and produce FASTA 
  --internal-ref                   extract only internal REFERENCEs 
  --external-ref                   extract only external REFERENCEs 
  --ref-name                       extract only these REFERENCEs 
  --ref-report                     enumerate references 
  --use-name                       print name instead of seq-id 
  --seq-defline                    custom defline for sequence:  $ac=accession, 
                               $sn=spot-name,  $sg=spot-group, $si=spot-id,  
                                   $ri=read-id, $rl=read-length 
  --qual-defline                   custom defline for qualities:  same as 
                                   seq-defline 
  -U|--only-unaligned              process only unaligned reads 
  -a|--only-aligned                process only aligned reads 
  --disk-limit                     explicitly set disk-limit 
  --disk-limit-tmp                 explicitly set disk-limit for temp. files 
  --size-check                     switch to control: on=perform size-check 
                                   (default),  off=do not perform size-check,  
                                   only=perform size-check only 
  --ngc <PATH>                     PATH to ngc file 

  -h|--help                        Output brief explanation for the program. 
  -V|--version                     Display the version of the program then 
                                   quit. 
  -L|--log-level <level>           Logging level as number or enum string. One 
                                   of (fatal|sys|int|err|warn|info|debug) or 
                                   (0-6) Current/default is warn. 
  -v|--verbose                     Increase the verbosity of the program 
                                   status messages. Use multiple times for more 
                                   verbosity. Negates quiet. 
  -q|--quiet                       Turn off all status messages for the 
                                   program. Negated by verbose. 
  --option-file <file>             Read more options and parameters from the 
                                   file. 
for more information visit:
   https://github.com/ncbi/sra-tools/wiki/HowTo:-fasterq-dump
   https://github.com/ncbi/sra-tools/wiki/08.-prefetch-and-fasterq-dump

fasterq-dump : 3.0.6
$\endgroup$
5
  • $\begingroup$ I don't understand. What is wrong with prefetch? That's exactly what you need, right? fastq-dump (which I believe is obsolete, you should use fasterq-dump instead) is to extract fastq files from the SRR, not for downloading. $\endgroup$
    – terdon
    Commented Mar 7 at 10:19
  • $\begingroup$ @terdon From the documentation: " You can also avoid the prefetch step and download and convert the Run in one step by entering just the Run accession without the .sra extension in your fasterq-dump or sam-dump command". I just want to download the fastq file. $\endgroup$
    – Bioinfotec
    Commented Mar 7 at 13:24
  • $\begingroup$ OK, so what happens if you run fasterq-dump --option-file SraAccList.txt? If you look at the tool's options (run fasterq-dump with no arguments), it shows that the option is there. $\endgroup$
    – terdon
    Commented Mar 7 at 13:52
  • $\begingroup$ Hmm. I tried that and it doesn't seem to work. But please add that to the question. Have you gotten the command to work correctly for a single file? If so, you could just loop over the accessions. $\endgroup$
    – terdon
    Commented Mar 7 at 13:58
  • $\begingroup$ @terdon Yes, the options " --option-file" is there, but the description about it is "Read more options and parameters from the file". Emmm, it is a little confusing. $\endgroup$
    – Bioinfotec
    Commented Mar 7 at 16:32

1 Answer 1

2
$\begingroup$

If fasterq-dump can't read from a file, you can simply loop over the file yourself:

while read srr; do
  fasterq-dump "$srr" -o "$srr".fastq
done < SraAccList.txt

That will iterate over your SraAccList.txt file and extract the fastqs for each accession. I tested with this command:

fasterq-dump SRR9004325 -o ff.fastq

And that created files ff_1.fastq and ff_2.fastq, so you can expect files named like SRR9004325_1.fastq and SRR9004325_1.fastq if you use the loop above.

You could try and parallelize it but I doubt it is worth it since the bottleneck will always be the download speed.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.