Last active
April 15, 2021 12:50
-
-
Save TTTPOB/9c52a1ebd10ee7383bda245663e252a0 to your computer and use it in GitHub Desktop.
NCBI SRR to fastq.gz, save your time by skipping the `fasterq-dump`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: utf-8 | |
# see https://blog.tpob.xyz/2021/03/24/%E6%9B%B4%E5%BF%AB%E4%B8%8B%E8%BD%BDsra%E6%95%B0%E6%8D%AE%E5%BA%93%E4%B8%AD%E7%9A%84fastq.gz%E6%96%87%E4%BB%B6/ for more | |
import requests | |
import json | |
import sys | |
accesion=sys.argv[1] | |
### Uncomment and modify these lines if you need proxy | |
#proxies = { | |
# "http": "http://localhost:7890", | |
# "https": "http://localhost:7890", | |
#} | |
json_url="https://www.ebi.ac.uk/ena/portal/api/filereport?accession="+accesion+"&result=read_run&fields=fastq_ftp&format=json&download=true" | |
# proxied request if you need | |
# fastq_ftp_url=["ftp://"+ link for link in json.loads(requests.get(url=json_url,proxies=proxies).text)[0]["fastq_ftp"].split(";")] | |
fastq_ftp_url=["ftp://"+ link for link in json.loads(requests.get(url=json_url).text)[0]["fastq_ftp"].split(";")] | |
for link in fastq_ftp_url: | |
print(link) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment