Previous changeset 22:b47ce1c4373e (2016-06-23) Next changeset 24:a70b4c3bdd8b (2016-06-23) |
Commit message:
planemo upload |
modified:
data_manager_gene_annotation/data_manager/data_manager.py |
b |
diff -r b47ce1c4373e -r cb42506ae8ce data_manager_gene_annotation/data_manager/data_manager.py --- a/data_manager_gene_annotation/data_manager/data_manager.py Thu Jun 23 15:11:30 2016 -0400 +++ b/data_manager_gene_annotation/data_manager/data_manager.py Thu Jun 23 15:23:35 2016 -0400 |
[ |
@@ -34,25 +34,26 @@ response = requests.get(url=url, stream=True) # Generate file_name - file_path = 'gene_annotation_{}'.format(name) + file_name = response.url.split("/")[-1] block_size = 10 * 1024 * 1024 # 10MB chunked download - with open(file_path, 'w+') as f: + with open(file_name, 'w+') as f: try: for buf in response.iter_content(block_size): f.write(buf) except (ContentDecodingError, IOError) as e: sys.stderr.write("Error occured downloading reference file: %s" % e) - os.remove(file_path) + os.remove(file_name) - return file_path + return file_name def main(args): # Attempt to download gene annotation file from given url - gene_annotation_file_path = url_download(args.url, args.name) + gene_annotation_file_name = url_download( + "http://www.scott-ouellette.com/gene_annotations/chr1-hg19_genes.gtf", args.name) # Update Data Manager JSON and write to file data_manager_entry = { @@ -60,8 +61,8 @@ 'gene_annotation': { 'value': str(datetime.datetime.now()), 'dbkey': str(args.name), - 'name': str(args.name), - 'path': gene_annotation_file_path, + 'name': gene_annotation_file_name.split(".")[0], + 'path': gene_annotation_file_name, } } } |