# HG changeset patch
# User scottx611x
# Date 1466719007 14400
# Node ID 7af38f95bc8dc311b0532e83b406d5b2d555f953
# Parent f38beb0743d5bf3c66f6046b3c0d8b67e2f22b9d
planemo upload
diff -r f38beb0743d5 -r 7af38f95bc8d data_manager_gene_annotation/data_manager/data_manager.py
--- a/data_manager_gene_annotation/data_manager/data_manager.py Thu Jun 23 17:18:20 2016 -0400
+++ b/data_manager_gene_annotation/data_manager/data_manager.py Thu Jun 23 17:56:47 2016 -0400
@@ -7,28 +7,14 @@
import requests
from requests.exceptions import ContentDecodingError
-parser = argparse.ArgumentParser(description='Create data manager json.')
-parser.add_argument('--out',
- dest='output',
- action='store',
- help='JSON filename',
- )
-parser.add_argument('--name',
- dest='name',
- action='store',
- default=uuid.uuid4(),
- help='Data table entry unique ID'
- )
-parser.add_argument('--url',
- dest='url',
- action='store',
- help='Download URL'
- )
-
-args = parser.parse_args()
-
def url_download(url):
+ """Attempt to download gene annotation file from a given url
+ :param url: NodeSet UUID.
+ :type url: str.
+ :returns: name of downloaded gene annotation file
+ :raises: ContentDecodingError, IOError
+ """
response = requests.get(url=url, stream=True)
# Generate file_name
@@ -38,7 +24,8 @@
with open(file_name, 'w+') as f:
try:
# Good to note here that requests' iter_content() will
- # automatically handle decoding "gzip" and "deflate" formats
+ # automatically handle decoding "gzip" and "deflate" encoding
+ # formats
for buf in response.iter_content(block_size):
f.write(buf)
except (ContentDecodingError, IOError) as e:
@@ -46,14 +33,22 @@
% e)
os.remove(file_name)
- with open("/Users/scott/Desktop/cool.txt", "w+") as f:
- f.write(os.path.join(os.getcwd(), file_name))
- f.write("\n")
-
return file_name
-def main(args):
+def main():
+
+ # Generate and parse command line args
+ parser = argparse.ArgumentParser(description='Create data manager JSON.')
+ parser.add_argument('--out', dest='output', action='store',
+ help='JSON filename')
+ parser.add_argument('--name', dest='name', action='store',
+ default=uuid.uuid4(), help='Data table entry unique ID'
+ )
+ parser.add_argument('--url', dest='url', action='store',
+ help='Url to download gtf file from')
+
+ args = parser.parse_args()
work_dir = os.getcwd()
@@ -76,4 +71,4 @@
f.write(json.dumps(data_manager_entry))
if __name__ == '__main__':
- main(args)
+ main()
diff -r f38beb0743d5 -r 7af38f95bc8d data_manager_gene_annotation/data_manager_conf.xml
--- a/data_manager_gene_annotation/data_manager_conf.xml Thu Jun 23 17:18:20 2016 -0400
+++ b/data_manager_gene_annotation/data_manager_conf.xml Thu Jun 23 17:56:47 2016 -0400
@@ -8,11 +8,11 @@
-
+
- ${dbkey}/gene_annotations/${name}
+ gene_annotations/${name}
- ${GALAXY_DATA_MANAGER_DATA_PATH}/${dbkey}/gene_annotations/${name}
+ ${GALAXY_DATA_MANAGER_DATA_PATH}/gene_annotations/${name}
abspath
diff -r f38beb0743d5 -r 7af38f95bc8d data_manager_gene_annotation/test-data/gene_annotation_out.json
--- a/data_manager_gene_annotation/test-data/gene_annotation_out.json Thu Jun 23 17:18:20 2016 -0400
+++ b/data_manager_gene_annotation/test-data/gene_annotation_out.json Thu Jun 23 17:56:47 2016 -0400
@@ -0,0 +1,1 @@
+{"data_tables": {"gene_annotation": {"path": "/Users/scott/PyCharmProjects/Galaxy/galaxy/database/job_working_directory/003/3702/chr1-hg19_genes.gtf", "dbkey": "cool_name", "value": "2016-06-23 17:19:39.412249", "name": "chr1-hg19_genes.gtf"}}}
\ No newline at end of file