gx.py 683 Bytes
Newer Older
Hervé  MENAGER's avatar
Hervé MENAGER committed
1
2
3
4
from bioblend.galaxy import GalaxyInstance
from bioblend.galaxy.tools.inputs import inputs

workflow_id = 'dad6103ff71ca4fe'
Hervé  MENAGER's avatar
Hervé MENAGER committed
5
galaxy_url = 'https://galaxy-dev.web.pasteur.fr'
Hervé  MENAGER's avatar
Hervé MENAGER committed
6
7
api_key = '21c2ce387688b1a785040762f7c9c331'

Hervé  MENAGER's avatar
Hervé MENAGER committed
8

Hervé  MENAGER's avatar
Hervé MENAGER committed
9
10
11
12
def run_workflow_and_get_results(input_file):
    gi = GalaxyInstance(galaxy_url, key=api_key)
    gi.verify = False
    history_id = gi.histories.create_history("ippidb_history")['id']
Hervé  MENAGER's avatar
Hervé MENAGER committed
13
14
15
16
17
18
    dataset_id = gi.tools.upload_file(
        input_file, history_id)['outputs'][0]['id']
    inputs = {'0': {'id': dataset_id, 'src': 'hda'}}
    workflow_run = gi.workflows.invoke_workflow(
        workflow_id, inputs=inputs, history_id=history_id)
    print(workflow_run)