// most of this is based on comments in Compiler.java - BH


Jmol select, restrict, define <expression> syntax:

    expression          ::= NONE | ALL | predefinedSet |
                            clauseResidueSpec {clauseAtomSpec} {clauseModelSpec} |
                            clauseComparator |
                            clauseWithin |
                            ( expression )
                            NOT expression
                            expression AND expression
                            expression OR expression

    // Note that standard NOT/AND/OR precedence is implemented, with parentheses required
    // to override NOT > AND > OR.


    I've added "predefinedSet" here and done some reordering - BH
    You have to have SOMETHING before an atom or model spec


    predefinedSet       ::= AMINO | BACKBONE | DNA | HETERO | HYDROGEN | NUCLEIC | PROTEIN |
                            PURINES | PYRIMIDINES | RNA | SELECTED | SIDECHAINS | SOLVENT | WATER |
                            userDefinedVariable

    // userDefinedVariables are defined using the command DEFINE variableName expression

    Q: Where is "WATER" defined? Are there others like this not in Token.java?

    clauseResidueSpec   ::= [ resNamePattern ] {clauseResNumSpec} {:} { chainSpec } |
                            resNamePattern clauseResNumSpec {:} { chainSpec } |
                            resNamePattern : { chainSpec } |
                            * { clauseResNumSpec } { chainSpec } |
                            clauseResNumSpec {:} chainSpec |
                            : chainSpec

    // Essentially, one needs at least one of a residue name, number, and chain
    // provided in an unambiguous way.
    // If brackets are not included for a name or a colon is not included before a chain, 
    // a conflict may result with predefined variables.


    This was not quite specified correctly in Compiler.java as far as I can tell. 
    You have to have SOMETHING before a clauseAtomSpec and chainSpec, I think.
    Basically, the ":" is not always optional in chainSpecs
    I removed clauseResNameSpec   ::= * | [ resNamePattern ] | resNamePattern
    because there are differences in what is necessary with and without brackets.


    resNamePattern      ::= [A-Z,?]  { [A-Z,?] }  { [A-Z,?] }

    clauseResNumSpec    ::= * | clauseSequenceRange

    clauseSequenceRange ::= clauseSequenceCode { - clauseSequenceCode }

    clauseSequenceCode  ::= seqcode | {-} integer


    Q: What would a negative number mean for a sequence code? 



    Q: What about insertions? How does that work exactly?


    clauseChainSpec     ::= * | ? | character | digit

    clauseAtomSpec      ::= . * | . identifier 

    identifier          ::= filetype-dependent_string | identifier ?

    // note that question marks may be part of identifiers
    // a single ? will match a single character; ?? will match one or two characters
    // no * wildcard here--some identifiers include asterisk

    clauseModelSpec     ::= / * | 
                            / integer

    Compiler.java mentions ":" here, but I don't think so.


    // Note that /1 is the first model; /0 selects all models

    clauseWithin        ::= WITHIN ( clauseDistance , expression )

    // Note that full expressions can be nested within WITHIN clauses

    clauseDistance      ::= integer_250ths_angstroms | decimal_angstroms

    // Note that integers in Jmol often represent Rasmol units, 1/250ths of an Angstrom

    clauseComparator    ::= atomproperty comparatorop integer

    atomproperty        ::= ELEMNO | ATOMNO
    comparatorop        ::= < | = | > | <= | >= | != | <>   

    // Note that currently only these two atom properties are implemented

    Right?


Bob Hanson hansonr@stolaf.edu 10:01 AM 6/14/2004 expressions.htm