Skip to content

Commit

Permalink
dfast_file_downloader.py updated (http download from NCBI)
Browse files Browse the repository at this point in the history
  • Loading branch information
谷沢靖洋 committed Jan 29, 2021
1 parent aaafce8 commit 46f520c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions scripts/dfast_file_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
"TIGR": "https://ftp.ncbi.nlm.nih.gov/hmm/TIGRFAMs/release_15.0/TIGRFAMs_15.0_HMM.LIB.gz"
}

cdd_url = "https://ftp.ncbi.nlm.nih.gov//pub/mmdb/cdd/little_endian/DBNAME_LE.tar.gz"

description = """\
DFAST file downloader\n\
Expand Down Expand Up @@ -114,8 +116,8 @@ def retrieve_hmm(db_name, out_dir="."):
logger.info("\tDownloading {}".format(target_url))
return output_file


def retrieve_cdd(db_name, out_dir="."):
# deprecated
def retrieve_cdd_ftp(db_name, out_dir="."):
ftp = FTP(host=ncbi_ftp_server)
logger.info("\tLogging in to the FTP server. {}".format(ncbi_ftp_server + cdd_directory))
ftp.login()
Expand All @@ -129,6 +131,14 @@ def retrieve_cdd(db_name, out_dir="."):
ftp.quit()
return output_file

def retrieve_cdd(db_name, out_dir="."):
target_url = cdd_url.replace("DBNAME", db_name)
target_file = os.path.basename(target_url)
output_file = os.path.join(out_dir, target_file)
request.urlretrieve(target_url, output_file)
logger.info("\tDownloading {}".format(target_url))
return output_file

def retrieve_assembly(accession, out_dir="."):
def _get_ftp_directory(accession):
path1, path2, path3, path4 = accession[0:3], accession[4:7], accession[7:10], accession[10:13]
Expand Down

0 comments on commit 46f520c

Please sign in to comment.