changeset 44:bab44ade984c draft

Uploaded 20170622
author fabio
date Thu, 22 Jun 2017 16:34:10 -0400
parents 73d593ff91e4
children b0d8d9cdf942
files ._jcds_wrapper.py gdcwebapp.xml jcds_wrapper.py
diffstat 3 files changed, 51 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
Binary file ._jcds_wrapper.py has changed
--- a/gdcwebapp.xml	Thu Jun 22 14:24:50 2017 -0400
+++ b/gdcwebapp.xml	Thu Jun 22 16:34:10 2017 -0400
@@ -9,7 +9,11 @@
         <exit_code range="1:" />
         <exit_code range=":-1" />
     </stdio>
-    <command>json_collect_data_source.py '${__app__.config.output_size_limit}' --json_param_file '${output1}' --path '.' --appdata 'tmp'</command>
+    <command>
+<![CDATA[
+    python '$__tool_directory__/jcds_wrapper.py' '${__app__.config.output_size_limit}' --json_param_file '${output1}' --path '.' --appdata 'tmp'
+]]>
+    </command>
     <inputs check_values="False" action="http://bioinf.iasi.cnr.it/gdcwebapp/app.php">
         <display>Go to GDCWebApp service $GALAXY_URL</display>
         <param name="GALAXY_URL" type="baseurl" value="/async/data_source_gdcwebapp" />
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jcds_wrapper.py	Thu Jun 22 16:34:10 2017 -0400
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+import json_collect_data_source as jcds
+import optparse
+
+__version__ = "1.0.0"
+
+def __main__():
+    """ Read the JSON return from a data source. Parse each line and request
+    the data, download to "newfilepath", and write metadata.
+
+    Schema
+    ------
+
+        [ {"url":"http://url/to/file.tar.gz",
+           "name":"My Archive",
+           "extension":"tar.gz",
+           "organize":"true",
+           "metadata":{"db_key":"hg38"},
+           "extra_data":[ {"url":"http://url_of_ext_file",
+                           "path":"rel/path/to/ext_file"}
+                        ]
+          }
+        ]
+
+    """
+    # Parse the command line options
+    usage = "Usage: jcds_wrapper.py max_size --json_param_file filename [options]"
+    parser = optparse.OptionParser(usage = usage)
+    parser.add_option("-j", "--json_param_file", type="string",
+                    action="store", dest="json_param_file", help="json schema return data")
+    parser.add_option("-p", "--path", type="string",
+                    action="store", dest="path", help="new file path")
+    # set appdata: temporary directory in which the archives will be decompressed
+    parser.add_option("-a", "--appdata", type="string",
+                    action="store", dest="appdata", help="appdata folder name")
+    parser.add_option("-v", "--version", action="store_true", dest="version",
+                    default=False, help="display version and exit")
+
+    (options, args) = parser.parse_args()
+    if options.version:
+        print __version__
+    else:
+        jcds.download_from_json_data( options, args )
+
+
+if __name__ == "__main__": __main__()