1、背景
最近,在使用TCGA数据,需要从TCGA下载数据。当数据文件数量较少的时候,为了偷懒(其实也麻烦),可以一个一个的下载。但又有时候为了获取更多的数据,我们可以通过 gdc-client 程序,基于manifest进行批量下载。
问题来了:采用gdc-client(linus)/ gdc-client.ext(Windows)download -m gdc-manifest.txt下载的时候,时常中断???
2、解决办法
修改 gdc-client download 的配置文件。
2.1 查看默认配置文件
命令:./gdc-client settings download
./gdc-client settings download
[download]
dir = .
save_interval = 1073741824
http_chunk_size = 1048576
no_segment_md5sum = False
no_file_md5sum = False
no_verify = False
no_related_files = False
no_annotations = False
no_auto_retry = False
retry_amount = 1
wait_time = 5.0
server = https://api.gdc.cancer.gov
n_processes = 8
2.2 优化配置文件
新的文件名称:gdc-client.dtt
优化内容如下:主要可以配置的是http_chunk_size、wait_time、retry_amount、no_verify、n_processes
[download]
no_auto_retry = False
no_file_md5sum = False
save_interval = 1073741824
retry_amount = 6
n_processes = 4
no_annotations = False
no_related_files = False
http_chunk_size = 4096
no_segment_md5sum = False
server = https://api.gdc.cancer.gov
wait_time = 25.0
no_verify = True
dir = .
优化点:
(1)http_chunk_size
:http请求的数据块大小。如果越大,请求等待的时间越长,从而导致请求超时,下载中断。所以,为了保证每一次请求数据块都能顺利到达本地,可以适当调小一点(关键步骤)
(2)wait_time
:http请求的等待时间,如果超过这个等待时间,下载会中断,可适当调大一点
(3)retry_amount
:http请求重试次数,比如说超过等待时间,就会再重新尝试访问,尝试访问次数超过设定值,下载就会中断,可以适当调大一点
(4)no_verify
:为了加快下载速度,可以不做校验(但不保证数据的完整性)
(5)n_processes
:下载需要的核数,依据自己的CPU大小进行配置
2.3 执行
gdc-client.exe download --config gdc-client.dtt -m gdc_manifest.txt