Easiest Way to Download All Sra Samples or Multi Experiment file from NCBI SRA database- II

Previously I shared a easy way to download the data files from NCBI SRA database. Although it took only wget to download the data files but it required lots of link editing. Here I am going to share another script which can download all files of any biostudy or a single file, depending upon the accession number provided to the script. This bash script will also simultaneously convert the native sra file into fastq files also. Hope it will be some help.

sra_download.sh


#!/bin/bash
id=$1
if [ "$#" -eq  "0" ]
 then
   echo "No accession number provided"
   exit 1
else
   echo -n "Please wait...."
   esearch -db sra -query $id  | efetch --format runinfo | cut -d ',' -f 1 | grep SRR | xargs fastq-dump --split-files
   echo
   echo -n "Download complete...."
   echo
fi


Save the script as sra_download.sh and run as
 bash sra_download.sh SRA_accession_number 
You can use any kind of accession number including SRR3114162, PRJNA309373 or SRP068795. I have tested this script on Ubuntu and assume that Entrez Direct and NCBI SRA Toolkit is installed on your machine.
Extract Part of a FASTA Sequences with Position by python script HERE

No comments:

Post a Comment

Have Problem ?? Drop a comments here!