BioLegato - PCD: Python-esque Command Definition

From Bioinformatics.Org Wiki

Jump to: navigation, search

Click here to go back to: BioLegato



Contents

Version #1. Informal Syntax and Semantics of PCD.


GENERAL FORMAT OF THE SYNTAX

%<VARIABLE>
	label
		<LABEL_STR>
	type
		<TYPES>
	default
		<VALUE>

#FOR slider TYPE

	min
		<VALUE>
	max
		<VALUE>

#FOR file TYPE

	format
		<FILE FORMAT TYPES>
	save
		<SAVE_VALUE>
	overwrite
		<OVERWRITE_VALUE>
	content
		<CONTENT_VALUE>

#FOR chooser or choice_menu TYPE	
	choices
		<LABEL_CHOICES>
			<VALUES>



#FOR button TYPE
	command
		<COMMAND_STR>


<LABEL_STR> : any string

<TYPES>: slider, text, tempfile, chooser, choice_menu, button

<VALUE>: For silder type: numerical. For text type: string. For chooser type: depend of the choice

<FILE FORMAT TYPES>: FASTA, GDE, GebBank, etc

<SAVE_VALUE>: BOOLEAN: true or false

<OVERWRITE_VALUE>: BOOLEAN: true or false

<CONTENT_VALUE: empty or canvas

<COMMAND_STR>: string with the command line


It was obtained to have the same behavior as the GDEMenu syntax.

We have proven this version, developing the Conversion Software Application (from GDE to PCD) and the parsing program ==> it is working OK.

Preliminary file conversion done

From here, we get the strict BNF notation and the general notation

PCD version 1 defined using BNF (Backus-Naur Form) Metalanguage


Version #2

We have to include in the syntax new features:

BioLegato - Internal format discussion

Proposals to choose the version #2

Proposal #1 - From Pythom

Examples:

Object/sequence variables
%START
    type
        slider
     min
        0
     max
        len(@sequence) 

Conditional variables
%END
    type
        slider
     min
        if len(@sequence) < 50  
           0  
        else
           50
     max
        1000

Tabbed Panes
^Group 1
    %Data 1
        type
            slider
         min
            0
         max
            100 
.....
^Group 2
    %Data 2
        type
            text
        label
            Number of:   
.....

Proposal #2 - Simplification

Examples:

Object/sequence variables
%START
    type
        slider
     min
        0
     max
        @sequence.length 

Conditional variables
%END
    type
        slider
     min
        !(@sequence.length < 50 ? 0 : 50)
     max
        @sequence.length 

Tabbed Panes
^ Group 1
    %Data 1
        type
            slider
         min
            0
         max
            100 
.....
^ Group 2
    %Data 2
        type
            text
        label
            Number of:   
.....

Proposal #3 - Verbose

Examples:

all code can be embedded by <{}> and interpreted as such

tab Tab1
    var START
        min
            0
        max
            <{ $sequence.length }>
        default
            <{
                if sequence.length > 50
                     write 50
                 else
                     write $sequence.length
            }>
    var END
       min
           0
        ,,,,

tab Tab2
    var ABC
        ...

Proposal #4 - Hybrid

Examples:

all code can be embedded by <{}> and interpreted as such
Object/sequence variables
%START
    type
        slider
     min
        0
     max
        @sequence.length 

Conditional variables
%END
    type
        slider
     min
        <{ if (sequence.length < 50)
                     then
                         0
                     else
                         50
                 print "tea time!" }>
     max
        @sequence.length 

Tabbed Panes
^Group 1
    %Data 1
        type
            slider
         min
            0
         max
            100 
.....
^Group 2
    %Data 2
        type
            text
        label
            Number of:
.....
Comments:

# abc
##### xyz
### ***
# all comments are defined as a sequence of # followed by a mandatory space (or new line if you only want to use #'s in the comment).  Following the mandaory space you may use any combination of
# characters to define your comment, as the parser will ignore any line beginning with one or more #'s followed by a space (or any line containing only #'s).
# as a regular expression /#*(\s[^\n]*)?/


Proposal #5 - Verbose-est

Examples:

#Variables are defined using "var" name
var START
    type
        slider
     min
        0
     max
        @sequence.length       #values from the sequence in the canvas are taken as @sequence
     error                     #SANITY CHECKING possible errors are define with "error" word. 
        higher_than_0          #SANITY CHECKING This is the kind of error associated to this    
                                 variable 

#Conditional variables
var END
    type
        slider
     min
        if (@sequence.length < 50) then min=0 #natural conditional instructions. As other languages
        else min=50
     max
        @sequence.length 

#Tabbed Panes. Tabs are defined using "tab" name
tab Group 1 
    var Data 1
        type
            slider
         min
            0
         max
            100 

    var Data 2
        type
            text
        default
            xxxx 
         error
            blank_string 

tab Group 2
    var Data 3
        type
            text
        label
            Number of:

..................

#to include ICONS in this menu option
icon /image1.png

#to include MOUSE-OVER TOOL TIPS in this menu option
tip "Number a Sequence"

#to define DEPENDENTS/CONDITIONS  
var x1
  type 
     slider
  min
     0
  max
     1000

var x2
  type 
     slider
  min 
     100
  max 
     500
  dependence  
     if x1 >= 100 then default=100
     else default=grayed_out

var x3
  type 
     slider
  min 
     100
  max 
     500
  dependence  
     if x1+x2 >= 100 then default=x1+x2
     else default=grayed_out

Comments:

# abc
##### xyz
### ***
# all comments are defined as a sequence of # followed by a mandatory space (or new line if you only want to use #'s in the comment).  Following the mandaory space you may use any combination of
# characters to define your comment, as the parser will ignore any line beginning with one or more #'s followed by a space (or any line containing only #'s).
# as a regular expression /#*(\s[^\n]*)?/

Proposal #6 - simplifying things

Examples:

####
# NOTE: All indentation should be 3 spaces; however, because this has been formatted multiple times, this Wiki version may contain uneven spacing
# NOTE: Fields can be defined inline (e.g. type "ABC")
####

# All strings must be put in quotation marks
name "NUMSEQ - ...."

#to include ICONS in this menu option
icon "image1.png"

#to include MOUSE-OVER TOOL TIPS in this menu option
tip "Number a Sequence"

#Variables are defined using "var" name
var START
    type "slider"
    min 0
    max
        sequence.length                               #values from the sequence in the canvas are taken as @sequence
    check                                             #SANITY CHECKING possible errors are define with "error" word. 
        if START < 0 then error_message "value less than 0"   #SANITY CHECKING This is the kind of error associated to this variable 

#Conditional variables
var END
    type
        "slider"
    min
        if (@sequence.length < 50) then min=0          #natural conditional instructions. As other languages
        else min=50
    max
        sequence.length 

#Tabbed Panes. Tabs are defined using "tab" name
tab Group 1 
    var Data 1
        type
            "slider"
        min
            0
        max
            100 

    var Data 2
        type
            "text"
        default
            "xxxx"
        check
            if text = "" error = "This variable should not be empty"    #SANITY CHECKING This is the kind of error associated to this variable

tab Group 2
    var Data 3
        type
            "text"
        label
            Number of:

..................

#to define DEPENDENTS/CONDITIONS  
var x1
  type 
     "slider"
  min
     0
  max
     1000

var x2
  type 
     "slider"
  min 
     100
  max 
     500
  dependence                  #Dependent condition
     if x1 >= 100
        default=100
     else
        default=grayed_out

var x3
  type 
     "slider"
  min 
     100
  max 
     500
  check                 #Dependent condition
     if x1+x2 >= 100 then default=x1+x2
     else default=grayed_out

Comments:

# abc
##### xyz
### ***
# all comments are defined as a sequence of # followed by a mandatory space (or new line if you only want to use #'s in the comment).  Following the mandaory space you may use any combination of
# characters to define your comment, as the parser will ignore any line beginning with one or more #'s followed by a space (or any line containing only #'s).
# as a regular expression /#*(\s[^\n]*)?/


Proposal 6 EBNF (dynamic indent/dedent version)

<file>         ::= <section> <file>
                 | <section>
<section>      ::= <param>
                 | <tab>
                 | <ofield>
<ofield>       ::= <t_name> <text>
                 | <t_icon> <text>
                 | <t_tip> <text>
                 | <t_system> <indent> <systems> <dedent>
<systems>      ::= <systems> <nl> <system>
                 | <system>
<system>       ::= <t_all>
                 | <t_linux32>
                 | <t_linux64>
                 | <t_osx_x86>
                 | <t_sunsparc>
                 | <t_sunx64>
                 | <t_win32>
<tab>          ::= <t_tab> <name> <indent> <params> <dedent>
<params>       ::= <param> <nl> <params>
                 | <param>
<param>        ::= <t_param> <indent> <pfields> <dedent>
<pfields>      ::= <pfield> <nl> <pfields>
                 | <pfield>
<pfield>       ::= <t_name> <ptext>
                 | <t_type> <ptext>
                 | <t_default> <ptext>
                 | <t_default> <pnum>
                 | <t_default> <pbool>
                 | <t_min> <pnum>
		 | <t_max> <pnum>
		 | <t_format> <file_format>
		 | <t_save> <pbool>
		 | <t_overwrite> <boolean_value>
		 | <t_content> <content_value>
		 | <t_shell> <ptext>
		 | <t_close> <pbool>
		 | <t_choices> <indent> <choice_list> <dedent>
<file_format>  ::= <t_fasta>
                 | <t_gde>
                 | <t_genbank>
                 | <t_flat>
                 | <t_raw>
<choice_list>  ::= <identifier> <space> <number>
                 | <identifier> <space> <text>
                 | <identifier> <indent> <number <dedent>
                 | <identifier> <indent> <text> <dedent>
<pnum>         ::= <space> <number>
                 | <indent> <number> <dedent>
<pbool>        ::= <space> <bool>
                 | <indent> <bool> <dedent>
<ptext>        ::= <space> <text>
                 | <indent> <text> <dedent>
<name>         ::= <identifier>
<bool>         ::= <t_true>
                 | <t_false>
<var>          ::= <identifier>


SPECIAL
*******
<comment>      ::= <hash_symbols> <space> <unbound_text>
                 | <hash_symbols> <space>
                 | <hash_symbols>
<hash_symbols> ::= '#' <hash_symbols>
                 | '#'
<nl>           ::= new line separator (no indentation change)
<indent>       ::= increase indentation by 3 spaces (matches newline)
<dedent>       ::= decrease indentation by 3 spaces (matches newline)

KEYWORDS
********
<t_all>        ::= 'all'
<t_choices>    ::= 'choices'
<t_close>      ::= 'close'
<t_content>    ::= 'content'
<t_default>    ::= 'default'
<t_false>      ::= 'false'
<t_fasta>      ::= 'fasta'
<t_flat>       ::= 'flat'
<t_format>     ::= 'format'
<t_gde>        ::= 'gde'
<t_genbank>    ::= 'genbank'
<t_icon>       ::= 'icon'
<t_linux32>    ::= 'linux32'
<t_linux64>    ::= 'linux64'
<t_max>        ::= 'max'
<t_min>        ::= 'min'
<t_name>       ::= 'name'
<t_osx64>      ::= 'osx86_64'
<t_ovwerwrite> ::= 'overwrite'
<t_param>      ::= 'var'
<t_raw>        ::= 'raw'
<t_tab>        ::= 'tab'
<t_tip>        ::= 'tip'
<t_true>       ::= 'true'
<t_type>       ::= 'type'
<t_save>       ::= 'save'
<t_shell>      ::= 'shell'
<t_sunsparc>   ::= 'sunsparc'
<t_sunx64>     ::= 'sunx86'
<t_win32>      ::= 'win32'

TOKENS
******
<space>        ::= ' ' <space>
                 | '\t' <space>
                 | ' '
                 | '\t'
<number>       ::= <digits> '.' <digits>
                 | <digits>
<digits>       ::= <digit> <digits>
                 | <digit>
<digit>        ::= 0 - 9
<unbound_text> ::= any character
<text>         ::= '"' <quoted_text> '"'
<quoted_text>  ::= any non " character
                 | '"' '"'

Proposal 6 EBNF (limited/static indent version - this is if the above system won't work) - pre-programming code

<file>         ::= <section> <nl> <file>
                 | <section>
<section>      ::= <param>
                 | <tab>
                 | <ofield>
                 | <blank_line>
<ofield>       ::= <t_name> <text>
                 | <t_icon> <text>
                 | <t_tip> <text>
                 | <t_system> <indent> <systems> <dedent>
<systems>      ::= <systems> <nl> <system>
                 | <system>
<system>       ::= <t_all>
                 | <t_linux32>
                 | <t_linux64>
                 | <t_osx_x86>
                 | <t_sunsparc>
                 | <t_sunx64>
                 | <t_win32>


<param>        ::= <t_param> <nl> <pfields>
<pfields>      ::= <ind> <pfield> <nl> <pfields>
                 | <ind> <pfield>
<pfield>       ::= <text_param> <inda> <text>
                 | <num_param>  <inda> <number>
                 | <bool_param> <inda> <bool>
                 | <any_param>  <inda> <any_type>
		 | <t_format>   <inda> <file_format>
		 | <t_content>  <inda> <content_value>
		 | <t_choices>  <nl>   <choice_list>
<choice_list>  ::= <identifier> <indb> <any> <nl> <choice_list>
                 | <identifier> <indb> <any> <nl>


<tab>          ::= <t_tab> <name> <nl> <tparams>
<tparams>      ::= <ind> <tparam> <nl> <tparams>
                 | <ind> <tparam>
<tparam>       ::= <ind> <t_param> <nl> <tpfields>
<tpfields>     ::= <ind> <ind> <tpfield> <nl> <tpfields>
                 | <ind> <ind> <tpfield>
<tpfield>      ::= <text_param> <indb> <ptext>
                 | <num_param>  <indb> <number>
                 | <bool_param> <indb> <bool>
                 | <any_param>  <indb> <any_type>
		 | <t_format>   <indb> <file_format>
		 | <t_content>  <indb> <content_value>
		 | <t_choices>  <nl>   <tchoice_list>
<choice_list>  ::= <identifier> <indc> <any> <nl> <choice_list>
                 | <identifier> <indc> <any> <nl>


<inda>         ::= <space>
                 | <nl> <ind> <ind>
<indb>         ::= <space>
                 | <nl> <ind> <ind> <ind>
<indc>         ::= <space>
                 | <nl> <ind> <ind> <ind> <ind>
<name>         ::= <identifier>


TYPES
*****
<bool>         ::= <t_true>
                 | <t_false>
<text>         ::= '"' <quoted_text> '"'
<number>       ::= <digits> '.' <digits>
                 | <digits>

TOKEN CLASSES
*************
<any_type>     ::= <bool>
                 | <text>
                 | <number>
<any_param>    ::= <t_default>
<text_param>   ::= <t_name>
                 | <t_type>
                 | <t_shell>
<num_param>    ::= <t_min>
		 | <t_max>
<bool_param>   ::= <t_close>
		 | <t_save>
		 | <t_overwrite>
<file_format>  ::= <t_fasta>
                 | <t_gde>
                 | <t_genbank>
                 | <t_flat>
                 | <t_raw>


SPECIAL
*******
<comment>      ::= <hash_symbols> <space> <unbound_text>
                 | <hash_symbols> <space>
                 | <hash_symbols>
<hash_symbols> ::= '#' <hash_symbols>
                 | '#'
<blank_line>   ::= <space> <blank_line>


KEYWORDS
********
<t_all>        ::= 'all'
<t_choices>    ::= 'choices'
<t_close>      ::= 'close'
<t_content>    ::= 'content'
<t_default>    ::= 'default'
<t_false>      ::= 'false'
<t_fasta>      ::= 'fasta'
<t_flat>       ::= 'flat'
<t_format>     ::= 'format'
<t_gde>        ::= 'gde'
<t_genbank>    ::= 'genbank'
<t_icon>       ::= 'icon'
<t_linux32>    ::= 'linux32'
<t_linux64>    ::= 'linux64'
<t_max>        ::= 'max'
<t_min>        ::= 'min'
<t_name>       ::= 'name'
<t_osx64>      ::= 'osx86_64'
<t_ovwerwrite> ::= 'overwrite'
<t_param>      ::= 'var'
<t_raw>        ::= 'raw'
<t_tab>        ::= 'tab'
<t_tip>        ::= 'tip'
<t_true>       ::= 'true'
<t_type>       ::= 'type'
<t_save>       ::= 'save'
<t_shell>      ::= 'shell'
<t_sunsparc>   ::= 'sunsparc'
<t_sunx64>     ::= 'sunx86'
<t_win32>      ::= 'win32'


TOKENS
******
<space>        ::= ' ' <space>
                 | '\t' <space>
                 | ' '
                 | '\t'
<nl>           ::= '\n'
<ind>          ::= '   '
<digits>       ::= <digit> <digits>
                 | <digit>
<digit>        ::= 0 - 9
<quoted_text>  ::= anything but '"'
                 | '"' '"'
<unbound_text> ::= any character

Proposal 6 EBNF (limited/static indent version + code) - in-progress

<file>         ::= <section> <nl> <file>
                 | <section>
<section>      ::= <param>
                 | <tab>
                 | <ofield>
                 | <blank_line>
<ofield>       ::= <t_name> <text>
                 | <t_icon> <text>
                 | <t_tip> <text>
                 | <t_system> <indent> <systems> <dedent>
<systems>      ::= <systems> <nl> <system>
                 | <system>
<system>       ::= <t_all>
                 | <t_linux32>
                 | <t_linux64>
                 | <t_osx_x86>
                 | <t_sunsparc>
                 | <t_sunx64>
                 | <t_win32>


<param>        ::= <t_param> <nl> <pfields>
<pfields>      ::= <ind> <pfield> <nl> <pfields>
                 | <ind> <pfield>
<pfield>       ::= <text_param> <inda> <text>
                 | <num_param>  <inda> <number>
                 | <bool_param> <inda> <bool>
                 | <any_param>  <inda> <any_type>
		 | <t_format>   <inda> <file_format>
		 | <t_content>  <inda> <content_value>
		 | <t_choices>  <nl>   <choice_list>
<choice_list>  ::= <identifier> <indb> <any> <nl> <choice_list>
                 | <identifier> <indb> <any> <nl>


<tab>          ::= <t_tab> <name> <nl> <tparams>
<tparams>      ::= <ind> <tparam> <nl> <tparams>
                 | <ind> <tparam>
<tparam>       ::= <ind> <t_param> <nl> <tpfields>
<tpfields>     ::= <ind> <ind> <tpfield> <nl> <tpfields>
                 | <ind> <ind> <tpfield>
<tpfield>      ::= <text_param> <indb> <ptext>
                 | <num_param>  <indb> <number>
                 | <bool_param> <indb> <bool>
                 | <any_param>  <indb> <any_type>
		 | <t_format>   <indb> <file_format>
		 | <t_content>  <indb> <content_value>
		 | <t_choices>  <nl>   <tchoice_list>
<choice_list>  ::= <identifier> <indc> <any> <nl> <choice_list>
                 | <identifier> <indc> <any> <nl>


<inda>         ::= <space>
                 | <nl> <ind> <ind>
<indb>         ::= <space>
                 | <nl> <ind> <ind> <ind>
<indc>         ::= <space>
                 | <nl> <ind> <ind> <ind> <ind>
<name>         ::= <identifier>


CODE
****
<code>         ::= <math>
                 | <if_then>
<if_then>      ::= <t_if> <cond> <t_then> <code>
<cond>         ::= <math> <comp> <math> <andor> <cond>
                 | <math> <comp> <math>
<andor>        ::= <t_and>
                 | <t_or>
                 | <t_xor>
<comp>         ::= <t_eq>
                 | <t_lt>
                 | <t_gt>
<math>         ::= <m_open> <math> <m_close>
                 | <norv> <op> <norv>
                 | <norv>
<op>           ::= <t_plus>
                 | <t_minus>
                 | <t_mul>
                 | <t_div>
<norv>         ::= <number>
                 | <variable>
<variable>     ::= <identifier>


TYPES
*****
<bool>         ::= <t_true>
                 | <t_false>
<text>         ::= '"' <quoted_text> '"'
<number>       ::= <digits> '.' <digits>
                 | <digits>

TOKEN CLASSES
*************
<any_type>     ::= <bool>
                 | <text>
                 | <number>
<any_param>    ::= <t_default>
<text_param>   ::= <t_name>
                 | <t_type>
                 | <t_shell>
<num_param>    ::= <t_min>
		 | <t_max>
<bool_param>   ::= <t_close>
		 | <t_save>
		 | <t_overwrite>
<file_format>  ::= <t_fasta>
                 | <t_gde>
                 | <t_genbank>
                 | <t_flat>
                 | <t_raw>


SPECIAL
*******
<comment>      ::= <hash_symbols> <space> <unbound_text>
                 | <hash_symbols> <space>
                 | <hash_symbols>
<hash_symbols> ::= '#' <hash_symbols>
                 | '#'
<blank_line>   ::= <space> <blank_line>


KEYWORDS
********
<t_all>        ::= 'all'
<t_and>        ::= 'and'
<t_choices>    ::= 'choices'
<t_close>      ::= 'close'
<t_content>    ::= 'content'
<t_default>    ::= 'default'
<t_false>      ::= 'false'
<t_fasta>      ::= 'fasta'
<t_flat>       ::= 'flat'
<t_format>     ::= 'format'
<t_gde>        ::= 'gde'
<t_genbank>    ::= 'genbank'
<t_icon>       ::= 'icon'
<t_if>         ::= 'if'
<t_linux32>    ::= 'linux32'
<t_linux64>    ::= 'linux64'
<t_max>        ::= 'max'
<t_min>        ::= 'min'
<t_name>       ::= 'name'
<t_or>         ::= 'or'
<t_osx64>      ::= 'osx86_64'
<t_ovwerwrite> ::= 'overwrite'
<t_param>      ::= 'var'
<t_raw>        ::= 'raw'
<t_tab>        ::= 'tab'
<t_then>       ::= 'then'
<t_tip>        ::= 'tip'
<t_true>       ::= 'true'
<t_type>       ::= 'type'
<t_save>       ::= 'save'
<t_shell>      ::= 'shell'
<t_sunsparc>   ::= 'sunsparc'
<t_sunx64>     ::= 'sunx86'
<t_win32>      ::= 'win32'
<t_xor>        ::= 'xor'


SYMBOLIC TOKENS
***************
<m_open>       ::= '('
<m_close>      ::= ')'
<t_plus>       ::= '+'
<t_minus>      ::= '-'
<t_mul>        ::= '*'
<t_div>        ::= '/'
<t_eq>         ::= '='
<t_lt>         ::= '<'
<t_gt>         ::= '>'


TOKENS
******
<space>        ::= ' ' <space>
                 | '\t' <space>
                 | ' '
                 | '\t'
<nl>           ::= '\n'
<ind>          ::= '   '
<digits>       ::= <digit> <digits>
                 | <digit>
<digit>        ::= 0 - 9
<quoted_text>  ::= anything but '"'
                 | '"' '"'
<unbound_text> ::= any character

Personal tools
Namespaces
Variants
Actions
wiki navigation
Toolbox