前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >RNA-seq(2)-1:原始数据下载的几种方法

RNA-seq(2)-1:原始数据下载的几种方法

作者头像
Y大宽
发布2018-09-10 11:40:35
4.7K0
发布2018-09-10 11:40:35
举报
文章被收录于专栏:Y大宽Y大宽Y大宽

How to download All Sra data At Once

SRA: Sequence Read Archive: It belongs to NCBI (National Center for Biotechnology Information), is a database storing high throughput sequencing (HTS) raw data, alignment information and metadata. Almost all HTS data in published publications will be asked uploading to here, and stored as .sra compressed file format.

ENA: European Nucleotide Archive: It belongs to EBI (European Bioinformatics Institute), although it has the same funtion with SRA, more annotations and friendlier website make it preferable. What’s more, you could download directly fastq.gz files from it.

下载sra files的目的是为了获得相应的fastq或sam files,进而进行分析。


第1选择--Aspera Connect 如果aspera connect不能下载,推荐sratoolkit的prefetch功能。尽量不要用wget或curl下载,速度慢,且有时下载不完全

注意:Aspera>Sratools>ftp

第1选择:Aspera Connect

-Aspera connect是IBM的商业化高速文件下载软件,但可以免费下载NCBI和EBI的数据。速度可达200-500Mbps,几乎所有站点都超过10Mbps

-如果Aspera connect不能下载,则推荐sratoolkit的prefetch功能

-最后,尽量使用sratoolkit中的fastq-dumpsam-dump命令。如果fastq-dump连接外部稳定,则推荐使用Biostar Handbook中的wonderdump脚本。

警告:尽量不要使用wgetcurl命令来下载

原文链接

Aspera有两种方式可以下载
第一,安装客户端(支持windows),

下载链接

具体可参考这篇文章

第二,命令行下载
关于第一种方式 ,下载直接安装即可,下载链接h
Aspera Connect命令行工具-ascp

首先,goto Aspera connect,选择linux版本,复制链接地址(这个需要代理下载)

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
 
# install
bash aspera-connect-3.7.4.147727-linux-64.sh

# check the .aspera directory
cd # go to root directory
ls -a # if you could see .aspera, the installation is OK

# add environment variable
echo 'export PATH=~/.aspera/connect/bin:$PATH' >> ~/.bashrc
source ~/.bashrc   

#密钥备份到/home/的家目录(后面会用,否则报错)
cp ~/.aspera/connect/etc/asperaweb_id_dsa.openssh ~/

# check help file
ascp --help 
恭喜,安装完成,开始下载,感受飞一般的速度
下载SRA数据:SRA数据库
注意:要找到下载地址,windows需要使用ie浏览器(google不可以)。进入下列网站https://www.ncbi.nlm.nih.gov/projects/faspftp/

若下载sra,依次:sra-sra-instant-reads-ByRun-sra-SRR-SRR###-SRR###$$$-SRR###$$$.sra

比如下载SRR949627.sra文件

ascp -v -i ~/.aspera/connect/etc/asperaweb_id_dsa.openssh -k 1 -T -l200m anonftp@ftp-private.ncbi.nlm.nih.gov:/sra/sra instant/reads/ByRun/sra/SRR/SRR949/SRR949627/SRR949627.sra .

如果报ascp: Source file list not specified, exiting,看下最后那个点是否加了,有空格
注意:最后那个.一定要有,表示下载后的路径,我的速度大概5M/s,比起wget和prefetch已经是在奔跑了。

ENA数据库下载

数据的存放地址是fasp.sra.ebi.ac.uk,ENA在Aspera的用户名是era-fasp,注意,ena可以直接下载fastq.gz文件,不必再从sra文件转换了。地址去ENA搜索,再复制fastq.gz文件的地址,或者去ENA的ftp地址ftp.sra.ebi.ac.uk搜索,注意是ftp不是fasp。

ascp -QT -l 300m -P33001 -i ~/.aspera/connect/etc/asperaweb_id_dsa.openssh era-fasp@fasp.sra.ebi.ac.uk:/vol1/fastq/SRR949/SRR949627/SRR949627_1.fastq.gz .
至此,完成原始数据下载!!

3下面再看下不推荐的方法如何下载数据。


1 use R

比如要下载下列数据 https://www.ncbi.nlm.nih.gov/sra

1使用SRAdb包
source('http://bioconductor.org/biocLite.R') 
biocLite('SRAdb') 
library(SRAdb) 
srafile = getSRAdbFile() 
con = dbConnect('SQLite',srafile)  
2使用GEOquery包
library(GEOquery)
gse <- getGEO('GSE48138') # retrieves a GEO list set for your SRA id.
## see what is in there:
show(gse)
# There are 2 sets of samples for that ID
##  what you want is table a with SRR to download and some sample information:
## lets see what the first set contains:
df <- as.data.frame(gse[[1]])
head(df)

2 使用命令行ftp下载

1 wget命令

比如

wget ftp://ftp-trace.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByStudy/sra/SRP%2FSRP055%2FSRP055992/SRR1871481/SRR1871481.sra
2 SRA toolkit的prefetch命令

比如,单个下载

prefetch -v SRR925811

或批量下载

for i in `seq 48 62`; 

do 

prefetch SRR35899${i} 

done

还可以多个一起下载 先找到要下载的页面,比如https://www.ncbi.nlm.nih.gov/sra,然后右上角,send to-file,format选择accession list,保存为一个file(默认是SraAccList.txt),然后 prefetch $(<SraAccList.txt)

另外,还可以尝试geofetch功能,具体见

https://github.com/pepkit/geofetch


总结

虽然相对麻烦,建议还是用Aspera进行下载,速度是真的快。其次是prefetch,最后再是wget
R也很慢。等回头看看有没有快速下载的方法。
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2018.07.29 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • How to download All Sra data At Once
    • 下载sra files的目的是为了获得相应的fastq或sam files,进而进行分析。
    • 第1选择:Aspera Connect
      • ENA数据库下载
      • 3下面再看下不推荐的方法如何下载数据。
        • 1 use R
          • 2 使用命令行ftp下载
          • 总结
          相关产品与服务
          命令行工具
          腾讯云命令行工具 TCCLI 是管理腾讯云资源的统一工具。使用腾讯云命令行工具,您可以快速调用腾讯云 API 来管理您的腾讯云资源。此外,您还可以基于腾讯云的命令行工具来做自动化和脚本处理,以更多样的方式进行组合和重用。
          领券
          问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档