mobyle xml

20
Mobyle XML Vivek Gopalan Version history: First version for training Nick and Art – Vivek, 02/07/2011

Upload: leigh-woodard

Post on 03-Jan-2016

19 views

Category:

Documents


0 download

DESCRIPTION

Version history: First version for training Nick and Art – Vivek, 02/07/2011. Mobyle XML. Vivek G opalan. Mobyle XML. Link between command-line application and web-form or web service Defines the command-line application documentations and arguments in XML format. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Mobyle  XML

Mobyle XML

Vivek Gopalan

Version history:First version for training Nick and Art– Vivek, 02/07/2011

Page 2: Mobyle  XML

Mobyle XML

• Link between command-line application and web-form or web service

• Defines the command-line application documentations and arguments in XML format

Page 3: Mobyle  XML

Mobyle Framework : Command-line Application to Web Application

clustalw-mobyle.xml

Page 4: Mobyle  XML

Tutorial

• Assume Vivek has written a simple command-line application called fah2celsius to convert Fahrenheit (F) to Celsius (C)

fah2celsius --input 270• The above commands prints the Celsius value

in the standard output.• Let’s convert this simple application to web

application using Mobyle Framework

Page 5: Mobyle  XML

Implementation/Deployment steps

1. Create a Mobyle XML file called fah2celsius.xml to handle the application input and output parameters.

fah2celsius --input 270

2. Copy the file to the Local/Services/Programs folder in Mobyle library folder– Mobyle folder is configured by default to fetch XML files from this

folder

3. Deploy the fah2celsius.xml to the Mobyle web location using Tools/mobdeploy command– The deployment step checks erros and processes the XML file from

the above folder and copy it to the web folder that is accessible by Mobyle application.

Tools/mobdeploy deploy -p fah2celsus

4. Test the deployment from the Mobyle web interfaceDesign slide link

Page 6: Mobyle  XML

XML view generated using http://xmlgrid.net/

Mobyle XML file – primary tags

head tag contains the metadata about the Application such as title, author, categories,Documentation, references, etc.

parameters tag defines the input and outputarguments used by the command-line

program tag is the primary tag used to define about specific application

Page 7: Mobyle  XML

XML view generated using http://xmlgrid.net/

Mobyle XML file – head tag (meta data)

name tag (usually same as the XML file name), used to name job name

command tag represent the actual command or executable file name

category tag is used to show the fah2cesius application in the applications list tree in Mobyle interface

Page 8: Mobyle  XML

XML view generated using http://xmlgrid.net/

Mobyle XML file – parameter Vs Paragraph

Parameter represents a specific command line argumentand represent one HTML form component or widget.

fah2celsius --input 270

First parameter (input_value)

fah2celsius --input 270 --format-output > celcius.txt

1st parameter (input_value) 3rd parameter (output_file)

2st parameter (format_output)

Paragraph represents one or more parameters (command line argument)2nd and 3rd parameters could be combined as “Output options”

Page 9: Mobyle  XML

Parameter

• Defines the specific argument of command line arguments– Should contain unique name– value and/or default value– Code to generate the command-line argument string

• Written as simple python conditions

– User-friendly description and comments– Relative position of it in the command-line– Precondition to generate the condition

• E.g only add the parameter value if some other parameter value is selected

• Written as simple python conditions

Page 10: Mobyle  XML

Parameter - continues

– Different data types that is mapped to specific HTML form components or widgets• Sequence/Alignment/Tree (file upload button)• Integer/Float/String (Text box)• Text/Report (File upload button)• Choice/MultipleChoice (list box)• Boolean (Check box)

– Can be categorized based on the attributes• Issimple ( show in simple view only)• Ishidden (do not show this panel – used for options that are given

as default)• Ismandatory (cannot be empty)• Isstdout/isout ( the output files generated from the application –

used for pipelining and workflow creation)

Page 11: Mobyle  XML

XML view generated using http://xmlgrid.net/

Mobyle XML file – parameter

The parameter tag attributes represents the categories

The prompt tag gives the simple description

The name tag should be unique.

The type/datatype/class tags defines the typeThe argpos tag defines the relative position of the Parameter in the command line

The format tag defines actual command-line string Generated. A python code snippet is used.

Page 12: Mobyle  XML

XML view generated using http://xmlgrid.net/

Mobyle XML file – Other examples (Boolean type)

The vdef value selects the default value for Boolean typeIt can be 0 or 1

Page 13: Mobyle  XML

Python code snippet

• The parameter name is used refer to value– E.g input_value could used to refer to the

value of that parameter in any parameters• Special variables - value & vdef– Parameters cannot have value or vdef as their

names or id.– value: represents the selected value of that

parameter or file name (if parameter is file upload)– vdef: represents the default value of that parameter

Page 14: Mobyle  XML

Python code snippets1. Concatenation:“ --input “ + str(value)

If the value entered by user is 10 then “ --input 10” willBe generated by the above codeNotes: 1. Leave a whitespace at the beginning of the code. 2. + is used to concatenate two string3. Double or single quote should be used to delimit strings

2. One line Condition:(“” , “ -b ”)[value is not None](“” , “ --o ” + str(value))[value != vdef](“ --x ” + vdef , “ --x ” + value)[input_value < 5 ]

General structure : circular bracket and square bracket(false action, true action) [condition]

The input_value represent the parameter name in that XML file.

Page 15: Mobyle  XML

Python code snippets3. Check value is present in a list:(“”,” –a tempCal ”) [ input_type in [‘fahrenheit’,’celsius’] ]

If input_type parameter value is fahrenheit or celsius then “ –a tempCal “ will be used as parameter command-line Argument

Very often used in the <precond> tag which is used to check/evaluate whether the command-line argument for that parameter could be used or not in the command.

Page 16: Mobyle  XML

Paragraph

• Contains one or more parameters• Group command-line arguments into

meaningful categories– E.g. input options, output options, advanced

features• Could be used to control the layout of multiple

parameters (not often used now in Mobyle)

Page 17: Mobyle  XML

XML view generated using http://xmlgrid.net/

Mobyle XML file – paragraph

The name tag should be unique.

The parameters tag defines multiple parametersOr paragraphs in it

The layout tag could be used for arranging the parametersIn the paragraph in the web interface (optional)

Page 18: Mobyle  XML

Design steps (follow this before implementation step)

• Read the manual or help page of the command-line application– Note whether the order of parameter matters

• Categorize the parameters into meaningful groups(paragraph)• Use the command-line arguments names (eg. --input or -x ) as part

of the parameter description (<prompt> tag)• Note down the different types of output files generated from

application– Useful to display the output file in job results and linking to other applications

in workflow

• Note which parameters will be assigned simple and/mandatory• Try to use all the command-line arguments for the applications

– Helps experienced command-line user to related web form to the command-line utility

Implementation slide link

Page 19: Mobyle  XML

Final notes

• Use Xinclude option for parameters that uses local resources– Eg blast databases– Eg bowtie indexes

• Remember– We covered only the <program> tag in this tutorial– Mobyle manages the job results and workflow

definitions also through XML– Workflow definitions can be automatically handled

Mobyle Workflow application or manually by user.

Page 20: Mobyle  XML

Thanks….