diff data_manager/resource_building.py @ 53:bb552aa4b9ac draft

"planemo upload commit 59b014e9f6e2d668cbd7c4844b10db3d59baefd8-dirty"
author proteore
date Fri, 05 Jun 2020 13:49:53 +0000
parents 55b12ec24a9f
children 109fc5236204
line wrap: on
line diff
--- a/data_manager/resource_building.py	Fri Jun 05 13:38:12 2020 +0000
+++ b/data_manager/resource_building.py	Fri Jun 05 13:49:53 2020 +0000
@@ -281,17 +281,16 @@
     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)
     ftp = ftplib.FTP("ftp.nextprot.org")
     ftp.login("anonymous", "anonymous") 
-    ftp.cwd("pub/current_release/ac_lists/")
-    r = StringIO()
-    ftp.retrlines("RETR " + file, lambda line: r.write(line + '\n'))
+    ftp.cwd(ftp_dir)
+    ftp.retrbinary("RETR " + file, open(path, 'wb').write)
     ftp.quit()
-    r.seek(0)
-    ids = r.readlines()
-    ids = [id.strip('\n') for id in ids if id != '']
-    return (ids)
+    with open(path,'r') as nextprot_ids :
+        nextprot_ids = nextprot_ids.read().splitlines()
+    return (nextprot_ids)
 
 #return '' if there's no value in a dictionary, avoid error
 def access_dictionary (dico,key1,key2) :