# HG changeset patch
# User scottx611x
# Date 1467991961 14400
# Node ID 87a921902f5eb5575e866bd09551372cb788effd
# Parent 2ab076cf69dfd23fb743eef598e53b5bc99ece8d
planemo upload
diff -r 2ab076cf69df -r 87a921902f5e data_manager/data_manager.py
--- a/data_manager/data_manager.py Fri Jul 08 11:17:50 2016 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-import os
-import sys
-import uuid
-import json
-import argparse
-import requests
-from requests.exceptions import ContentDecodingError
-
-
-def url_download(url):
- """Attempt to download gene annotation file from a given url
- :param url: full url to gene annotation file
- :type url: str.
- :returns: name of downloaded gene annotation file
- :raises: ContentDecodingError, IOError
- """
- response = requests.get(url=url, stream=True)
-
- # Generate file_name
- file_name = response.url.split("/")[-1]
-
- block_size = 10 * 1024 * 1024 # 10MB chunked download
- with open(file_name, 'w+') as f:
- try:
- # Good to note here that requests' iter_content() will
- # automatically handle decoding "gzip" and "deflate" encoding
- # formats
- 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_name)
-
- return file_name
-
-
-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()
-
- # Attempt to download gene annotation file from given url
- gene_annotation_file_name = url_download(args.url)
-
- # Update Data Manager JSON and write to file
- data_manager_entry = {
- 'data_tables': {
- 'gene_annotation': {
- 'value': str(args.name),
- 'dbkey': str(args.name),
- 'name': gene_annotation_file_name,
- 'path': os.path.join(work_dir, gene_annotation_file_name)
- }
- }
- }
-
- with open(os.path.join(args.output), "w+") as f:
- f.write(json.dumps(data_manager_entry))
-
-if __name__ == '__main__':
- main()
diff -r 2ab076cf69df -r 87a921902f5e data_manager/gene_annotation_fetcher.xml
--- a/data_manager/gene_annotation_fetcher.xml Fri Jul 08 11:17:50 2016 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-
-
- gene annotation fetcher
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff -r 2ab076cf69df -r 87a921902f5e data_manager_conf.xml
--- a/data_manager_conf.xml Fri Jul 08 11:17:50 2016 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff -r 2ab076cf69df -r 87a921902f5e data_manager_gene_annotation/data_manager/data_manager.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/data_manager_gene_annotation/data_manager/data_manager.py Fri Jul 08 11:32:41 2016 -0400
@@ -0,0 +1,73 @@
+import os
+import sys
+import uuid
+import json
+import argparse
+import requests
+from requests.exceptions import ContentDecodingError
+
+
+def url_download(url):
+ """Attempt to download gene annotation file from a given url
+ :param url: full url to gene annotation file
+ :type url: str.
+ :returns: name of downloaded gene annotation file
+ :raises: ContentDecodingError, IOError
+ """
+ response = requests.get(url=url, stream=True)
+
+ # Generate file_name
+ file_name = response.url.split("/")[-1]
+
+ block_size = 10 * 1024 * 1024 # 10MB chunked download
+ with open(file_name, 'w+') as f:
+ try:
+ # Good to note here that requests' iter_content() will
+ # automatically handle decoding "gzip" and "deflate" encoding
+ # formats
+ 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_name)
+
+ return file_name
+
+
+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()
+
+ # Attempt to download gene annotation file from given url
+ gene_annotation_file_name = url_download(args.url)
+
+ # Update Data Manager JSON and write to file
+ data_manager_entry = {
+ 'data_tables': {
+ 'gene_annotation': {
+ 'value': str(args.name),
+ 'dbkey': str(args.name),
+ 'name': gene_annotation_file_name,
+ 'path': os.path.join(work_dir, gene_annotation_file_name)
+ }
+ }
+ }
+
+ with open(os.path.join(args.output), "w+") as f:
+ f.write(json.dumps(data_manager_entry))
+
+if __name__ == '__main__':
+ main()
diff -r 2ab076cf69df -r 87a921902f5e data_manager_gene_annotation/data_manager/gene_annotation_fetcher.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/data_manager_gene_annotation/data_manager/gene_annotation_fetcher.xml Fri Jul 08 11:32:41 2016 -0400
@@ -0,0 +1,35 @@
+
+
+ gene annotation fetcher
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r 2ab076cf69df -r 87a921902f5e data_manager_gene_annotation/data_manager_conf.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/data_manager_gene_annotation/data_manager_conf.xml Fri Jul 08 11:32:41 2016 -0400
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
diff -r 2ab076cf69df -r 87a921902f5e data_manager_gene_annotation/test-data/gene_annotation_out.json
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/data_manager_gene_annotation/test-data/gene_annotation_out.json Fri Jul 08 11:32:41 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
diff -r 2ab076cf69df -r 87a921902f5e data_manager_gene_annotation/tool-data/gene_annotation.loc.sample
diff -r 2ab076cf69df -r 87a921902f5e data_manager_gene_annotation/tool_data_table_conf.xml.sample
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/data_manager_gene_annotation/tool_data_table_conf.xml.sample Fri Jul 08 11:32:41 2016 -0400
@@ -0,0 +1,8 @@
+
+
+
+
+ value, dbkey, name, path
+
+
+
\ No newline at end of file
diff -r 2ab076cf69df -r 87a921902f5e data_manager_gene_annotation/tool_dependencies.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/data_manager_gene_annotation/tool_dependencies.xml Fri Jul 08 11:32:41 2016 -0400
@@ -0,0 +1,3 @@
+
+
+
diff -r 2ab076cf69df -r 87a921902f5e test-data/gene_annotation_out.json
--- a/test-data/gene_annotation_out.json Fri Jul 08 11:17:50 2016 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-{"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
diff -r 2ab076cf69df -r 87a921902f5e tool-data/gene_annotation.loc.sample
diff -r 2ab076cf69df -r 87a921902f5e tool_data_table_conf.xml.sample
--- a/tool_data_table_conf.xml.sample Fri Jul 08 11:17:50 2016 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-
-
-
-
- value, dbkey, name, path
-
-
-
\ No newline at end of file
diff -r 2ab076cf69df -r 87a921902f5e tool_dependencies.xml
--- a/tool_dependencies.xml Fri Jul 08 11:17:50 2016 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-
-
-