This is a test version of Biostars. For the public version, visit https://www.biostars.org.
nohup with while loop

Hi everyone. I am trying to download a list of sra files from SRA sever. I stored all SRA accession codes in a file named accList.txt so that each line is one accession code. I want to use nohup to download all of the files automatically . I run the code below but it seems that it does not work properly.

nohup bash -c "while read -r line; do prefetch --ngc prj_26719_D29472.ngc $line ; done < accList.txt " 2>error.out

and in the out put file nohup.out I get the follwing message.

Usage:
  prefetch [options] <SRA accession> [...]
  Download SRA files and their dependencies

  prefetch [options] --cart <kart file>
  Download cart file

  prefetch [options] <URL> --output-file <FILE>
  Download URL to FILE

  prefetch [options] <URL> [...] --output-directory <DIRECTORY>
  Download URL or URL-s to DIRECTORY

  prefetch [options] <SRA file> [...]
  Check SRA file for missed dependencies and download them

can anyone please help me with this issue? thank you

bash loop sratoolkit

What is your version of the sratoolkit? I tend to remember that the ngc option has been added very recently. You can specify the file in vdb-config -i, then you do not need to specify it in the command.

I installed the latest version of SRAtoolkit. I don't think with this version specifying file vdb-config -i works. here is what I found

Somewhat related comment, but not an answer to the specific question: consider using tmux or screen instead of nohup, its much more user-friendly and powerful once you get used to it.

tmux on mosh is computer heaven

1 answer

.... .ngc $line ; done <

use simple quotes, not double quotes.... https://stackoverflow.com/questions/6697753/

this seems to work right now. Thank you!

Log in to answer this question.