+ - 0:00:00
Notes for current slide

Presenter notes contain extra information which might be useful if you intend to use these slides for teaching.

Press P again to switch presenter notes off

Press C to create a new window where the same presentation will be displayed. This window is linked to the main window. Changing slides on one will cause the slide to change on the other.

Useful when presenting.

Notes for next slide



Galaxy Webhooks



last_modification Updated:   purlPURL: gxy.io/GTN:S00055

text-document Plain-text slides |

Tip: press P to view the presenter notes | arrow-keys Use arrow keys to move between slides
1 / 17

Presenter notes contain extra information which might be useful if you intend to use these slides for teaching.

Press P again to switch presenter notes off

Press C to create a new window where the same presentation will be displayed. This window is linked to the main window. Changing slides on one will cause the slide to change on the other.

Useful when presenting.

question Questions

  • What are Galaxy Webhooks?

  • How to create them?

2 / 17

objectives Objectives

  • Discover what Galaxy Webhooks are

  • Be able to create Webhooks

  • Be able to add a Galaxy Webhook in a Galaxy instance

3 / 17

What are Galaxy Webhooks?

A system which can be used to attach new functionalities to predefined entry points in the Galaxy interface.

An accessible way to make isolated customisations to a Galaxy instance.

4 / 17

Entry point: masthead

A person shaped icon in the Galaxy masthead is being hovered over and the popup reads "Show Username", presumably a custom webhook from a tutorial.

Adds item to the top menu.

5 / 17

Entry point: tool/workflow submission

Screenshot of Galaxy with the job completion screen shown and a PhD comic image shown below.

Shown after tool or workflow execution.

6 / 17

Entry point: tool-menu

Adds an entry to the tool form menu.

7 / 17

Entry point: history-menu

A section of the history menu is labelled Webhooks and shows a custom menu entry.

Adds an entry to the history menu.

8 / 17

What is a webhook made of?

  • a config file in YAML format: config/<NAME>.yml
  • optional: A Python helper file with access to the Galaxy trans object
    • helper/__init__.py
    • provides an API call at /api/webhooks/<WEBHOOK_NAME>/get_data
  • optional: Additional JS and CSS code
    • static/script.js
    • static/styles.css
9 / 17

Example configuration YAML

name: trans_object
type:
- masthead
activate: true
icon: fa-user
tooltip: Show Username
function: >
$.getJSON("/api/webhooks/trans_object/get_data", function(data) {
alert('Username: ' + data.username);
});
10 / 17

Definition of the configuration options

Argument Description
name Name of the Webhook (and API call)
type Entry point. tool/workflow/masthead/history-menu. More might be available in future
activate (De-)Activates the Webhook. true/false
icon Icon to show for a masthead plugin. Full list of available icons here
tooltip Tooltip to show for masthead plugins
function JavaScript code to run when masthead button is clicked
11 / 17

Example __init__.py

def main(trans, webhook):
if trans.user:
user = trans.user.username
else:
user = 'No user is logged in.'
return {'username': user}

The return value can be read with a call to /api/webhooks/WEBHOOK_NAME/get_data

12 / 17

Want to integrate Webhooks in your Galaxy instance?

  • Copy your Webhook to your Webhook directory on your Galaxy instance
    • default: config/plugins/webhooks
    • configurable via webhooks_dir in galaxy.yml
  • Restart Galaxy. While developing, changes at the __init__.py file will be active immediately
13 / 17

Want to contribute?

14 / 17

Developing the Webhooks implementation

  • Webhooks initialisation: lib/galaxy/webhooks/__init__.py
  • JavaScript logic: client/galaxy/scripts/mvc/webhooks.js
  • Entry points
    • client/galaxy/scripts/mvc/tool/tool-form.js
    • client/galaxy/scripts/mvc/tool/tool-form-composite.js
    • client/galaxy/scripts/mvc/history/options-menu.js
    • client/galaxy/scripts/layout/menu-js
  • API: lib/galaxy/webapps/galaxy/api/webhooks.py
    • lib/galaxy/webapps/galaxy/buildapp.py
15 / 17

keypoints Key points

  • A Galaxy Webhook provides an easy way to customize the Galaxy UI with plugins

  • Right now there are 4 entry points: tool, workflow, masthead, history-menu

  • With a minimal amount of code you can extend Galaxy's user-interace.

16 / 17

Thank You!

This material is the result of a collaborative work. Thanks to the Galaxy Training Network and all the contributors!

Galaxy Training Network

Tutorial Content is licensed under Creative Commons Attribution 4.0 International License.

17 / 17

question Questions

  • What are Galaxy Webhooks?

  • How to create them?

2 / 17
Paused

Help

Keyboard shortcuts

, , Pg Up, k Go to previous slide
, , Pg Dn, Space, j Go to next slide
Home Go to first slide
End Go to last slide
Number + Return Go to specific slide
b / m / f Toggle blackout / mirrored / fullscreen mode
c Clone slideshow
p Toggle presenter mode
t Restart the presentation timer
?, h Toggle this help
Esc Back to slideshow