Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Mobyle XML Vivek Gopalan Version history: First version for training Nick and Art – Vivek, 02/07/2011."— Presentation transcript:

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

2 Mobyle XML Link between command-line application and web-form or web service Defines the command-line application documentations and arguments in XML format

3 Mobyle Framework : Command-line Application to Web Application clustalw-mobyle.xml

4 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

5 Implementation/Deployment steps 1.Create a Mobyle XML file called fah2celsius.xml to handle the application input and output parameters. fah2celsius --input 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 interface Design slide link

6 XML view generated using 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 output arguments used by the command-line program tag is the primary tag used to define about specific application

7 XML view generated using 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

8 XML view generated using Mobyle XML file – parameter Vs Paragraph Parameter represents a specific command line argument and represent one HTML form component or widget. fah2celsius --input 270 First parameter (input_value) fah2celsius --input format-output > celcius.txt 1 st parameter (input_value) 3 rd parameter (output_file) 2 st parameter (format_output) Paragraph represents one or more parameters (command line argument) 2 nd and 3 rd parameters could be combined as “Output options”

9 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

10 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)

11 XML view generated using 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 type The 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.

12 XML view generated using Mobyle XML file – Other examples (Boolean type) The vdef value selects the default value for Boolean type It can be 0 or 1

13 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

14 Python code snippets 1. Concatenation: “ --input “ + str(value) If the value entered by user is 10 then “ --input 10” will Be generated by the above code Notes: 1. Leave a whitespace at the beginning of the code is used to concatenate two string 3. 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.

15 Python code snippets 3. 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 tag which is used to check/evaluate whether the command-line argument for that parameter could be used or not in the command.

16 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)

17 XML view generated using Mobyle XML file – paragraph The name tag should be unique. The parameters tag defines multiple parameters Or paragraphs in it The layout tag could be used for arranging the parameters In the paragraph in the web interface (optional)

18 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 ( 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

19 Final notes Use Xinclude option for parameters that uses local resources – Eg blast databases – Eg bowtie indexes Remember – We covered only the 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.

20 Thanks….


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

Similar presentations


Ads by Google