# HG changeset patch # User proteore # Date 1591626985 0 # Node ID 109fc5236204c15dadd610d44bed65f1ff67ed3f # Parent bb552aa4b9ac150931c17f1df1ed5b189b3eda52 "planemo upload commit ebdd6549d01d60be6f07abca06f6ce4e2b6beda1" diff -r bb552aa4b9ac -r 109fc5236204 data_manager/resource_building.py --- a/data_manager/resource_building.py Fri Jun 05 13:49:53 2020 +0000 +++ b/data_manager/resource_building.py Mon Jun 08 14:36:25 2020 +0000 @@ -235,7 +235,7 @@ #add missing nextprot ID for human or replace old ones if human : #build next_dict - nextprot_path = id_list_from_nextprot_ftp("nextprot_ac_list_all.txt",target_directory) + nextprot_path = download_from_nextprot_ftp("nextprot_ac_list_all.txt",target_directory) with open(nextprot_path,'r') as nextprot_ids : nextprot_ids = nextprot_ids.read().splitlines() if os.path.exists(os.path.join(archive,nextprot_path.split("/")[-1])) : os.remove(os.path.join(archive,nextprot_path.split("/")[-1])) @@ -280,6 +280,16 @@ ftp.quit() return (path) +def download_from_nextprot_ftp(file,target_directory) : + ftp_dir = "pub/current_release/ac_lists/" + path = os.path.join(target_directory, file) + ftp = ftplib.FTP("ftp.nextprot.org"") + ftp.login("anonymous", "anonymous") + ftp.cwd(ftp_dir) + ftp.retrbinary("RETR " + file, open(path, 'wb').write) + ftp.quit() + return (path) + def id_list_from_nextprot_ftp(file,target_directory) : ftp_dir = "pub/current_release/ac_lists/" path = os.path.join(target_directory, file) @@ -552,6 +562,13 @@ for id in ids : query="https://api.nextprot.org/entry/"+id+".json" + try: + resp = requests.get(url=query) + except : + print ("wainting 10 minutes before trying again") + time.sleep(600) + resp = requests.get(url=query) + data = resp.json() resp = requests.get(url=query) data = resp.json() diff -r bb552aa4b9ac -r 109fc5236204 data_manager/resource_building.xml --- a/data_manager/resource_building.xml Fri Jun 05 13:49:53 2020 +0000 +++ b/data_manager/resource_building.xml Mon Jun 08 14:36:25 2020 +0000 @@ -1,4 +1,4 @@ - + to create or update reference files for proteore tools