Locked History Actions


Data Manager JSON Syntax

Data Manager Tools are required to use JSON to communicate the new Tool Data Table values back to the Data Manager. JSON can also optionally be used to provide the input parameter values to the Data Manager Tool, but this is not required.

Returning Values to the Data Manager

A Data Manager Tool must provide the new values for the Tool Data Table Entries via a JSON dictionary.

  1. A single dictionary, with the key data_tables is required to be present within the root JSON dictionary.

  2. The data_tables dictionary is keyed by the name of the Tool Data Table receiving new entries. Any number of named tables can be specified.

  3. The value for the named Tool Data Table is a list of dictionaries.
  4. Each of these dictionaries contains the values that will be provided to the Data Manager and modified as per the configuration defined within the Data Manager XML Syntax

Example JSON Output from Data Manager Tool to Galaxy

Here, the all_fasta table is having a single entry added to it

   1 {
   2    "data_tables":{
   3       "all_fasta":[
   4          {
   5             "path":"sacCer2.fa",
   6             "dbkey":"sacCer2",
   7             "name":"S. cerevisiae June 2008 (SGD/sacCer2) (sacCer2)",
   8             "value":"sacCer2"
   9          }
  10       ]
  11    }
  12 }

This creates a new entry in the Tool Data Table:

   1 #<unique_build_id>      <dbkey>         <display_name>  <file_path>
   2 sacCer2 sacCer2 S. cerevisiae June 2008 (SGD/sacCer2) (sacCer2) /Users/dan/galaxy-central/tool-data/sacCer2/seq/sacCer2.fa

Returning Values to the Data Manager

Taking the input values of a Data Manager Tool and converting it into a usable set of command-line arguments and options can be quite complicated in many cases, especially when considering that the underlying Data Manager Tool Executable will likely take those options and convert them into a set of valued objects within the executable/script itself before performing its operations.

To simplify this process, Data Manager Tools will automatically have their parameter values JSONified and provided as the content of the output dataset. This will allow the executable / script to simply read and parse the JSON data and have a complete collection of the Tool and Job parameters to use within the tool. Using this methodology is not required, however, and a Data Manager Tool developer is free to explicitly declare any number of the Tool parameters explicitly to the command-line.

Example JSON input to tool

   1 {
   2    "param_dict":{
   3       "__datatypes_config__":"/Users/dan/galaxy-central/database/tmp/tmphyQRH3",
   4       "__get_data_table_entry__":"<function get_data_table_entry at 0x10d435b90>",
   5       "userId":"1",
   6       "userEmail":"dan@bx.psu.edu",
   7       "dbkey":"sacCer2",
   8       "sequence_desc":"",
   9       "GALAXY_DATA_INDEX_DIR":"/Users/dan/galaxy-central/tool-data",
  10       "__admin_users__":"dan@bx.psu.edu",
  11       "__app__":"galaxy.app:UniverseApplication",
  12       "__user_email__":"dan@bx.psu.edu",
  13       "sequence_name":"",
  14       "GALAXY_DATATYPES_CONF_FILE":"/Users/dan/galaxy-central/database/tmp/tmphyQRH3",
  15       "__user_name__":"danb",
  16       "sequence_id":"",
  17       "reference_source":{
  18          "reference_source_selector":"ncbi",
  19          "requested_identifier":"sacCer2",
  20          "__current_case__":"1"
  21       },
  22       "__new_file_path__":"/Users/dan/galaxy-central/database/tmp",
  23       "__user_id__":"1",
  24       "out_file":"/Users/dan/galaxy-central/database/files/000/dataset_200.dat",
  25       "GALAXY_ROOT_DIR":"/Users/dan/galaxy-central",
  26       "__tool_data_path__":"/Users/dan/galaxy-central/tool-data",
  27       "__root_dir__":"/Users/dan/galaxy-central",
  28       "chromInfo":"/Users/dan/galaxy-central/tool-data/shared/ucsc/chrom/sacCer2.len"
  29    },
  30    "output_data":[
  31       {
  32          "extra_files_path":"/Users/dan/galaxy-central/database/job_working_directory/000/202/dataset_200_files",
  33          "file_name":"/Users/dan/galaxy-central/database/files/000/dataset_200.dat",
  34          "ext":"data_manager_json",
  35          "out_data_name":"out_file",
  36          "hda_id":201,
  37          "dataset_id":200
  38       }
  39    ],
  40    "job_config":{
  41       "GALAXY_ROOT_DIR":"/Users/dan/galaxy-central",
  42       "GALAXY_DATATYPES_CONF_FILE":"/Users/dan/galaxy-central/database/tmp/tmphyQRH3",
  43       "TOOL_PROVIDED_JOB_METADATA_FILE":"galaxy.json"
  44    }
  45 }