changeset 54:109fc5236204 draft

"planemo upload commit ebdd6549d01d60be6f07abca06f6ce4e2b6beda1"
author proteore
date Mon, 08 Jun 2020 14:36:25 +0000
parents bb552aa4b9ac
children 9fda95925297
files data_manager/resource_building.py data_manager/resource_building.xml
diffstat 2 files changed, 19 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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()
 
--- 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 @@
-<tool id="data_manager_proteore" name="Get source files for proteore tools" version="2020.06.05.2" tool_type="manage_data">
+<tool id="data_manager_proteore" name="Get source files for proteore tools" version="2020.06.08" tool_type="manage_data">
 <description>
 to create or update reference files for proteore tools
 </description>