changeset 22:b47ce1c4373e draft

planemo upload
author scottx611x
date Thu, 23 Jun 2016 15:11:30 -0400
parents 096657afd137
children cb42506ae8ce
files data_manager_gene_annotation/data_manager/data_manager.py data_manager_gene_annotation/data_manager/gene_annotation/gene_annotation.json data_manager_gene_annotation/data_manager/gene_annotation_fetcher.xml data_manager_gene_annotation/data_manager_conf.xml data_manager_gene_annotation/test-data/gene_annotation_out.json
diffstat 4 files changed, 17 insertions(+), 10 deletions(-) [+]
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,
--- a/data_manager_gene_annotation/data_manager/gene_annotation/gene_annotation.json	Thu Jun 23 14:25:15 2016 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-{"data_tables": {"gene_annotation": {"date": "2016-06-22 15:48:23.783455", "path": "download_a340d4c9-041a-4583-b970-20f949c53872.dat", "name": "a340d4c9-041a-4583-b970-20f949c53872", "dbkey": "a340d4c9-041a-4583-b970-20f949c53872"}}}
\ No newline at end of file
--- a/data_manager_gene_annotation/data_manager/gene_annotation_fetcher.xml	Thu Jun 23 14:25:15 2016 -0400
+++ b/data_manager_gene_annotation/data_manager/gene_annotation_fetcher.xml	Thu Jun 23 15:11:30 2016 -0400
@@ -16,11 +16,17 @@
     ]]>
     </command>
     <inputs>
-        <param
-                help="Enter a unique identifier, or leave blank for an auto-generated uuid" label="Name for this database" name="database_name" type="text" optional="True" />
+        <param help="Enter a unique identifier, or leave blank for an auto-generated uuid" label="Name for this database" name="database_name" type="text" optional="True" />
         <param label="Enter URL for gene annotation files" name="gene_annotation_url" type="text" optional="False"/>
     </inputs>
     <outputs>
         <data format="data_manager_json" name="out_file" />
     </outputs>
+    <tests>
+        <test>
+            <param name="database_name" value="cool_name"/>
+            <param name="gene_annotation_url" value="http://www.scott-ouellette.com/gene_annotations/chr1-hg19_genes.gtf"/>
+            <output name="out_file" file="chr1-hg19_genes.gtf.data_manager_json"/>
+        </test>
+    </tests>
 </tool>
--- a/data_manager_gene_annotation/data_manager_conf.xml	Thu Jun 23 14:25:15 2016 -0400
+++ b/data_manager_gene_annotation/data_manager_conf.xml	Thu Jun 23 15:11:30 2016 -0400
@@ -4,12 +4,13 @@
 	<data_manager tool_file="data_manager/gene_annotation_fetcher.xml" id="gene_annotation_fetcher" version="1.0.0">
 		<data_table name="gene_annotation">
 			<output>
-				<column name="date" />
+				<column name="value" />
 				<column name="dbkey" />
 				<column name="name" />
 				<column name="path" output_ref="out_file">
 					<move type="file">
-							<target base="${GALAXY_DATA_MANAGER_DATA_PATH}">${dbkey}/gene_annotations/${path}</target>
+						<source>${path}</source>
+						<target base="${GALAXY_DATA_MANAGER_DATA_PATH}">${dbkey}/gene_annotations/${path}</target>
 					</move>
 					<value_translation>${GALAXY_DATA_MANAGER_DATA_PATH}/${dbkey}/gene_annotations/${path}</value_translation>
 					<value_translation type="function">abspath</value_translation>