changeset 19:7662f6a989c9 draft

Uploaded
author scottx611x
date Wed, 22 Jun 2016 17:11:05 -0400
parents 6a67977a23da
children 315742ba24f1
files data_manager_gene_annotation/data_manager/data_manager.py
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/data_manager_gene_annotation/data_manager/data_manager.py	Wed Jun 22 16:37:34 2016 -0400
+++ b/data_manager_gene_annotation/data_manager/data_manager.py	Wed Jun 22 17:11:05 2016 -0400
@@ -29,8 +29,7 @@
 args = parser.parse_args()
 
 
-def url_download(url, name,  workdir):
-
+def url_download(url, name):
     response = requests.get(url=url, stream=True)
 
     # Create path that we will write the file to
@@ -50,10 +49,9 @@
 
 
 def main(args):
-    workdir = os.path.join(os.getcwd(), 'gene_annotation')
 
     # Attempt to download gene annotation file from given url
-    url_download(args.url, args.name, workdir)
+    gene_annotation_file_path = url_download(args.url, args.name)
 
     # Update Data Manager Json and write out
     data_manager_entry = {
@@ -62,11 +60,12 @@
                 'date': str(datetime.datetime.now()),
                 'dbkey': str(args.name),
                 'name': str(args.name),
+                'path': gene_annotation_file_path,
             }
         }
     }
 
-    with open(os.path.join(workdir, args.output), "w+") as f:
+    with open(os.path.join(args.output), "w+") as f:
         f.write(json.dumps(data_manager_entry))
 
 if __name__ == '__main__':