'This function adds a job to the queue to convert a dataset to another type. Returns a message about success/failure.'

def convert_dataset(self, trans, original_dataset, target_type, return_output=False, visible=True, deps=None, target_context=None, history=None):

    converter = trans.app.datatypes_registry.get_converter_by_target_type(original_dataset.ext, target_type)
    if (converter is None):
        raise Exception(('A    converter    does    not    exist    for    %s    to    %s.' % (original_dataset.ext, target_type)))
    params = {}
    input_name = 'input1'
    for (key, value) in converter.inputs.items():
        if (deps and (value.name in deps)):
            params[value.name] = deps[value.name]
        elif (value.type == 'data'):
            input_name = key
    if target_context:
        for (key, value) in target_context.items():
            if key.startswith('__'):
                params[key] = value
    params[input_name] = original_dataset
    converted_dataset = converter.execute(trans, incoming=params, set_output_hid=visible, history=history)[1]
    if (len(params) > 0):
        trans.log_event(('Converter    params:    %s' % str(params)), tool_id=converter.id)
    if (not visible):
        for value in converted_dataset.values():
            value.visible = False
    if return_output:
        return converted_dataset
    return ('The    file    conversion    of    %s    on    data    %s    has    been    added    to    the    Queue.' % (converter.name, original_dataset.hid))
