Mercurial > repos > proteore > proteore_data_manager
changeset 51:55b12ec24a9f draft
"planemo upload commit 59b014e9f6e2d668cbd7c4844b10db3d59baefd8-dirty"
| author | proteore |
|---|---|
| date | Fri, 05 Jun 2020 13:24:48 +0000 |
| parents | 7a6d8aafb269 |
| children | 93bb1170280d |
| files | data_manager/resource_building.py data_manager/resource_building.xml |
| diffstat | 2 files changed, 10 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/data_manager/resource_building.py Mon Feb 03 14:38:16 2020 +0000 +++ b/data_manager/resource_building.py Fri Jun 05 13:24:48 2020 +0000 @@ -132,7 +132,8 @@ ####################################################################################################### # 3. ID mapping file ####################################################################################################### -import ftplib, gzip +import ftplib, gzip +from io import StringIO csv.field_size_limit(sys.maxsize) # to handle big files def id_mapping_sources (data_manager_dict, species, target_directory, tool_data_path) : @@ -280,15 +281,17 @@ 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(ftp_dir) - ftp.retrbinary("RETR " + file, open(path, 'wb').write) + ftp.cwd("pub/current_release/ac_lists/") + r = StringIO() + ftp.retrlines("RETR " + file, lambda line: r.write(line + '\n')) ftp.quit() - - return (path) + r.seek(0) + ids = r.readlines() + ids = [id.strip('\n') for id in ids if id != ''] + return (ids) #return '' if there's no value in a dictionary, avoid error def access_dictionary (dico,key1,key2) : @@ -549,7 +552,6 @@ writer.writerows(nextprot_file) for id in ids : - #print (id) query="https://api.nextprot.org/entry/"+id+".json" resp = requests.get(url=query) data = resp.json()
--- a/data_manager/resource_building.xml Mon Feb 03 14:38:16 2020 +0000 +++ b/data_manager/resource_building.xml Fri Jun 05 13:24:48 2020 +0000 @@ -1,4 +1,4 @@ -<tool id="data_manager_proteore" name="Get source files for proteore tools" version="2020.02.03.1" tool_type="manage_data"> +<tool id="data_manager_proteore" name="Get source files for proteore tools" version="2020.06.05" tool_type="manage_data"> <description> to create or update reference files for proteore tools </description>
