在GEO网站上直接点击下载数据时,可能会遇到下载中断或速度过慢的问题,此时可以尝试以下几种替代方法来获取数据。
经典GEOquery包,把timeout设置长一点
options(timeout = 6000000) # 时间设置长一点
library(GEOquery)
# 指定数据集的 accession number
accession_number <- "GSE277066"
getGEOSuppFiles(
accession_number, #
makeDirectory = TRUE,
baseDir = getwd(),
fetch_files = TRUE,
filter_regex = NULL
)
getGEOSuppFiles(accession_number)
trying URL 'https://ftp.ncbi.nlm.nih.gov/geo/series/GSE277nnn/GSE277066/suppl//GSE277066_RAW.tar?tool=geoquery'
Content type 'application/x-tar' length 316456960 bytes (301.8 MB)
从这个URL(统一资源定位符,链接)可以看出,只要去掉末尾的 /GSE277066_RAW.tar?tool=geoquery 部分,就能得到该数据集的基础下载路径(https://ftp.ncbi.nlm.nih.gov/geo/series/GSE277nnn/GSE277066/suppl/)。通过这种方式,我们可以手动构建或获取 GEO 数据的下载链接。
curl下载工具一般电脑会自带
curl -C - -O https://ftp.ncbi.nlm.nih.gov/geo/series/GSE242nnn/GSE242469/suppl/GSE242469_RAW.tar
nohup curl -C - -O https://ftp.ncbi.nlm.nih.gov/geo/series/GSE242nnn/GSE242469/suppl/GSE242469_RAW.tar > curl.log 2>&1 &
# 之后可以用
tail curl.log查看内容
安装wget
brew install wget
替换后面的下载链接,由于wget有递归下载功能,因此其可以抓取整个目录下所有链接的文件,也就是说其不需要指定特定文件夹,非常适合用于数据集中存在很多单独的文件。
wget -r -np -k -p -e robots=off https://ftp.ncbi.nlm.nih.gov/geo/series/GSE240nnn/GSE240839/suppl/
nohup wget -r -np -k -p -e robots=off https://ftp.ncbi.nlm.nih.gov/geo/series/GSE240nnn/GSE240839/suppl/ > wget.log 2>&1 &
# 之后可以用
tail wget.log查看内容
安装axel
brew install axel
axel的优势在于其可以进行多线程下载,-n 20
axel -n 20 https://ftp.ncbi.nlm.nih.gov/geo/series/GSE271nnn/GSE271243/suppl/GSE271243_RAW.tar
nohup axel -n 20 https://ftp.ncbi.nlm.nih.gov/geo/series/GSE271nnn/GSE271243/suppl/GSE271243_RAW.tar > axel.log 2>&1 &
注:若对内容有疑惑或者有发现明确错误的朋友,请联系后台(欢迎交流)。更多相关内容可关注公众号:生信方舟 。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。