使用Aspera,wget和 prefetch下載SRA數(shù)據(jù)

  • 下載Accession list

進入NCBI——進入SRA數(shù)據(jù)庫——輸入物種拉丁名——選擇Send to中的Run
Selector——Go

image.png

點擊Accession list即可下載,用于后續(xù)下載原始數(shù)據(jù)的輸入文件


image.png
[gaozhh01@login ~]$ cd biosoft/
wget http://download.asperasoft.com/download/sw/connect/3.7.4/aspera-connect-3.7.4.147727-linux-64.tar.gz
tar zxvf aspera-connect-3.7.4.147727-linux-64.tar.gz
bash aspera-connect-3.7.4.147727-linux-64.sh 
cd ..
ls -a #查看根目錄下有無.aspera文件夾
echo 'export PATH=~/.aspera/connect/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
ascp --help #查看是否可以使用

使用

ascp -QTr -l 300M -k 1 -i ~/.aspera/connect/etc/asperaweb_id_dsa.openssh  anonftp@ftp-private.ncbi.nlm.nih.gov:/sra/sra-instant/reads/ByRun/sra/ERR/ERR516/ERR5167434/ERR5167434.sra ./

#報錯
ascp: Failed to open TCP connection for SSH, exiting.

Session Stop  (Error: Failed to open TCP connection for SSH)

卒 若軟件可使用,可參考https://zhuanlan.zhihu.com/p/336794183
代碼轉自https://zhuanlan.zhihu.com/p/336794183

# Main program

#下載ENA數(shù)據(jù)
#如果SRR_Acc_List記錄的樣本編號是類似ERR526291,即ERR+6位數(shù)時,運行以下代碼下載數(shù)據(jù)
cat SRR_Acc_List.txt|while read id
do
x=$(echo $id | cut -b1-6)
echo $id
ascp -QT -l 300m -P33001  -i \
${wkd}/asperaweb_id_dsa.openssh \
era-fasp@fasp.sra.ebi.ac.uk:/vol1/fastq/$x/$id/ ./
done

#########################################################

# Main program
#如果SRR_Acc_List記錄的樣本編號是類似SRR1016916,即ERR+7位數(shù)時,運行以下代碼下載數(shù)據(jù) 
#需要加一個006,
cat SRR_Acc_List.txt|while read id
do
x=$(echo $id | cut -b1-6)
y=$(echo $id | cut -b10-10)
echo $id
ascp -QT -l 300m -P33001  -i \
${wkd}/asperaweb_id_dsa.openssh \
era-fasp@fasp.sra.ebi.ac.uk:/vol1/fastq/$x/00$y/$id/ ./
done

#Best Regards,  
#Yuan.SH  
#please contact with me via the following ways:  
#(a) e-mail :yuansh3354@163.com  
  • 使用wget下載
wget https://sra-download.ncbi.nlm.nih.gov/traces/era19/ERR/ERR5167/ERR5167434
wget https://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/2.11.0/sratoolkit.2.11.0-centos_linux64.tar.gz
tar zxvf sratoolkit.2.11.0-centos_linux64.tar.gz
echo 'export PATH=/gss1/home/gaozhh01/biosoft/sratoolkit.2.11.0-centos_linux64/bin:$PATH' >> ~/.bashrc
source .bashrc

也可以不添加環(huán)境變量,直接調用

~/tools/sratoolkit.2.11.0-ubuntu64/bin/prefetch ERR5167434
#如果下載多個sra數(shù)據(jù),則將sra號放在一個文件里download_id.txt
nohup ~/tools/sratoolkit.2.11.0-ubuntu64/bin/prefetch --option-file download_id.txt >xing.log 2>&1 &

也可以用循環(huán)
cat download_id.txt | while read id; do (prefetch $id); done

將sra數(shù)據(jù)轉化為fastq文件


~/tools/sratoolkit.2.11.0-ubuntu64/bin/fastq-dump --split-3 ERR5167434 
#如果有多個數(shù)據(jù)則
cat download_id.txt | while read a;do fastq-dump --split-3 ${a}.sra; done 
或者
ls *.sra > ls.log

for i in $(cat ls.log)
do
  ~/tools/sratoolkit.2.11.0-ubuntu64/bin/fastq-dump --split-3 $i 
done

或者掛后臺循環(huán)
ls *.sra > ls.log

for i in $(cat ls.log)
do
  ~/tools/sratoolkit.2.11.0-ubuntu64/bin/fastq-dump --split-3 $i  & >/dev/null
done
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

友情鏈接更多精彩內容