For Power-Users‎ > ‎

3. Registering new data types

To begin, please take a look at the Galaxy documentation for how to add a datatype at 
It covers all of the basics you'll need to know for adding datatypes. Below is a specific example of how we added the JSON datatype.

1. Shut down galaxy
2. The list of datatypes is defined in datatypes_conf.xml. Edit this file.
3.  Add the following line to define the datatype:

<datatype extension="json" type="galaxy.datatypes.generic_json:GenericJson" mimetype="application/json"/>

4. The extension value represent the most commonly used file extension for this type of file
5. The type value represents the path to the class where the datatype class is located
6. Set the appropriate mimetype for your file
7. The display_in_upload value determines if users may upload files of that type from within the upload tools
8. Next, set the sniffer location

<sniffer type="galaxy.datatypes.generic_json:GenericJson"/>

5. Add the datatype wrapper class in lib/galaxy/datatypes. The wrapper class for this json datatype is lib/galaxy/datatypes/ The class looks like this:

import data 

import json 

class GenericJson(data.Text): 

    """Base format class for any JSON file.""" 

    file_ext = "json"

    # The sniff function will help to automatically determine file types of uploaded data

    def sniff(self, filename): 

        f = open(filename) 


          parsed = json.load(f) 

          return True 

        except ValueError: 

            return False

6. Edit lib/galaxy/datatypes/ and import your class. We only need to add this line:

import generic_json

11. Restart Galaxy and verify there were no errors related to your datatype at startup.