diff data_manager_gene_annotation/data_manager/data_manager.py @ 22:b47ce1c4373e draft

planemo upload
author scottx611x
date Thu, 23 Jun 2016 15:11:30 -0400
parents 7662f6a989c9
children cb42506ae8ce
line wrap: on
line diff
--- a/data_manager_gene_annotation/data_manager/data_manager.py	Thu Jun 23 14:25:15 2016 -0400
+++ b/data_manager_gene_annotation/data_manager/data_manager.py	Thu Jun 23 15:11:30 2016 -0400
@@ -12,7 +12,6 @@
                     dest='output',
                     action='store',
                     help='JSON filename',
-                    default="gene_annotation.json"
                     )
 parser.add_argument('--name',
                     dest='name',
@@ -30,10 +29,12 @@
 
 
 def url_download(url, name):
+    # Good to note here that requests will automatically handle
+    # content_encoding types: "gzip" and "deflate"
     response = requests.get(url=url, stream=True)
 
-    # Create path that we will write the file to
-    file_path = 'download_{}.dat'.format(name)
+    # Generate file_name
+    file_path = 'gene_annotation_{}'.format(name)
 
     block_size = 10 * 1024 * 1024  # 10MB chunked download
     with open(file_path, 'w+') as f:
@@ -53,11 +54,11 @@
     # Attempt to download gene annotation file from given url
     gene_annotation_file_path = url_download(args.url, args.name)
 
-    # Update Data Manager Json and write out
+    # Update Data Manager JSON and write to file
     data_manager_entry = {
         'data_tables': {
             'gene_annotation': {
-                'date': str(datetime.datetime.now()),
+                'value': str(datetime.datetime.now()),
                 'dbkey': str(args.name),
                 'name': str(args.name),
                 'path': gene_annotation_file_path,