This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Download and convert SRA file to fastq file

I am trying to download and convert SRA files to fastq files but am receiving this error. It is necessary that I use a python script. Any suggestions?

import subprocess

sra_numbers = [
    "SRR18550793", "SRR18550794", "SRR18550795", "SRR18550796"
    ]

for sra_id in sra_numbers:
    print ("Currently downloading: " + sra_id)
    prefetch = "prefetch " + sra_id
    print ("The command used was: " + prefetch)
    subprocess.call(prefetch, shell=True)

for sra_id in sra_numbers:
    print ("Generating fastq for: " + sra_id)
    fastq_dump = "fasterq-dump --outdir fasta --skip-technical --readids $
    print ("The command used was: " + fastq_dump)
    subprocess.call(fastq_dump, shell=True)

Error for all four files:

2022-05-11T02:38:53 prefetch.3.0.0: Current preference is set  to retrieve SRA Normalized Format files with full base quality scores.
2022-05-11T02:38:53 prefetch.3.0.0: 1) 'SRR18550796' is found locally
2022-05-11T02:38:53 prefetch.3.0.0: 'SRR18550796' has 0 unresolved dependencies
Generating fastq for: SRR18550793
The command used was: fasterq-dump --outdir fasta --skip-technical --readids --read-filter pass --dumpbase --split-3 --clip ~/ncbi/public/sra/SRR18550793.sra
unrecognized option: '--readids'
Generating fastq for: SRR18550794
The command used was: fasterq-dump --outdir fasta --skip-technical --readids --read-filter pass --dumpbase --split-3 --clip ~/ncbi/public/sra/SRR18550794.sra
unrecognized option: '--readids'
Generating fastq for: SRR18550795
The command used was: fasterq-dump --outdir fasta --skip-technical --readids --read-filter pass --dumpbase --split-3 --clip ~/ncbi/public/sra/SRR18550795.sra
unrecognized option: '--readids'
Generating fastq for: SRR18550796
The command used was: fasterq-dump --outdir fasta --skip-technical --readids --read-filter pass --dumpbase --split-3 --clip ~/ncbi/public/sra/SRR18550796.sra
unrecognized option: '--readids'
python sra fastq

@ rescueson why did you delete this post?

1 answer

I think you should invest some time and format the error properly, as it is difficult to read. Still:

unrecognized option: '--readids'

That seems pretty clear. Either that option doesn't exist - don't know because I don't have fasterq-dump 3.0 installed - or it lacks a complete argument. From your python script the command line seems improperly formatted with $ at the end. Maybe try something like this:

"fasterq-dump --outdir fasta --skip-technical --readids %s" % sra_id

Log in to answer this question.