SlideShare a Scribd company logo
1 of 13
Download to read offline
Writing Galaxy Tools
30 June 2014, GCC2014, Baltimore
Peter Cock1
, Bj¨orn Gr¨uning2
, Greg Von Kuster3
1 James Hutton Institute, Scotland, UK; 2 Albert-Ludwigs-University, Germany; 3 Penn
State University, USA
Wrapping Command-line Tools
• Tell Galaxy what options to show the user
• Galaxy tells your tool the selected input filenames
• Galaxy tells your tool the desired output filenames
• Must tell Galaxy how to invoke the underlying tool...
Heart of each Galaxy tool is an XML file
Core elements:
• <inputs> – parameters/options/files
• <outputs> – output files expected
• <command> – how to turn this into a command line string
Secondary elements:
• <requirements> – tell Galaxy how to find the binaries etc
• <stdio> – what counts as an error?
• <description> – subtitle describing tool
• <help> – instructions to show the end user
• <tests> – functional tests
http://wiki.galaxyproject.org/Admin/Tools/ToolConfigSyntax
Heart of each Galaxy tool is an XML file
Example:
<tool id="my_tool" name="My Tool" version="0.0.1">
<command >my_tool "$input1" "$output1"</command >
<description >Run My Tool (patent pending)</description >
<inputs >
<param name="input1" type="data" format="fasta"
label="Sequence in" help="FASTA format." />
</inputs >
<outputs >
<data name="output1" format="fasta"
label="My Tool Results" />
</outputs >
<help >
This is a Galaxy wrapper for My Tool.
</help >
</tool >
http://wiki.galaxyproject.org/Admin/Tools/ToolConfigSyntax
The <inputs> and <param ...> tags
• <inputs>...</inputs> contains <param ...> tag(s)
• Each <param ...> tag requires a unique name
• This is used in the <command> and <tests>
• Each <param ...> tag requires a type
• e.g. for type="data" for an input file
• Each <param ...> tag should have a label and help
• These are shown in the user interface
• There are additional type-specific attributes
• e.g. for type="data" add format="..." for file type
http://wiki.galaxyproject.org/Admin/Tools/ToolConfigSyntax
The <inputs> and <param ...> tags
Use <param type="???" ...> to control each parameter:
• type="data" – input file (from current history)
• type="text" – any string via a text box
• type="integer" – whole number via a text box
• type="float" – arbitrary number via a text box
• type="select" – Drop down lists, or radio buttons
• type="boolean" – True/false value with checkbox
• type="data column" – Pick column(s) from a tabular file
• ...
http://wiki.galaxyproject.org/Admin/Tools/ToolConfigSyntax
The <outputs> and <data ...> tags
• <outputs>...</outputs> contains <data ...> tag(s)
• Each <data ...> tag requires a unique name
• This is used in the <command> and <tests>
• Each <data ...> tag should have an ftype
• e.g. for ftype="fasta" for a FASTA output file
• Each <data ...> tag should have a label
• This is the default dataset description in the history
http://wiki.galaxyproject.org/Admin/Tools/ToolConfigSyntax
The <command> tag – basics
• The <command> tag is a command line string template
• Named every input <param ...> and output <data ...>
• Use $name to refer to that input parameter or output file
• Ideally use "$name" in case of spaces in filename
• Can split <command> over multiple lines
• XML so need &amp;, &lt; and &gt;
• Must escape $ to get an actual dollar sign, e.g.
<command >
my_tool --threads $ GALAXY_SLOTS
"$input1" "$output1"
</command >
http://wiki.galaxyproject.org/Admin/Tools/ToolConfigSyntax
The <command> tag – advanced
• The <command> tag uses the Cheetah template language
• This can include for loops and if statements, e.g.
<command >
my_tool --threads $ GALAXY_SLOTS
## double hash for comment lines
## single hash for Cheetah syntax
#if $output_choice =="long"
--long
#end if
"$input1" "$output1"
</command >
http://wiki.galaxyproject.org/Admin/Tools/ToolConfigSyntax
Advanced parameter options
• Galaxy supports conditional and repeated constructs
• Defined with more XML in the <inputs> section
• Galaxy supports multiple input files as one parameter
• Requires Cheetah syntax in the <command> tag
• Easiest to learn by example?
$ cd galaxy -dist
$ grep "<conditional " tools /*/*. xml
...
$ grep "<repeat " tools /*/*. xml
...
http://wiki.galaxyproject.org/Admin/Tools/ToolConfigSyntax
The <help> tag
• Uses reStructuredText markup language
• Blank line for a paragraph break
• Use asterisks for *italics*, double-asterisks for **bold**
• Can include tables, images, links, etc.
<tool id="my_tool" name="My Tool" version="0.0.1">
...
<help >
This is a Galaxy wrapper for *My Tool *.
If you use this tool , ** please cite this paper **:
...
</help >
</tool >
http://wiki.galaxyproject.org/Admin/Tools/ToolConfigSyntax
The <stdio> tag
• The <stdio> tag controls error detection
• Galaxy default is any output on stderr means an error (!)
• Unix/Linux convention allows logging etc on stderr
• Unix/Linux convention is non-zero return code means error
For Unix style tools, only check the return code:
<tool id="my_tool" name="My Tool" version="0.0.1">
...
<stdio >
<!-- Anything other than zero is an error -->
<exit_code range="1:" />
<exit_code range=":-1" />
</stdio >
...
</tool >
http://wiki.galaxyproject.org/Admin/Tools/ToolConfigSyntax
Further reading
• Functional Tests
• Dynamics captions on output files
• Variable numbers of output files
• Composite datatypes
• Defining new Galaxy datatypes
• Dependencies & The Tool Shed
• Galaxy macros to reduce repetitive XML

More Related Content

What's hot

Enhanced Web Service Testing: A Better Mock Structure
Enhanced Web Service Testing: A Better Mock StructureEnhanced Web Service Testing: A Better Mock Structure
Enhanced Web Service Testing: A Better Mock StructureCRMScienceKirk
 
Large Scale Log Analytics with Solr: Presented by Rafał Kuć & Radu Gheorghe, ...
Large Scale Log Analytics with Solr: Presented by Rafał Kuć & Radu Gheorghe, ...Large Scale Log Analytics with Solr: Presented by Rafał Kuć & Radu Gheorghe, ...
Large Scale Log Analytics with Solr: Presented by Rafał Kuć & Radu Gheorghe, ...Lucidworks
 
code4lib 2011 preconference: What's New in Solr (since 1.4.1)
code4lib 2011 preconference: What's New in Solr (since 1.4.1)code4lib 2011 preconference: What's New in Solr (since 1.4.1)
code4lib 2011 preconference: What's New in Solr (since 1.4.1)Erik Hatcher
 
Solr Black Belt Pre-conference
Solr Black Belt Pre-conferenceSolr Black Belt Pre-conference
Solr Black Belt Pre-conferenceErik Hatcher
 
Solr vs. Elasticsearch, Case by Case: Presented by Alexandre Rafalovitch, UN
Solr vs. Elasticsearch,  Case by Case: Presented by Alexandre Rafalovitch, UNSolr vs. Elasticsearch,  Case by Case: Presented by Alexandre Rafalovitch, UN
Solr vs. Elasticsearch, Case by Case: Presented by Alexandre Rafalovitch, UNLucidworks
 
What's new with Apache Spark's Structured Streaming?
What's new with Apache Spark's Structured Streaming?What's new with Apache Spark's Structured Streaming?
What's new with Apache Spark's Structured Streaming?Miklos Christine
 
Lucene's Latest (for Libraries)
Lucene's Latest (for Libraries)Lucene's Latest (for Libraries)
Lucene's Latest (for Libraries)Erik Hatcher
 
Open Ldap Integration and Configuration with Lifray 6.2
Open Ldap Integration and Configuration with Lifray 6.2Open Ldap Integration and Configuration with Lifray 6.2
Open Ldap Integration and Configuration with Lifray 6.2Vinaykumar Hebballi
 
Rapid Prototyping with Solr
Rapid Prototyping with SolrRapid Prototyping with Solr
Rapid Prototyping with SolrErik Hatcher
 
Hacking Lucene for Custom Search Results
Hacking Lucene for Custom Search ResultsHacking Lucene for Custom Search Results
Hacking Lucene for Custom Search ResultsOpenSource Connections
 
Lucene for Solr Developers
Lucene for Solr DevelopersLucene for Solr Developers
Lucene for Solr DevelopersErik Hatcher
 
Beyond full-text searches with Lucene and Solr
Beyond full-text searches with Lucene and SolrBeyond full-text searches with Lucene and Solr
Beyond full-text searches with Lucene and SolrBertrand Delacretaz
 
Code transformation With Spoon
Code transformation With SpoonCode transformation With Spoon
Code transformation With SpoonGérard Paligot
 
Lucene And Solr Document Classification
Lucene And Solr Document ClassificationLucene And Solr Document Classification
Lucene And Solr Document ClassificationAlessandro Benedetti
 
Property based testing - Less is more
Property based testing - Less is moreProperty based testing - Less is more
Property based testing - Less is moreHo Tien VU
 
Lambda Chops - Recipes for Simpler, More Expressive Code
Lambda Chops - Recipes for Simpler, More Expressive CodeLambda Chops - Recipes for Simpler, More Expressive Code
Lambda Chops - Recipes for Simpler, More Expressive CodeIan Robertson
 
Build, logging, and unit test tools
Build, logging, and unit test toolsBuild, logging, and unit test tools
Build, logging, and unit test toolsAllan Huang
 
Recent Additions to Lucene Arsenal
Recent Additions to Lucene ArsenalRecent Additions to Lucene Arsenal
Recent Additions to Lucene Arsenallucenerevolution
 

What's hot (20)

Enhanced Web Service Testing: A Better Mock Structure
Enhanced Web Service Testing: A Better Mock StructureEnhanced Web Service Testing: A Better Mock Structure
Enhanced Web Service Testing: A Better Mock Structure
 
Large Scale Log Analytics with Solr: Presented by Rafał Kuć & Radu Gheorghe, ...
Large Scale Log Analytics with Solr: Presented by Rafał Kuć & Radu Gheorghe, ...Large Scale Log Analytics with Solr: Presented by Rafał Kuć & Radu Gheorghe, ...
Large Scale Log Analytics with Solr: Presented by Rafał Kuć & Radu Gheorghe, ...
 
code4lib 2011 preconference: What's New in Solr (since 1.4.1)
code4lib 2011 preconference: What's New in Solr (since 1.4.1)code4lib 2011 preconference: What's New in Solr (since 1.4.1)
code4lib 2011 preconference: What's New in Solr (since 1.4.1)
 
Calypso browser
Calypso browserCalypso browser
Calypso browser
 
Solr Black Belt Pre-conference
Solr Black Belt Pre-conferenceSolr Black Belt Pre-conference
Solr Black Belt Pre-conference
 
Solr vs. Elasticsearch, Case by Case: Presented by Alexandre Rafalovitch, UN
Solr vs. Elasticsearch,  Case by Case: Presented by Alexandre Rafalovitch, UNSolr vs. Elasticsearch,  Case by Case: Presented by Alexandre Rafalovitch, UN
Solr vs. Elasticsearch, Case by Case: Presented by Alexandre Rafalovitch, UN
 
What's new with Apache Spark's Structured Streaming?
What's new with Apache Spark's Structured Streaming?What's new with Apache Spark's Structured Streaming?
What's new with Apache Spark's Structured Streaming?
 
Lucene's Latest (for Libraries)
Lucene's Latest (for Libraries)Lucene's Latest (for Libraries)
Lucene's Latest (for Libraries)
 
Open Ldap Integration and Configuration with Lifray 6.2
Open Ldap Integration and Configuration with Lifray 6.2Open Ldap Integration and Configuration with Lifray 6.2
Open Ldap Integration and Configuration with Lifray 6.2
 
Rapid Prototyping with Solr
Rapid Prototyping with SolrRapid Prototyping with Solr
Rapid Prototyping with Solr
 
Hacking Lucene for Custom Search Results
Hacking Lucene for Custom Search ResultsHacking Lucene for Custom Search Results
Hacking Lucene for Custom Search Results
 
Lucene for Solr Developers
Lucene for Solr DevelopersLucene for Solr Developers
Lucene for Solr Developers
 
Beyond full-text searches with Lucene and Solr
Beyond full-text searches with Lucene and SolrBeyond full-text searches with Lucene and Solr
Beyond full-text searches with Lucene and Solr
 
Code transformation With Spoon
Code transformation With SpoonCode transformation With Spoon
Code transformation With Spoon
 
Lucene And Solr Document Classification
Lucene And Solr Document ClassificationLucene And Solr Document Classification
Lucene And Solr Document Classification
 
High Performance Solr
High Performance SolrHigh Performance Solr
High Performance Solr
 
Property based testing - Less is more
Property based testing - Less is moreProperty based testing - Less is more
Property based testing - Less is more
 
Lambda Chops - Recipes for Simpler, More Expressive Code
Lambda Chops - Recipes for Simpler, More Expressive CodeLambda Chops - Recipes for Simpler, More Expressive Code
Lambda Chops - Recipes for Simpler, More Expressive Code
 
Build, logging, and unit test tools
Build, logging, and unit test toolsBuild, logging, and unit test tools
Build, logging, and unit test tools
 
Recent Additions to Lucene Arsenal
Recent Additions to Lucene ArsenalRecent Additions to Lucene Arsenal
Recent Additions to Lucene Arsenal
 

Similar to Writing Galaxy Tools

Learn c++ Programming Language
Learn c++ Programming LanguageLearn c++ Programming Language
Learn c++ Programming LanguageSteve Johnson
 
gdscWorkShopJavascriptintroductions.pptx
gdscWorkShopJavascriptintroductions.pptxgdscWorkShopJavascriptintroductions.pptx
gdscWorkShopJavascriptintroductions.pptxsandeshshahapur
 
Gift-VT Tools Development Overview
Gift-VT Tools Development OverviewGift-VT Tools Development Overview
Gift-VT Tools Development Overviewstn_tkiller
 
Developing web apps using Erlang-Web
Developing web apps using Erlang-WebDeveloping web apps using Erlang-Web
Developing web apps using Erlang-Webfanqstefan
 
Project FoX: A Tool That Offers Automated Testing Using a Formal Approach
Project FoX: A Tool That Offers Automated Testing Using a Formal ApproachProject FoX: A Tool That Offers Automated Testing Using a Formal Approach
Project FoX: A Tool That Offers Automated Testing Using a Formal ApproachIvo Neskovic
 
Introduction to Elasticsearch
Introduction to ElasticsearchIntroduction to Elasticsearch
Introduction to ElasticsearchSperasoft
 
Introducing Struts 2
Introducing Struts 2Introducing Struts 2
Introducing Struts 2wiradikusuma
 
Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...
Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...
Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...Guillaume Laforge
 
The GO Language : From Beginners to Gophers
The GO Language : From Beginners to GophersThe GO Language : From Beginners to Gophers
The GO Language : From Beginners to GophersAlessandro Sanino
 
BITM3730 10-3.pptx
BITM3730 10-3.pptxBITM3730 10-3.pptx
BITM3730 10-3.pptxMattMarino13
 
TEMPLATES IN JAVA
TEMPLATES IN JAVATEMPLATES IN JAVA
TEMPLATES IN JAVAMuskanSony
 
Javascript done right - Open Web Camp III
Javascript done right - Open Web Camp IIIJavascript done right - Open Web Camp III
Javascript done right - Open Web Camp IIIDirk Ginader
 
MWLUG 2015 - AD114 Take Your XPages Development to the Next Level
MWLUG 2015 - AD114 Take Your XPages Development to the Next LevelMWLUG 2015 - AD114 Take Your XPages Development to the Next Level
MWLUG 2015 - AD114 Take Your XPages Development to the Next Levelbalassaitis
 

Similar to Writing Galaxy Tools (20)

Learn c++ Programming Language
Learn c++ Programming LanguageLearn c++ Programming Language
Learn c++ Programming Language
 
C Sharp Course 101.5
C Sharp Course 101.5C Sharp Course 101.5
C Sharp Course 101.5
 
gdscWorkShopJavascriptintroductions.pptx
gdscWorkShopJavascriptintroductions.pptxgdscWorkShopJavascriptintroductions.pptx
gdscWorkShopJavascriptintroductions.pptx
 
Gift-VT Tools Development Overview
Gift-VT Tools Development OverviewGift-VT Tools Development Overview
Gift-VT Tools Development Overview
 
Angular2
Angular2Angular2
Angular2
 
Meta Object Protocols
Meta Object ProtocolsMeta Object Protocols
Meta Object Protocols
 
Developing web apps using Erlang-Web
Developing web apps using Erlang-WebDeveloping web apps using Erlang-Web
Developing web apps using Erlang-Web
 
Project FoX: A Tool That Offers Automated Testing Using a Formal Approach
Project FoX: A Tool That Offers Automated Testing Using a Formal ApproachProject FoX: A Tool That Offers Automated Testing Using a Formal Approach
Project FoX: A Tool That Offers Automated Testing Using a Formal Approach
 
Introduction to Elasticsearch
Introduction to ElasticsearchIntroduction to Elasticsearch
Introduction to Elasticsearch
 
Introducing Struts 2
Introducing Struts 2Introducing Struts 2
Introducing Struts 2
 
Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...
Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...
Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...
 
Extensible markup language attacks
Extensible markup language attacksExtensible markup language attacks
Extensible markup language attacks
 
Xml presentation
Xml presentationXml presentation
Xml presentation
 
Struts2
Struts2Struts2
Struts2
 
The GO Language : From Beginners to Gophers
The GO Language : From Beginners to GophersThe GO Language : From Beginners to Gophers
The GO Language : From Beginners to Gophers
 
BITM3730 10-3.pptx
BITM3730 10-3.pptxBITM3730 10-3.pptx
BITM3730 10-3.pptx
 
TEMPLATES IN JAVA
TEMPLATES IN JAVATEMPLATES IN JAVA
TEMPLATES IN JAVA
 
Javascript done right - Open Web Camp III
Javascript done right - Open Web Camp IIIJavascript done right - Open Web Camp III
Javascript done right - Open Web Camp III
 
MWLUG 2015 - AD114 Take Your XPages Development to the Next Level
MWLUG 2015 - AD114 Take Your XPages Development to the Next LevelMWLUG 2015 - AD114 Take Your XPages Development to the Next Level
MWLUG 2015 - AD114 Take Your XPages Development to the Next Level
 
Oops lecture 1
Oops lecture 1Oops lecture 1
Oops lecture 1
 

Recently uploaded

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 

Recently uploaded (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

Writing Galaxy Tools

  • 1. Writing Galaxy Tools 30 June 2014, GCC2014, Baltimore Peter Cock1 , Bj¨orn Gr¨uning2 , Greg Von Kuster3 1 James Hutton Institute, Scotland, UK; 2 Albert-Ludwigs-University, Germany; 3 Penn State University, USA
  • 2. Wrapping Command-line Tools • Tell Galaxy what options to show the user • Galaxy tells your tool the selected input filenames • Galaxy tells your tool the desired output filenames • Must tell Galaxy how to invoke the underlying tool...
  • 3. Heart of each Galaxy tool is an XML file Core elements: • <inputs> – parameters/options/files • <outputs> – output files expected • <command> – how to turn this into a command line string Secondary elements: • <requirements> – tell Galaxy how to find the binaries etc • <stdio> – what counts as an error? • <description> – subtitle describing tool • <help> – instructions to show the end user • <tests> – functional tests http://wiki.galaxyproject.org/Admin/Tools/ToolConfigSyntax
  • 4. Heart of each Galaxy tool is an XML file Example: <tool id="my_tool" name="My Tool" version="0.0.1"> <command >my_tool "$input1" "$output1"</command > <description >Run My Tool (patent pending)</description > <inputs > <param name="input1" type="data" format="fasta" label="Sequence in" help="FASTA format." /> </inputs > <outputs > <data name="output1" format="fasta" label="My Tool Results" /> </outputs > <help > This is a Galaxy wrapper for My Tool. </help > </tool > http://wiki.galaxyproject.org/Admin/Tools/ToolConfigSyntax
  • 5. The <inputs> and <param ...> tags • <inputs>...</inputs> contains <param ...> tag(s) • Each <param ...> tag requires a unique name • This is used in the <command> and <tests> • Each <param ...> tag requires a type • e.g. for type="data" for an input file • Each <param ...> tag should have a label and help • These are shown in the user interface • There are additional type-specific attributes • e.g. for type="data" add format="..." for file type http://wiki.galaxyproject.org/Admin/Tools/ToolConfigSyntax
  • 6. The <inputs> and <param ...> tags Use <param type="???" ...> to control each parameter: • type="data" – input file (from current history) • type="text" – any string via a text box • type="integer" – whole number via a text box • type="float" – arbitrary number via a text box • type="select" – Drop down lists, or radio buttons • type="boolean" – True/false value with checkbox • type="data column" – Pick column(s) from a tabular file • ... http://wiki.galaxyproject.org/Admin/Tools/ToolConfigSyntax
  • 7. The <outputs> and <data ...> tags • <outputs>...</outputs> contains <data ...> tag(s) • Each <data ...> tag requires a unique name • This is used in the <command> and <tests> • Each <data ...> tag should have an ftype • e.g. for ftype="fasta" for a FASTA output file • Each <data ...> tag should have a label • This is the default dataset description in the history http://wiki.galaxyproject.org/Admin/Tools/ToolConfigSyntax
  • 8. The <command> tag – basics • The <command> tag is a command line string template • Named every input <param ...> and output <data ...> • Use $name to refer to that input parameter or output file • Ideally use "$name" in case of spaces in filename • Can split <command> over multiple lines • XML so need &amp;, &lt; and &gt; • Must escape $ to get an actual dollar sign, e.g. <command > my_tool --threads $ GALAXY_SLOTS "$input1" "$output1" </command > http://wiki.galaxyproject.org/Admin/Tools/ToolConfigSyntax
  • 9. The <command> tag – advanced • The <command> tag uses the Cheetah template language • This can include for loops and if statements, e.g. <command > my_tool --threads $ GALAXY_SLOTS ## double hash for comment lines ## single hash for Cheetah syntax #if $output_choice =="long" --long #end if "$input1" "$output1" </command > http://wiki.galaxyproject.org/Admin/Tools/ToolConfigSyntax
  • 10. Advanced parameter options • Galaxy supports conditional and repeated constructs • Defined with more XML in the <inputs> section • Galaxy supports multiple input files as one parameter • Requires Cheetah syntax in the <command> tag • Easiest to learn by example? $ cd galaxy -dist $ grep "<conditional " tools /*/*. xml ... $ grep "<repeat " tools /*/*. xml ... http://wiki.galaxyproject.org/Admin/Tools/ToolConfigSyntax
  • 11. The <help> tag • Uses reStructuredText markup language • Blank line for a paragraph break • Use asterisks for *italics*, double-asterisks for **bold** • Can include tables, images, links, etc. <tool id="my_tool" name="My Tool" version="0.0.1"> ... <help > This is a Galaxy wrapper for *My Tool *. If you use this tool , ** please cite this paper **: ... </help > </tool > http://wiki.galaxyproject.org/Admin/Tools/ToolConfigSyntax
  • 12. The <stdio> tag • The <stdio> tag controls error detection • Galaxy default is any output on stderr means an error (!) • Unix/Linux convention allows logging etc on stderr • Unix/Linux convention is non-zero return code means error For Unix style tools, only check the return code: <tool id="my_tool" name="My Tool" version="0.0.1"> ... <stdio > <!-- Anything other than zero is an error --> <exit_code range="1:" /> <exit_code range=":-1" /> </stdio > ... </tool > http://wiki.galaxyproject.org/Admin/Tools/ToolConfigSyntax
  • 13. Further reading • Functional Tests • Dynamics captions on output files • Variable numbers of output files • Composite datatypes • Defining new Galaxy datatypes • Dependencies & The Tool Shed • Galaxy macros to reduce repetitive XML