Jump to content

PatternQuery:Language Reference: Difference between revisions

From WebChemistry Wiki
No edit summary
 
(27 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Introduction ==
== Introduction ==


DISCLAIMER: This is an early version of the MotiveQuery language. There is probably a lot of bugs. Individual function names and syntax are all subject to change.
PatternQuery (PQ) is a user friendly chemical language primarily designed for defining atom patterns in molecules. PQ combines the clarity and brevity of programming languages with  the versatility of natural language, aiming for an efficient inclusion of chemical and biochemical knowledge into the definition of patterns. PQ allows definitions based on chemical connectivity and three-dimensional structure at the same time. Additionally, in the case of molecules based on residue chains (such as proteins, nucleic acids, saccharides, etc.), PQ allows the user to include any amount of information regarding the residue level structure directly into the definition of the patternss.


MotiveQuery is a subset of the Python programming language. Therefore, if you have experience with it, it should not be a problem to use MQ as well.
PatternQuery is a subset of the Python programming language. Therefore, if you have experience with it, it should not be a problem to use PQ as well.


* The language is case sensitive - "filter" is NOT the same as "FiLtEr".
* The language is case sensitive - "filter" is NOT the same as "FiLtEr".


Some of the functions return '''<code>Motives</code>''' while other only '''<code>Motive</code>'''.  
Some of the functions return '''<code>PatternSeq</code>''' while other return '''<code>Pattern</code>'''.  
* '''<code>Motive</code>''' is a set of atoms.
* '''<code>Pattern</code>''' is a set of atoms.
* '''<code>Motives</code>''' is a sequence of ''motives'' (the sets of atoms).
* '''<code>PatternSeq</code>''' is a sequence of '''<code>Pattern</code>''' (the sets of atoms).


When a molecule is queried say using the expression <code>Rings(5 * ["C"] + ["O"])</code> a sequences of motives each containing 6 atoms (5 C and 1 O) is returned. However, some functions such as <code>Filter</code> need to operate on a single motive (the set of atoms) - not the whole sequences. The query <code>Filter(Residues(), lambda r: r.Count(Atoms()) > 10)</code> first finds all residue '''<code>Motives</code>''' (sequence) and then passes every single '''<code>Motive</code>''' (set of atoms) to a function that counts the atoms in the motive and returns True if there is at least 11 of them. This is the reasoning behind these two types.
When a molecule is queried, say using the expression <code>Rings(5 * ["C"] + ["O"])</code> a sequences of patterns each containing 6 atoms (5 C and 1 O) is returned. However, some functions such as <code>Filter</code> need to operate on a single pattern (the set of atoms) - not the whole sequences. The query <code>Residues().Filter(lambda r: r.Count(Atoms()) > 10)</code> first finds all residue patterns ('''<code>PatternSeq</code>''') and then passes every single '''<code>Pattern</code>''' (set of atoms) to a function that counts the atoms in the pattern and returns True if there is at least 11 of them. This is the reasoning behind these two types.


== Elementary Types ==
''Basic value types.''
=== Bool ===
;Example
: <code>True</code>
: ''True value.''
----
=== Integer ===
;Example
: <code>42</code>
: ''The ultimate answer.''
----
=== Real ===
;Example
: <code>12.87</code>
: ''Real number.''
----
=== String ===
;Example
: <code>"aBcD"</code>
: ''String.''
----
=== Symbol ===
;Example
: <code>x</code>
: ''The 'x' identifier.''
<br/>
== Basic Language Syntax ==
''Basic syntactic elements the MotiveQuery language.''
=== Apply ===
<code>Apply -&gt; ?</code><br/>
''Application of a function to its arguments. (internal)''<br/>
;Example
: <code>f(1,"x")</code>
: ''Apply function 'f' to arguments '1' and 'x'.''
----
=== Assign (=) ===
<code>Assign -&gt; ?</code><br/>
''This symbol is used for assigning optional parameters of functions. (internal)''<br/>
;Example
: <code>NotAminoAcids(NoWaters = 1)</code>
: ''All residues that are not amino acids or waters.''
----
=== Lambda ===
<code>Lambda -&gt; 'a->'b</code><br/>
''An anonymous (nameless) function.''<br/>
;Example
: <code>lambda m: Residues("HIS").Count(m)</code>
: ''A function that counts number of HIS residues in Motive m.''
----
=== List ===
<code>List(elements&#58; ?+) -&gt; List</code><br/>
''A list of elements.''<br/>
;Arguments
: elements&#58; ?+ - ''Elements.''
;Example
: <code>[1, "a", True, [3, 4]]</code>
: ''Create a list with 4 elements.''
----
=== Repeat (*) ===
<code>Repeat(x&#58; ?, n&#58; Integer) -&gt; ?</code><br/>
''Creates a Seqeuence of x's repeated n times. This symbol is not directly supported and can be accesed thru the function Many or List concatenation of Python. (internal)''<br/>
;Arguments
: x&#58; ? - ''Expression to be repeated.''
: n&#58; Integer - ''Count.''
;Example
: <code>Rings(5 * ["C"] + ["O"])</code>
: ''Equivalent to <code>Rings("C","C","C","C","C","O")</code>.''
----
=== Sequence ===
<code>Sequence(xs&#58; ?*) -&gt; ?</code><br/>
''Sequence of elements that is automatically flattened to the argument list of the parent function. (internal)''<br/>
;Arguments
: xs&#58; ?* - ''Values.''
;Example
: <code>1,2,3</code>
: ''Sequence of numbers 1, 2, and 3.''
----
=== Tuple ===
<code>Tuple -&gt; ?</code><br/>
''A tuple of elements. Tuples serve as arguments for functions. Internal use only. (internal)''<br/>
;Example
: <code>(1,"a",True)</code>
: ''Create a tuple with 3 elements.''
<br/>
== Value Functions ==
''Functions such as addition or comparison of numbers.''
=== Abs ===
<code>Abs(x&#58; Number) -&gt; Number</code><br/>
''Computes the 'Abs' function of the argument.''<br/>
;Arguments
: x&#58; Number - ''Argument.''
;Example
: <code>Abs(x)</code>
: ''Evaluates the expression.''
----
=== Divide (/) ===
<code>Divide(x&#58; Number, y&#58; Number) -&gt; Number</code><br/>
''Computes the 'Divide' function of the values.''<br/>
;Arguments
: x&#58; Number - ''Left argument.''
: y&#58; Number - ''Right argument.''
;Example
: <code>x / y</code>
: ''Evaluates the expression.''
----
=== Equal (==) ===
<code>Equal(x&#58; Value, y&#58; Value) -&gt; Bool</code><br/>
''Determines the 'Equal' relation between two values.''<br/>
;Arguments
: x&#58; Value - ''Left argument.''
: y&#58; Value - ''Right argument.''
;Example
: <code>x == y</code>
: ''Evaluates to True or False based on the value of x and y.''
----
=== Greater (&gt;) ===
<code>Greater(x&#58; Number, y&#58; Number) -&gt; Bool</code><br/>
''Determines the 'Greater' relation between two values.''<br/>
;Arguments
: x&#58; Number - ''Left argument.''
: y&#58; Number - ''Right argument.''
;Example
: <code>x > y</code>
: ''Evaluates to True or False based on the value of x and y.''
----
=== GreaterEqual (&gt;=) ===
<code>GreaterEqual(x&#58; Number, y&#58; Number) -&gt; Bool</code><br/>
''Determines the 'GreaterEqual' relation between two values.''<br/>
;Arguments
: x&#58; Number - ''Left argument.''
: y&#58; Number - ''Right argument.''
;Example
: <code>x >= y</code>
: ''Evaluates to True or False based on the value of x and y.''
----
=== Less (&lt;) ===
<code>Less(x&#58; Number, y&#58; Number) -&gt; Bool</code><br/>
''Determines the 'Less' relation between two values.''<br/>
;Arguments
: x&#58; Number - ''Left argument.''
: y&#58; Number - ''Right argument.''
;Example
: <code>x < y</code>
: ''Evaluates to True or False based on the value of x and y.''
----
=== LessEqual (&lt;=) ===
<code>LessEqual(x&#58; Number, y&#58; Number) -&gt; Bool</code><br/>
''Determines the 'LessEqual' relation between two values.''<br/>
;Arguments
: x&#58; Number - ''Left argument.''
: y&#58; Number - ''Right argument.''
;Example
: <code>x <= y</code>
: ''Evaluates to True or False based on the value of x and y.''
----
=== LogicalAnd (&) ===
<code>LogicalAnd(xs&#58; Bool+) -&gt; Bool</code><br/>
''Computes 'LogicalAnd' of the input values.''<br/>
;Arguments
: xs&#58; Bool+ - ''Arguments.''
;Example
: <code>x & y</code>
: ''Evaluates to True or False based on the values of x and y.''
----
=== LogicalNot (!) ===
<code>LogicalNot(x&#58; Bool) -&gt; Bool</code><br/>
''Computes 'LogicalNot' of the input value.''<br/>
;Arguments
: x&#58; Bool - ''Argument.''
;Example
: <code>!x</code>
: ''Evaluates to True or False based on the value of x.''
----
=== LogicalOr (|) ===
<code>LogicalOr(xs&#58; Bool+) -&gt; Bool</code><br/>
''Computes 'LogicalOr' of the input values.''<br/>
;Arguments
: xs&#58; Bool+ - ''Arguments.''
;Example
: <code>x | y</code>
: ''Evaluates to True or False based on the values of x and y.''
----
=== LogicalXor ===
<code>LogicalXor(xs&#58; Bool+) -&gt; Bool</code><br/>
''Computes 'LogicalXor' of the input values.''<br/>
;Arguments
: xs&#58; Bool+ - ''Arguments.''
;Example
: <code>LogicalXor(x, y)</code>
: ''Evaluates to True or False based on the values of x and y.''
----
=== Minus (-) ===
<code>Minus(x&#58; Number) -&gt; Number</code><br/>
''Computes the arithmetic negation of the argument.''<br/>
;Arguments
: x&#58; Number - ''Argument.''
;Example
: <code>-x</code>
: ''Arithmetic negation of x.''
----
=== NotEqual (!=) ===
<code>NotEqual(x&#58; Value, y&#58; Value) -&gt; Bool</code><br/>
''Determines the 'NotEqual' relation between two values.''<br/>
;Arguments
: x&#58; Value - ''Left argument.''
: y&#58; Value - ''Right argument.''
;Example
: <code>x != y</code>
: ''Evaluates to True or False based on the value of x and y.''
----
=== Plus (+) ===
<code>Plus(x&#58; Number, y&#58; Number) -&gt; Number</code><br/>
''Computes the 'Plus' function of the values.''<br/>
;Arguments
: x&#58; Number - ''Left argument.''
: y&#58; Number - ''Right argument.''
;Example
: <code>x + y</code>
: ''Evaluates the expression.''
----
=== Power (^) ===
<code>Power(x&#58; Number, y&#58; Number) -&gt; Number</code><br/>
''Computes the 'Power' function of the values.''<br/>
;Arguments
: x&#58; Number - ''Left argument.''
: y&#58; Number - ''Right argument.''
;Example
: <code>x ^ y</code>
: ''Evaluates the expression.''
----
=== Subtract (-) ===
<code>Subtract(x&#58; Number, y&#58; Number) -&gt; Number</code><br/>
''Computes the 'Subtract' function of the values.''<br/>
;Arguments
: x&#58; Number - ''Left argument.''
: y&#58; Number - ''Right argument.''
;Example
: <code>x - y</code>
: ''Evaluates the expression.''
----
=== Times (*) ===
<code>Times(x&#58; Number, y&#58; Number) -&gt; Number</code><br/>
''Computes the 'Times' function of the values.''<br/>
;Arguments
: x&#58; Number - ''Left argument.''
: y&#58; Number - ''Right argument.''
;Example
: <code>x * y</code>
: ''Evaluates the expression.''
<br/>
== Basic Query Functions ==
== Basic Query Functions ==
''Basic building blocks of the language - i.e. atoms, residues, and the like.''
''Basic building blocks of the language - i.e. atoms, residues, and the like.''
=== AminoAcids ===
=== AminoAcids ===
<code>AminoAcids -&gt; Residues</code><br/>
<code>AminoAcids() -&gt; Residues</code><br/>
''Sequence of all amino acids in a given protein.''<br/>
''Sequence of all residues with the 20 basic amino acid names.''<br/>
;Example
;Options
: ChargeType&#58; String = "" - ''Specify type of the charge. Allowed values: Positive, Negative, Aromatic, Polar, NonPolar.''
;Examples
: <code>AminoAcids()</code>
: <code>AminoAcids()</code>
: ''Returns all amino acids.''
:: ''All amino acids.''
: <code>AminoAcids(ChargeType = "Polar")</code>
:: ''Amino acids with polar charge.''
----
----
=== AtomIdRange ===
=== AtomIdRange ===
Line 279: Line 32:
: minId&#58; Integer - ''Minimum id.''  
: minId&#58; Integer - ''Minimum id.''  
: maxId&#58; ?Integer - ''Maximum id. If not specified, maxId = minId.''  
: maxId&#58; ?Integer - ''Maximum id. If not specified, maxId = minId.''  
;Example
;Examples
: <code>AtomIdRange(152, 161)</code>
: <code>AtomIdRange(152, 161)</code>
: ''Returns all atoms with id between 152 and 161 inclusive.''
:: ''Returns all atoms with id between 152 and 161 inclusive.''
----
=== AtomIds ===
<code>AtomIds(ids&#58; Integer+) -&gt; Atoms</code><br/>
''Sequence of atoms with specified identifiers.''<br/>
;Arguments
: ids&#58; Integer+ - ''Identifiers.''
;Examples
: <code>AtomIds(1, 2, 3)</code>
:: ''Returns atoms with ids 1, 2, 3.''
----
----
=== AtomNames ===
=== AtomNames ===
Line 288: Line 50:
;Arguments
;Arguments
: names&#58; String+ - ''Allowed names.''  
: names&#58; String+ - ''Allowed names.''  
;Example
;Examples
: <code>AtomNames("O1","NH1")</code>
: <code>AtomNames("O1","NH1")</code>
: ''Returns all atoms with names O1 or NH1.''
:: ''Returns all atoms with names O1 or NH1.''
----
----
=== Atoms ===
=== Atoms ===
<code>Atoms(symbols&#58; String*) -&gt; Atoms</code><br/>
<code>Atoms(symbols&#58; String*) -&gt; Atoms</code><br/>
''Sequence of atoms with specified element symbols. If no symbols are specified, yields all atoms one by one. A single atom can be entered using the '@' operator.''<br/>
''Sequence of atoms with specified element symbols. If no symbols are specified, yields all atoms one by one.''<br/>
;Arguments
;Arguments
: symbols&#58; String* - ''Allowed element symbols.''  
: symbols&#58; String* - ''Allowed element symbols.''  
;Example
;Examples
: <code>Atoms("Zn","Ca")</code>
: <code>Atoms("Zn","Ca")</code>
: ''Returns all atoms with element symbol Zn or Ca''
:: ''Returns all atoms with element symbol Zn or Ca''
----
=== Chains ===
<code>Chains(identifiers&#58; Value*) -&gt; PatternSeq</code><br/>
''Splits the structures into chains. If no identifiers are specified, all chains are returned.''<br/>
;Arguments
: identifiers&#58; Value* - ''Chain identifiers.''
;Examples
: <code>Chains()</code>
:: ''Returns all chains.''
: <code>Chains("")</code>
:: ''Returns chains without specific identifier.''
: <code>Chains("A", "B")</code>
:: ''Returns chains A and B.''
----
=== Helices ===
<code>Helices() -&gt; PatternSeq</code><br/>
''Returns all helices. This assumes the information about helices was present in the input structure.''<br/>
;Examples
: <code>Helices()</code>
:: ''Returns all helices.''
----
=== HetResidues ===
<code>HetResidues() -&gt; Residues</code><br/>
''Sequence of all residues that contain HET atoms.''<br/>
;Options
: NoWaters&#58; Bool = True - ''Ignore water residues such as HOH.''
;Examples
: <code>HetResidues()</code>
:: ''Returns all residues that contain HET atoms (ignores water).''
: <code>HetResidues(NoWaters=False)</code>
:: ''Returns all residues that contain HET atoms (includes water).''
----
=== ModifiedResidues ===
<code>ModifiedResidues(parentNames&#58; String*) -&gt; Residues</code><br/>
''Sequence of modified residues that originate from the specified name. If no names are specified, yields all modified residues one by one.''<br/>
;Arguments
: parentNames&#58; String* - ''Parent residue names.''
;Examples
: <code>ModifiedResidues("MET")</code>
:: ''Returns all residues modified from MET (for example MSE).''
----
----
=== Named ===
=== Named ===
<code>Named(motives&#58; Motives) -&gt; Motives</code><br/>
<code>Named(patterns&#58; PatternSeq) -&gt; PatternSeq</code><br/>
'''Names' the motive by its lowest atom id.''<br/>
'''Names' the pattern by its lowest atom id.''<br/>
;Arguments
;Arguments
: motives&#58; Motives - ''Motives to name.''  
: patterns&#58; PatternSeq - ''Patterns to name.''  
;Example
;Examples
: <code>Atoms("Zn").Named().AmbientAtoms(7)</code>
: <code>Atoms("Zn").Named().AmbientAtoms(7)</code>
: ''When exported, the result files will have names in the format '[parent id]_[pseudorandom numner]_[zn atomid]'. If the Named function was not used, the name would be just '[parent id]_[pseudorandom numner]'.''
:: ''When exported, the result files will have names in the format '[parent id]_[pseudorandom number]_[zn atomid]'. If the Named function was not used, the name would be just '[parent id]_[pseudorandom number]'.''
----
----
=== NotAminoAcids ===
=== NotAminoAcids ===
<code>NotAminoAcids -&gt; Residues</code><br/>
<code>NotAminoAcids() -&gt; Residues</code><br/>
''Sequence of all residues resudies that are not amino acids.''<br/>
''Sequence of all residues that are not any of the 20 basic amino acids.''<br/>
;Options
;Options
: NoWaters&#58; Bool = True - ''Ignore water residues such as HOH.''  
: NoWaters&#58; Bool = True - ''Ignore water residues such as HOH.''  
;Example
;Examples
: <code>NotAminoAcids()</code>
: <code>NotAminoAcids()</code>
: ''Returns all residues that are not amino acids.''
:: ''Returns all residues that are not amino acids.''
----
=== NotAtomIds ===
<code>NotAtomIds(ids&#58; Integer+) -&gt; Atoms</code><br/>
''Sequence of atoms that do not have specified identifiers.''<br/>
;Arguments
: ids&#58; Integer+ - ''Identifiers.''
;Examples
: <code>NotAtomIds(1, 2, 3)</code>
:: ''Returns atoms that do not have id 1, 2, nor 3.''
----
----
=== NotAtomNames ===
=== NotAtomNames ===
Line 324: Line 135:
;Arguments
;Arguments
: names&#58; String+ - ''Forbidden names.''  
: names&#58; String+ - ''Forbidden names.''  
;Example
;Examples
: <code>NotAtomNames("O4")</code>
: <code>NotAtomNames("O4")</code>
: ''Returns all atoms that are not called O4.''
:: ''Returns all atoms that are not called O4.''
----
----
=== NotAtoms ===
=== NotAtoms ===
Line 333: Line 144:
;Arguments
;Arguments
: symbols&#58; String+ - ''Forbidden element symbols.''  
: symbols&#58; String+ - ''Forbidden element symbols.''  
;Example
;Examples
: <code>NotAtoms("O")</code>
: <code>NotAtoms("O")</code>
: ''Returns all atoms that are not C.''
:: ''Returns all atoms that are not O.''
----
----
=== NotResidues ===
=== NotResidues ===
Line 342: Line 153:
;Arguments
;Arguments
: names&#58; Value+ - ''Forbidden residue names.''  
: names&#58; Value+ - ''Forbidden residue names.''  
;Example
;Examples
: <code>NotResidues("THR","CYS")</code>
: <code>NotResidues("THR","CYS")</code>
: ''Returns all residues that are not THR or CYS.''
:: ''Returns all residues that are not THR or CYS.''
----
----
=== RegularMotives ===
=== RegularMotifs ===
<code>RegularMotives(regex&#58; String) -&gt; Motives</code><br/>
<code>RegularMotifs(regex&#58; Value) -&gt; PatternSeq</code><br/>
''Regular motives. The protein is split into individual chains before the motives are identified.''<br/>
''Identifies regular motifs. The protein is split into individual chains and the residues are sorted by their Sequence Number before the motifs are identified. The query does not check if adjacent residues have consecutive Sequence Numbers. The query works in two modes: Amino and Nucleotide, on amino acids and nucleotides respectively. In the Amino mode, all the derivatives of standard residues are treated as the standard residues, as long as this information is properly annotated in MODRES or _pdbx_struct_mod_residue field. The default mode is 'Amino'''<br/>
;Arguments
;Arguments
: regex&#58; String - ''Regular expression on one letter abbreviations of amino acids.''  
: regex&#58; Value - ''Regular expression on one letter abbreviations of amino acids.''  
;Example
;Options
: <code>RegularMotives("RGD")</code>
: Type&#58; String = "Amino" - ''Determines the type of the query. Allowed values: Amino, Nucleotide.''
: ''Finds all RGD motives.''
;Examples
: <code>RegularMotifs("RGD")</code>
:: ''Finds all RGD motifs.''
: <code>RegularMotifs("ACGTU", Type = 'Nucleotide')</code>
:: ''Finds all consecutive occurrences of the ACGTU nucleotides.''
: <code>RegularMotifs(".HC.").Filter(lambda m: m.IsConnected())</code>
:: ''Finds all 4 residue motifs with ?-HIS-CYS-? that are connected.''
----
----
=== ResidueIdRange ===
=== ResidueIdRange ===
Line 359: Line 176:
''Sequence of residues with specific chain and min <= sequence number <= max.''<br/>
''Sequence of residues with specific chain and min <= sequence number <= max.''<br/>
;Arguments
;Arguments
: chain&#58; String - ''Chain idetifier. Case sensitive (a != A).''  
: chain&#58; String - ''Chain identifier. Case sensitive (a != A).''  
: min&#58; Integer - ''Minimum sequence number.''  
: min&#58; Integer - ''Minimum sequence number.''  
: max&#58; ?Integer - ''Maximum sequence number. If not specified, max = min.''  
: max&#58; ?Integer - ''Maximum sequence number. If not specified, max = min.''  
;Example
;Examples
: <code>ResidueIdRange("A", 161, 165)</code>
: <code>ResidueIdRange("A", 161, 165)</code>
: ''Returns all residues on chain A with seq. number between 161 and 165 inclusive.''
:: ''Returns all residues on chain A with seq. number between 161 and 165 inclusive.''
----
=== ResidueIds ===
<code>ResidueIds(ids&#58; String+) -&gt; Residues</code><br/>
''Sequence of residues with specific identifiers. If the structure does not contain a residue with the given identifier, it is skipped.''<br/>
;Arguments
: ids&#58; String+ - ''One or more identifiers in the format 'NUMBER [CHAIN] [i:INSERTIONCODE]' (parameters in [] are optional, for example '175 i:12' or '143 B'). Case sensitive (a != A).''
;Examples
: <code>ResidueIds("132 A", "178 A")</code>
:: ''Returns residues A 123 and A 178 (provided the input structure contains them).''
----
----
=== Residues ===
=== Residues ===
<code>Residues(names&#58; Value*) -&gt; Residues</code><br/>
<code>Residues(names&#58; String*) -&gt; Residues</code><br/>
''Sequence of residues with specified names. If no names are specified, yields all residues one by one. A single residue can be entered using the '#' operator.''<br/>
''Sequence of residues with specified names. If no names are specified, yields all residues one by one.''<br/>
;Arguments
;Arguments
: names&#58; Value* - ''Allowed residue names.''  
: names&#58; String* - ''Allowed residue names.''  
;Example
;Examples
: <code>Residues("HIS", "CYS")</code>
: <code>Residues("HIS", "CYS")</code>
: ''Returns all HIS or CYS residues.''
:: ''Returns all HIS or CYS residues.''
----
----
=== RingAtoms ===
=== RingAtoms ===
Line 381: Line 207:
: atom&#58; Atoms - ''Atom types.''  
: atom&#58; Atoms - ''Atom types.''  
: ring&#58; ?Rings - ''Specific ring.''  
: ring&#58; ?Rings - ''Specific ring.''  
;Example
;Examples
: <code>OnRing(Atoms("C"), Rings(4 * ["C"] + ["O"]))</code>
: <code>RingAtoms(Atoms("C"), Rings(4 * ["C"] + ["O"]))</code>
: ''Returns all C atoms on a ring with 4C and O.''
:: ''Returns all C atoms on a ring with 4C and O.''
----
----
=== Rings ===
=== Rings ===
<code>Rings(atoms&#58; Value*) -&gt; Rings</code><br/>
<code>Rings(atoms&#58; Value*) -&gt; Rings</code><br/>
''Sequence of rings with particular atoms. If no atoms are specified, yields all rings (cycles) one by one.''<br/>
''Sequence of rings with particular atoms. If no atoms are specified, yields all rings (cycles) one by one. The order of atoms matters.''<br/>
;Arguments
;Arguments
: atoms&#58; Value* - ''Ring atoms.''  
: atoms&#58; Value* - ''Ring atoms.''  
;Example
;Examples
: <code>Rings()</code>
:: ''Returns all rings.''
: <code>Rings(5 * ["C"] + ["O"])</code>
: <code>Rings(5 * ["C"] + ["O"])</code>
: ''Returns all rings with 5C and 1O atoms.''
:: ''Returns all rings with 5C and 1O atoms.''
: <code>Rings(["C", "C", "N", "C", "N"])</code>
:: ''Returns all rings with C-C-N-C-N atoms.''
: <code>Or(Rings(["C", "C", "N", "C", "N"]), Rings(["C", "C", "C", "N", "N"]))</code>
:: ''Returns all rings with C-C-N-C-N or C-C-C-N-N atoms.''
----
=== Sheets ===
<code>Sheets() -&gt; PatternSeq</code><br/>
''Returns all sheets. This assumes the information about sheets was present in the input structure.''<br/>
;Examples
: <code>Sheets()</code>
:: ''Returns all sheets.''
<br/>
<br/>
== Advanced Query Functions ==
== Advanced Query Functions ==
''Advanced building blocks of the language - i.e. filters and unions.''
''Advanced building blocks of the language.''
=== Count ===
=== Flatten ===
<code>Count(where&#58; Motive, what&#58; Motives) -&gt; Integer</code><br/>
<code>Flatten(patterns&#58; PatternSeq, selector&#58; Pattern->PatternSeq) -&gt; PatternSeq</code><br/>
''Counts all occurences of motive 'what' in motive 'where'.''<br/>
''Converts a sequence of sequence of patterns into a single 'flat' sequence.''<br/>
;Arguments
: patterns&#58; PatternSeq - ''Patterns to project.''
: selector&#58; Pattern->PatternSeq - ''The selector.''
;Examples
: <code>Residues("HIS").Flatten(lambda m: m.Find(Atoms("C")))</code>
:: ''Returns all C atoms on HIS residues.''
----
=== Inside ===
<code>Inside(patterns&#58; PatternSeq, where&#58; PatternSeq) -&gt; PatternSeq</code><br/>
''Finds patterns within another pattern. Equivalent to where.Flatten(lambda m: m.Find(patterns))''<br/>
;Arguments
: patterns&#58; PatternSeq - ''Patterns to find.''
: where&#58; PatternSeq - ''Where to find them.''
;Examples
: <code>Atoms("C").Inside(Residues("HIS"))</code>
:: ''Returns all C atoms on HIS residues.''
----
=== Or ===
<code>Or(patterns&#58; PatternSeq+) -&gt; PatternSeq</code><br/>
''Merges several pattern sequences into one.''<br/>
;Arguments
;Arguments
: where&#58; Motive - ''Where to count it.''
: patterns&#58; PatternSeq+ - ''Patterns to merge.''  
: what&#58; Motives - ''What motive to count.''  
;Examples
;Example
: <code>Or(Atoms("Zn").ConnectedResidues(1), Rings())</code>
: <code>m.Count(Residues("HIS"))</code>
:: ''Finds all zincs and their connected residues or rings.''
: ''Returns the count of HIS residues in the motive m.''
----
----
=== Current ===
=== ToAtoms ===
<code>Current -&gt; Motive</code><br/>
<code>ToAtoms(patterns&#58; PatternSeq) -&gt; PatternSeq</code><br/>
''A variable that is assigned by the application environment.''<br/>
''Collects all 'inner' patterns and yields all unique atoms one by one.''<br/>
;Example
;Arguments
: <code>AtomSimilarity(Current(), Motive("model"))</code>
: patterns&#58; PatternSeq - ''Patterns to split.''
: ''Returns the atom similarity of the current motive and the model.''
;Examples
: <code>Residues("HIS").ToAtoms()</code>
:: ''Returns all atoms on HIS residues one by one.''
----
----
=== Filter ===
=== ToResidues ===
<code>Filter(motives&#58; Motives, filter&#58; Motive->Bool) -&gt; Motives</code><br/>
<code>ToResidues(patterns&#58; PatternSeq) -&gt; PatternSeq</code><br/>
''Filters a sequence of motives with a given predicate.''<br/>
''Collects all 'inner' patterns and yields all unique residues one by one. The residues contain only the atoms that have been yielded by the inner query.''<br/>
;Arguments
;Arguments
: motives&#58; Motives - ''Motives to filter.''
: patterns&#58; PatternSeq - ''Patterns to split.''  
: filter&#58; Motive->Bool - ''Filter predicate.''  
;Examples
;Example
: <code>Atoms("C").ToResidues()</code>
: <code>Residues().Filter(lambda m: m.Count(Atoms("C")) >= 3)</code>
:: ''Returns all C atoms grouped by residues.''
: ''Returns all residues that contain at least 3 C atoms.''
----
----
=== Find ===
=== Union ===
<code>Find(source&#58; Motive, motives&#58; Motives) -&gt; Motives</code><br/>
<code>Union(patterns&#58; PatternSeq) -&gt; PatternSeq</code><br/>
''Converts the source motive to a structure and finds motives within it.''<br/>
''Collects all 'inner' patterns and yields one created from their unique atoms.''<br/>
;Arguments
: patterns&#58; PatternSeq - ''Patterns to merge.''
;Examples
: <code>Rings().Union()</code>
:: ''Creates a single pattern that contains all rings.''
<br/>
== Filter Functions ==
''Functions useful for filtering patterns.''
=== Contains ===
<code>Contains(where&#58; Pattern, what&#58; PatternSeq) -&gt; Bool</code><br/>
''Checks if a pattern is contained within another one. Equivalent to where.Count(what) > 0.''<br/>
;Arguments
;Arguments
: source&#58; Motive - ''Where to look.''  
: where&#58; Pattern - ''Where to look.''  
: motives&#58; Motives - ''Motives to find.''  
: what&#58; PatternSeq - ''What to find.''  
;Example
;Examples
: <code>AtomSimilarity(Current().Find(NotAtoms("N")).ToMotive(), Motive("model").Find(NotAtoms("N")).ToMotive())</code>
: <code>HetResidues().Filter(lambda m: m.Contains(Rings(5*['C']+['O'])).Not())</code>
: ''Computes the atom similarity of the 'current' and 'model' motives, but ignores N atoms.''
:: ''Returns all HET residues that do not contain a 5CO ring.''
----
----
=== Inside ===
=== Count ===
<code>Inside(motives&#58; Motives, where&#58; Motives) -&gt; Motives</code><br/>
<code>Count(where&#58; Pattern, what&#58; PatternSeq) -&gt; Integer</code><br/>
''Finds motives within another motive. Equivalent to where.SelectMany(lambda m: m.Find(motives))''<br/>
''Counts all occurrences of pattern 'what' in pattern 'where'.''<br/>
;Arguments
;Arguments
: motives&#58; Motives - ''Motives to find.''  
: where&#58; Pattern - ''Where to count it.''  
: where&#58; Motives - ''Where to find them.''  
: what&#58; PatternSeq - ''What pattern to count.''  
;Example
;Examples
: <code>Atoms("C").Inside(Residues("HIS"))</code>
: <code>m.Count(Residues("HIS"))</code>
: ''Returns all C atoms on HIS residues.''
:: ''Returns the count of HIS residues in the pattern m. Where m is a Pattern (for example when using the Filter function or returned by the ToPattern() function). This example will not work directly and is here to illustrate a concept.''
: <code>Atoms("Zn").ConnectedResidues(1).Filter(lambda m: m.Count(Residues("HIS")) == 2)</code>
:: ''Patterns with Zn atoms and its connected residues with exactly 2 HIS residues.''
----
----
=== Motive ===
=== ExecuteIf ===
<code>Motive(structureName&#58; String) -&gt; Motive</code><br/>
<code>ExecuteIf(query&#58; PatternSeq, condition&#58; Pattern->Bool) -&gt; PatternSeq</code><br/>
''Returns a structure represented a motive.''<br/>
''Executes a query only if the condition is met. Otherwise, return an empty sequence of patterns.''<br/>
;Arguments
;Arguments
: structureName&#58; String - ''Name of a structure.''  
: query&#58; PatternSeq - ''Query to execute.''
;Example
: condition&#58; Pattern->Bool - ''Condition that must be satisfied for the parent structure/pattern.''  
: <code>Motive("1tqn_12")</code>
;Examples
: ''Returns the structure '1tqn_12' represented as a motive.''
: <code>Residues().ExecuteIf(lambda p: p.Resolution() <= 2.4)</code>
:: ''Returns residues in structures that have resolution lower than 2.4ang.''
: <code>AminoAcids().ExecuteIf(lambda p: p.Count(Atoms('Fe')) > 3)</code>
:: ''Returns all amino acids in structures that have at least 3 Fe atoms.''
----
----
=== Or ===
=== Filter ===
<code>Or(motives&#58; Motives+) -&gt; Motives</code><br/>
<code>Filter(patterns&#58; PatternSeq, filter&#58; Pattern->Bool) -&gt; PatternSeq</code><br/>
''Merges several motive sequences into one.''<br/>
''Filters a sequence of patterns with a given predicate.''<br/>
;Arguments
;Arguments
: motives&#58; Motives+ - ''Motives to merge.''  
: patterns&#58; PatternSeq - ''Patterns to filter.''
;Example
: filter&#58; Pattern->Bool - ''Filter predicate.''  
: <code>Or(Atoms("Zn").ConnectedResidues(1), Rings())</code>
;Examples
: ''Finds all zincs and their connected residues or rings.''
: <code>Residues().Filter(lambda m: m.Count(Atoms("C")) >= 3)</code>
:: ''Returns all residues that contain at least 3 C atoms.''
----
----
=== SelectMany ===
=== IsConnected ===
<code>SelectMany(motives&#58; Motives, selector&#58; Motive->Motives) -&gt; Motives</code><br/>
<code>IsConnected(pattern&#58; Pattern) -&gt; Bool</code><br/>
''Projects a sequence of motives to another.''<br/>
''Checks if a particular pattern is a connected graph.''<br/>
;Arguments
;Arguments
: motives&#58; Motives - ''Motives to project.''
: pattern&#58; Pattern - ''A pattern to test.''  
: selector&#58; Motive->Motives - ''The selector.''  
;Examples
;Example
: <code>Atoms("Zn").AmbientResidues(3).Filter(lambda m: m.IsConnected())</code>
: <code>Residues("HIS").SelectMany(lambda m: m.Find(Atoms("C")))</code>
:: ''Finds all patterns with a Zn and residues within 3 ang, where all the ambient residues are connected to the central atom.''
: ''Returns all C atoms on HIS residues.''
----
----
=== ToAtoms ===
=== IsConnectedTo ===
<code>ToAtoms(motives&#58; Motives) -&gt; Motives</code><br/>
<code>IsConnectedTo(where&#58; Pattern, patterns&#58; PatternSeq) -&gt; Bool</code><br/>
''Collects all 'inner' motives and yields all unique atoms one by one.''<br/>
''Checks if a particular pattern is connected to any other specified pattern. The patterns must have empty intersection for this function to return true.''<br/>
;Arguments
;Arguments
: motives&#58; Motives - ''Motives to split.''  
: where&#58; Pattern - ''A pattern to test.''
;Example
: patterns&#58; PatternSeq - ''Pattern sequence to test against.''  
: <code>Residues("HIS").ToAtoms()</code>
;Examples
: ''Returns all atoms on HIS residues one by one.''
: <code>Atoms().Filter(lambda a: a.IsConnectedTo(Rings()))</code>
:: ''Finds all atoms that are connected to a ring they do not belong to.''
----
----
=== ToMotive ===
=== IsNotConnectedTo ===
<code>ToMotive(motives&#58; Motives) -&gt; Motive</code><br/>
<code>IsNotConnectedTo(what&#58; Pattern, patterns&#58; PatternSeq) -&gt; Bool</code><br/>
''Collects all 'inner' motives and yields them as a single motive.''<br/>
''Checks if a particular pattern is not connected to any other specified pattern. The patterns must have empty intersection for this function to return true.''<br/>
;Arguments
;Arguments
: motives&#58; Motives - ''Motives to convert.''  
: what&#58; Pattern - ''A pattern to test.''
;Example
: patterns&#58; PatternSeq - ''Pattern sequence to test against.''  
: <code>ToMotive(Residues("HIS"))</code>
;Examples
: ''Returns a single motive that contains all HIS residues.''
: <code>Residues().Filter(lambda r: r.IsNotConnectedTo(Atoms("Ca")))</code>
:: ''Finds all residues that are not connected to Ca atoms. The residue itself can still contain Ca atoms.''
----
----
=== ToResidues ===
=== NearestDistanceTo ===
<code>ToResidues(motives&#58; Motives) -&gt; Motives</code><br/>
<code>NearestDistanceTo(where&#58; Pattern, patterns&#58; PatternSeq) -&gt; Real</code><br/>
''Collects all 'inner' motives and yields all unique residues one by one. The residues contain only the atoms that have been yielded by the inner query.''<br/>
''Finds the distance to a particular pattern.''<br/>
;Arguments
;Arguments
: motives&#58; Motives - ''Motives to split.''  
: where&#58; Pattern - ''A pattern to test.''
;Example
: patterns&#58; PatternSeq - ''Pattern sequence to test against.''  
: <code>ToResidues(Atoms("C"))</code>
;Examples
: ''Returns all C atoms grouped by residues.''
: <code>Atoms().Filter(lambda m: m.NearestDistanceTo(Residues("ASP")) >= 5)</code>
:: ''Finds all atoms that are at least 5 (angstroms) away from any ASP residue.''
----
----
=== Union ===
=== SeqCount ===
<code>Union(motives&#58; Motives) -&gt; Motives</code><br/>
<code>SeqCount(what&#58; PatternSeq) -&gt; Integer</code><br/>
''Collects all 'inner' motives and yields one created from their unique atoms.''<br/>
''Counts the length of a sequence of motifs.''<br/>
;Arguments
;Arguments
: motives&#58; Motives - ''Motives to merge.''  
: what&#58; PatternSeq - ''What pattern sequence to count.''  
;Example
;Examples
: <code>Rings().Union()</code>
: <code>Atoms("Zn").AmbientResidues(3).Filter(lambda m: m.Find(Residues("HIS")).SeqCount() > 1)</code>
: ''Creates a single motive that contains all rings.''
:: ''Returns a sequence of patterns with Zn atom and residues within 3ang if the pattern contains at least 2 HIS residues.''
<br/>
<br/>
== Topology Functions ==
== Topology Functions ==
''Functions that manipulate the topology of motives.''
''Functions that rely on the topology of patterns.''
=== ConnectedAtoms ===
=== ConnectedAtoms ===
<code>ConnectedAtoms(motive&#58; Motives, n&#58; Integer) -&gt; Motives</code><br/>
<code>ConnectedAtoms(pattern&#58; PatternSeq, n&#58; Integer) -&gt; PatternSeq</code><br/>
''Surrounds the inner motive by n layers of atoms.''<br/>
''Surrounds the inner pattern by n layers of atoms.''<br/>
;Arguments
;Arguments
: motive&#58; Motives - ''Basic motive.''  
: pattern&#58; PatternSeq - ''Basic pattern.''  
: n&#58; Integer - ''Number of atom layers to connect.''  
: n&#58; Integer - ''Number of atom layers to connect.''  
;Options
;Options
: YieldNamedDuplicates&#58; Bool = False - ''Yield duplicate motifs if they have a different name.''  
: YieldNamedDuplicates&#58; Bool = False - ''Yield duplicate patterns if they have a different name.''  
;Example
;Examples
: <code>Residues("MAN").ConnectedAtoms(2)</code>
: <code>Residues("MAN").ConnectedAtoms(2)</code>
: ''Finds all MAN residues and then adds two connected levels of atoms to them.''
:: ''Finds all MAN residues and then adds two connected levels of atoms to them.''
----
----
=== ConnectedResidues ===
=== ConnectedResidues ===
<code>ConnectedResidues(motive&#58; Motives, n&#58; Integer) -&gt; Motives</code><br/>
<code>ConnectedResidues(pattern&#58; PatternSeq, n&#58; Integer) -&gt; PatternSeq</code><br/>
''Surrounds the inner motive by n layers of residues.''<br/>
''Surrounds the inner pattern by n layers of residues.''<br/>
;Arguments
;Arguments
: motive&#58; Motives - ''Basic motive.''  
: pattern&#58; PatternSeq - ''Basic pattern.''  
: n&#58; Integer - ''Number of residue layers to connect.''  
: n&#58; Integer - ''Number of residue layers to connect.''  
;Options
;Options
: YieldNamedDuplicates&#58; Bool = False - ''Yield duplicate motifs if they have a different name.''  
: YieldNamedDuplicates&#58; Bool = False - ''Yield duplicate patterns if they have a different name.''  
;Example
;Examples
: <code>Atoms("Zn").ConnectedResidues(1))</code>
: <code>Atoms("Zn").ConnectedResidues(1)</code>
: ''Finds all Zn atoms and adds all residues that are connected to them.''
:: ''Finds all Zn atoms and adds all residues that are connected to them.''
----
----
=== IsConnectedTo ===
=== Path ===
<code>IsConnectedTo(current&#58; Motive, motive&#58; Motives) -&gt; Bool</code><br/>
<code>Path(patterns&#58; PatternSeq+) -&gt; PatternSeq</code><br/>
''Checks if a particular motive is connected to any other specified motive. The motives must have empty intersection for this function to return true.''<br/>
''Creates a new pattern from 'connected' parts.''<br/>
;Arguments
;Arguments
: current&#58; Motive - ''A motive to test.''  
: patterns&#58; PatternSeq+ - ''Patterns to path.''  
: motive&#58; Motives - ''Motive sequence to test against.''
;Examples
;Example
: <code>Path(Atoms("O"), Atoms("C"), Atoms("O"))</code>
: <code>Atoms().Filter(lambda a: a.IsConnectedTo(Rings()))</code>
:: ''Finds patterns with two O and one C atoms where the C atoms is connected to the O ones.''
: ''Finds all atoms that are connected to a ring they do not belong to.''
----
----
=== IsNotConnectedTo ===
=== Star ===
<code>IsNotConnectedTo(current&#58; Motive, motive&#58; Motives) -&gt; Bool</code><br/>
<code>Star(center&#58; PatternSeq, patterns&#58; PatternSeq+) -&gt; PatternSeq</code><br/>
''Checks if a particular motive is not connected to any other specified motive. The motives must have empty intersection for this function to return true.''<br/>
''Creates a new pattern from a central one and connected parts.''<br/>
;Arguments
;Arguments
: current&#58; Motive - ''A motive to test.''  
: center&#58; PatternSeq - ''Center pattern.''  
: motive&#58; Motives - ''Motive sequence to test against.''  
: patterns&#58; PatternSeq+ - ''Patterns to chain.''  
;Example
;Examples
: <code>Residues().Filter(lambda r: r.IsNotConnectedTo(Atoms("Ca")))</code>
: <code>Star(Atoms("C"), Atoms("O"), Atoms("O"))</code>
: ''Finds all residues that are not connected to Ca atoms. The residue itself can still contain Ca atoms.''
:: ''Finds patterns with two O atoms and one C atom in the center.''
: <code>Atoms("C").Star(Atoms("O"), Atoms("O"))</code>
:: ''Finds patterns with two O atoms and one C atom in the center.''
<br/>
<br/>
== Geometry Functions ==
== Geometry Functions ==
''Functions that manipulate the geometry of motives.''
''Functions that rely on the geometry of patterns.''
=== AmbientAtoms ===
=== AmbientAtoms ===
<code>AmbientAtoms(motive&#58; Motives, r&#58; Number) -&gt; Motives</code><br/>
<code>AmbientAtoms(pattern&#58; PatternSeq, r&#58; Number) -&gt; PatternSeq</code><br/>
''Surrounds the inner motive by atoms that within the given radius from the inner motive.''<br/>
''Surrounds the inner pattern by atoms that within the given radius from the inner pattern.''<br/>
;Arguments
;Arguments
: motive&#58; Motives - ''Basic motive.''  
: pattern&#58; PatternSeq - ''Basic pattern.''  
: r&#58; Number - ''Radius.''  
: r&#58; Number - ''Radius.''  
;Options
;Options
: ExcludeBase&#58; Bool = False - ''Exclude the central original motif.''  
: ExcludeBase&#58; Bool = False - ''Exclude the central original pattern.''  
: NoWaters&#58; Bool = True - ''Ignore water residues such as HOH.''  
: NoWaters&#58; Bool = True - ''Ignore water residues such as HOH.''  
: YieldNamedDuplicates&#58; Bool = False - ''Yield duplicate motifs if they have a different name.''  
: YieldNamedDuplicates&#58; Bool = False - ''Yield duplicate patterns if they have a different name.''  
;Example
;Examples
: <code>Atoms("Fe").AmbientAtoms(4)</code>
: <code>Atoms("Fe").AmbientAtoms(4)</code>
: ''Finds Fe atoms and all atoms within 4 (angstroms) from each of them.''
:: ''Finds Fe atoms and all atoms within 4 (angstroms) from each of them.''
----
----
=== AmbientResidues ===
=== AmbientResidues ===
<code>AmbientResidues(motive&#58; Motives, r&#58; Number) -&gt; Motives</code><br/>
<code>AmbientResidues(pattern&#58; PatternSeq, r&#58; Number) -&gt; PatternSeq</code><br/>
''Surrounds the inner motive by residues that have at least one atom within the given radius from the inner motive.''<br/>
''Surrounds the inner pattern by residues that have at least one atom within the given radius from the inner pattern.''<br/>
;Arguments
;Arguments
: motive&#58; Motives - ''Basic motive.''  
: pattern&#58; PatternSeq - ''Basic pattern.''  
: r&#58; Number - ''Radius.''  
: r&#58; Number - ''Radius.''  
;Options
;Options
: ExcludeBase&#58; Bool = False - ''Exclude the central original motif.''  
: ExcludeBase&#58; Bool = False - ''Exclude the central original pattern.''  
: NoWaters&#58; Bool = True - ''Ignore water residues such as HOH.''  
: NoWaters&#58; Bool = True - ''Ignore water residues such as HOH.''  
: YieldNamedDuplicates&#58; Bool = False - ''Yield duplicate motifs if they have a different name.''  
: YieldNamedDuplicates&#58; Bool = False - ''Yield duplicate patterns if they have a different name.''  
;Example
;Examples
: <code>Rings(6 * ["C"]).AmbientResidues(4)</code>
: <code>Rings(6 * ["C"]).AmbientResidues(4)</code>
: ''Finds rings with 6C atoms and all residues within 4 (angstroms) from each of them.''
:: ''Finds rings with 6C atoms and all residues within 4 (angstroms) from each of them.''
----
----
=== Cluster ===
=== Cluster ===
<code>Cluster(r&#58; Number, motives&#58; Motives+) -&gt; Motives</code><br/>
<code>Cluster(r&#58; Number, patterns&#58; PatternSeq+) -&gt; PatternSeq</code><br/>
''Clusters all motives that are pairwise closer than r (angstroms).''<br/>
''Clusters all patterns that are pairwise closer than r (angstroms).''<br/>
;Arguments
;Arguments
: r&#58; Number - ''Maximum distance between two motives in the cluster.''  
: r&#58; Number - ''Maximum distance between two patterns in the cluster.''  
: motives&#58; Motives+ - ''Motives to cluster.''  
: patterns&#58; PatternSeq+ - ''Patterns to cluster.''  
;Example
;Examples
: <code>Cluster(4, Atoms("Ca"), Rings(5 * ["C"] + ["O"]))</code>
: <code>Cluster(4, Atoms("Ca"), Rings(5 * ["C"] + ["O"]))</code>
: ''Finds all instance of one or more rings with 5C and O atoms and one or more Ca atoms that are closer than 4 (angstroms).''
:: ''Finds all instance of one or more rings with 5C and O atoms and one or more Ca atoms that are closer than 4 (angstroms).''
----
----
=== Filled ===
=== Filled ===
<code>Filled(motive&#58; Motives) -&gt; Motives</code><br/>
<code>Filled(pattern&#58; PatternSeq) -&gt; PatternSeq</code><br/>
''Adds all atoms that fall within the circumsphere (with radius multiplied by the factor) of the basic motive.''<br/>
''Adds all atoms that fall within the circumsphere (with radius multiplied by the factor) of the basic pattern.''<br/>
;Arguments
;Arguments
: motive&#58; Motives - ''Basic motive.''  
: pattern&#58; PatternSeq - ''Basic pattern.''  
;Options
;Options
: NoWaters&#58; Bool = True - ''Ignore water residues such as HOH.''  
: NoWaters&#58; Bool = True - ''Ignore water residues such as HOH.''  
: RadiusFactor&#58; Number = 0.75 - ''Circumsphere radius factor.''  
: RadiusFactor&#58; Number = 0.75 - ''Circumsphere radius factor.''  
;Example
;Examples
: <code>Cluster(4, Residues("HIS")).Filled(RadiusFactor = 0.75)</code>
: <code>Cluster(4, Residues("HIS")).Filled(RadiusFactor = 0.75)</code>
: ''Finds clusters of HIS residues and all atoms within the circumsphere.''
:: ''Finds clusters of HIS residues and all atoms within the circumsphere.''
----
----
=== Near ===
=== Near ===
<code>Near(r&#58; Number, motives&#58; Motives+) -&gt; Motives</code><br/>
<code>Near(r&#58; Number, patterns&#58; PatternSeq+) -&gt; PatternSeq</code><br/>
''Clusters all motives that are pairwise closer than r (angstroms) and checks if the "counts" match.''<br/>
''Clusters all patterns that are pairwise closer than r (angstroms) and checks if the "counts" match.''<br/>
;Arguments
;Arguments
: r&#58; Number - ''Maximum distance between two sub-motives in the motive.''  
: r&#58; Number - ''Maximum distance between two sub-patterns in the pattern.''  
: motives&#58; Motives+ - ''Motives to 'cluster'.''  
: patterns&#58; PatternSeq+ - ''Patterns to 'cluster'.''  
;Example
;Examples
: <code>Near(4, Many(2, Atoms("Ca")), Rings(5 * ["C"] + ["O"]))</code>
: <code>Near(4, Atoms("Ca"), Atoms("Ca"), Rings(5 * ["C"] + ["O"]))</code>
: ''Finds all instance of a single ring with 5C and O atoms and two Ca atoms that are closer than 4 (angstroms).''
:: ''Finds all instance of a single ring with 5C and O atoms and two Ca atoms that are closer than 4 (angstroms).''
----
----
=== NearestDistanceTo ===
=== Spherify ===
<code>NearestDistanceTo(current&#58; Motive, motive&#58; Motives) -&gt; Real</code><br/>
<code>Spherify(pattern: PatternSeq, r: Number) -> PatternSeq</code><br/>
''Finds the distance to a particular motive.''<br/>
''Identifies the geometrical center of the base pattern and then includes all atoms within the specified radius.''
;Arguments
: pattern&#58; PatternSeq - ''Basic pattern.''
: r&#58; Number - ''Radius.''
;Options
: ExcludeBase&#58; Bool = False - ''Exclude the central original pattern.''
: NoWaters&#58; Bool = True - ''Ignore water residues such as HOH.''
: YieldNamedDuplicates&#58; Bool = False - ''Yield duplicate patterns if they have a different name.''
;Examples
<code>Rings(6 * ["C"]).Spherify(5)</code><br/>
''Finds benzene moiety, computes centroid of each pattern, and includes all atoms within 5 angstroms from it.
<br/>
 
== Meta-data Functions ==
''Functions dealing with meta-data about structures such as release date or authors.''
=== Authors ===
<code>Authors(pattern&#58; Pattern) -&gt; String</code><br/>
''Returns authors of the parent structure separated by a semicolon. If the value is not available, null is returned.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
----
=== ECNumbers ===
<code>ECNumbers(pattern&#58; Pattern) -&gt; String</code><br/>
''Returns Enzymatic Commission numbers assigned to enzymes in the parent structure separated by a semicolon. If the value is not available, null is returned.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
----
=== EntitySources ===
<code>EntitySources(pattern&#58; Pattern) -&gt; String</code><br/>
''Returns entity sources of the parent structure separated by a semicolon. If the value is not available, null is returned.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
----
=== ExperimentMethod ===
<code>ExperimentMethod(pattern&#58; Pattern) -&gt; String</code><br/>
''Get the experiment method. The value is always an upper-case string. If the value is not available, null is returned.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
;Examples
: <code>Residues().ExecuteIf(lambda p: p.ExperimentMethod() == "INFRARED SPECTROSCOPY")</code>
:: ''Returns residues in structures that satisfy the property.''
----
=== HasAllAuthors ===
<code>HasAllAuthors(pattern&#58; Pattern, properties&#58; String+) -&gt; Bool</code><br/>
''Determines if the parent structure contains all given authors. The comparison is case sensitive.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
: properties&#58; String+ - ''Properties.''
;Examples
: <code>Residues().ExecuteIf(lambda p: p.HasAllAuthors("Holmes", "Watson"))</code>
:: ''Returns residues in structures that contain all given properties.''
----
=== HasAllECNumbers ===
<code>HasAllECNumbers(pattern&#58; Pattern, properties&#58; String+) -&gt; Bool</code><br/>
''Determines if the parent structure contains all given Enzymatic Commission numbers. It is possible to enter just a number prefix without the '.'. The comparison is not case sensitive.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
: properties&#58; String+ - ''Properties.''
;Examples
: <code>Residues().ExecuteIf(lambda p: p.HasAllECNumbers("3.2.1.18", "3.3"))</code>
:: ''Returns residues in structures that contain all given properties.''
----
=== HasAllEntitySources ===
<code>HasAllEntitySources(pattern&#58; Pattern, properties&#58; String+) -&gt; Bool</code><br/>
''Determines if the parent structure contains all given entity sources. The comparison is not case sensitive.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
: properties&#58; String+ - ''Properties.''
;Examples
: <code>Residues().ExecuteIf(lambda p: p.HasAllEntitySources("GMO", "Natural", "Synthetic"))</code>
:: ''Returns residues in structures that contain all given properties.''
----
=== HasAllHostOrganismGenus ===
<code>HasAllHostOrganismGenus(pattern&#58; Pattern, properties&#58; String+) -&gt; Bool</code><br/>
''Determines if the parent structure contains all given host organism identifiers. The comparison is not case sensitive.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
: properties&#58; String+ - ''Properties.''
;Examples
: <code>Residues().ExecuteIf(lambda p: p.HasAllHostOrganismGenus("X", "Y"))</code>
:: ''Returns residues in structures that contain all given properties.''
----
=== HasAllHostOrganismIds ===
<code>HasAllHostOrganismIds(pattern&#58; Pattern, properties&#58; String+) -&gt; Bool</code><br/>
''Determines if the parent structure contains all given host organism identifiers. The comparison is not case sensitive.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
: properties&#58; String+ - ''Properties.''
;Examples
: <code>Residues().ExecuteIf(lambda p: p.HasAllHostOrganismIds("7108", "11244"))</code>
:: ''Returns residues in structures that contain all given properties.''
----
=== HasAllHostOrganisms ===
<code>HasAllHostOrganisms(pattern&#58; Pattern, properties&#58; String+) -&gt; Bool</code><br/>
''Determines if the parent structure contains all given host organism names. The comparison is not case sensitive.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
: properties&#58; String+ - ''Properties.''
;Examples
: <code>Residues().ExecuteIf(lambda p: p.HasAllHostOrganisms("Spodoptera frugiperda", "Mus musculus"))</code>
:: ''Returns residues in structures that contain all given properties.''
----
=== HasAllKeywords ===
<code>HasAllKeywords(pattern&#58; Pattern, properties&#58; String+) -&gt; Bool</code><br/>
''Determines if the parent structure contains all given keywords. The comparison is not case sensitive.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
: properties&#58; String+ - ''Properties.''
;Examples
: <code>Residues().ExecuteIf(lambda p: p.HasAllKeywords("membrane", "glycoprotein"))</code>
:: ''Returns residues in structures that contain all given properties.''
----
=== HasAllOriginOrganismGenus ===
<code>HasAllOriginOrganismGenus(pattern&#58; Pattern, properties&#58; String+) -&gt; Bool</code><br/>
''Determines if the parent structure contains all given origin organism identifiers. The comparison is not case sensitive.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
: properties&#58; String+ - ''Properties.''
;Examples
: <code>Residues().ExecuteIf(lambda p: p.HasAllOriginOrganismGenus("X", "Y"))</code>
:: ''Returns residues in structures that contain all given properties.''
----
=== HasAllOriginOrganismIds ===
<code>HasAllOriginOrganismIds(pattern&#58; Pattern, properties&#58; String+) -&gt; Bool</code><br/>
''Determines if the parent structure contains all given origin organism identifiers. The comparison is not case sensitive.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
: properties&#58; String+ - ''Properties.''
;Examples
: <code>Residues().ExecuteIf(lambda p: p.HasAllOriginOrganismIds("121791", "10090"))</code>
:: ''Returns residues in structures that contain all given properties.''
----
=== HasAllOriginOrganisms ===
<code>HasAllOriginOrganisms(pattern&#58; Pattern, properties&#58; String+) -&gt; Bool</code><br/>
''Determines if the parent structure contains all given origin organism names. The comparison is not case sensitive.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
: properties&#58; String+ - ''Properties.''
;Examples
: <code>Residues().ExecuteIf(lambda p: p.HasAllOriginOrganisms("Nipah virus", "Mus musculus"))</code>
:: ''Returns residues in structures that contain all given properties.''
----
=== HasAnyAuthor ===
<code>HasAnyAuthor(pattern&#58; Pattern, properties&#58; String+) -&gt; Bool</code><br/>
''Determines if the parent structure contains any of the given authors. The comparison is case sensitive.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
: properties&#58; String+ - ''Properties.''
;Examples
: <code>Residues().ExecuteIf(lambda p: p.HasAnyAuthor("Holmes", "Watson"))</code>
:: ''Returns residues in structures that contain all given properties.''
----
=== HasAnyECNumber ===
<code>HasAnyECNumber(pattern&#58; Pattern, properties&#58; String+) -&gt; Bool</code><br/>
''Determines if the parent structure contains any of the given Enzymatic Commission number. It is possible to enter just a number prefix without the '.'s. The comparison is not case sensitive.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
: properties&#58; String+ - ''Properties.''
;Examples
: <code>Residues().ExecuteIf(lambda p: p.HasAnyECNumber("3.2.1.19", "3.3"))</code>
:: ''Returns residues in structures that contain all given properties.''
----
=== HasAnyEntitySources ===
<code>HasAnyEntitySources(pattern&#58; Pattern, properties&#58; String+) -&gt; Bool</code><br/>
''Determines if the parent structure contains any of the given entity sources. The comparison is not case sensitive.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
: properties&#58; String+ - ''Properties.''
;Examples
: <code>Residues().ExecuteIf(lambda p: p.HasAnyEntitySources("GMO", "Natural", "Synthetic"))</code>
:: ''Returns residues in structures that contain all given properties.''
----
=== HasAnyHostOrganism ===
<code>HasAnyHostOrganism(pattern&#58; Pattern, properties&#58; String+) -&gt; Bool</code><br/>
''Determines if the parent structure contains any of the given host organism names. The comparison is not case sensitive.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
: properties&#58; String+ - ''Properties.''
;Examples
: <code>Residues().ExecuteIf(lambda p: p.HasAnyHostOrganism("Spodoptera frugiperda", "Mus musculus"))</code>
:: ''Returns residues in structures that contain all given properties.''
----
=== HasAnyHostOrganismGenus ===
<code>HasAnyHostOrganismGenus(pattern&#58; Pattern, properties&#58; String+) -&gt; Bool</code><br/>
''Determines if the parent structure contains any of the given host organism identifierss. The comparison is not case sensitive.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
: properties&#58; String+ - ''Properties.''
;Examples
: <code>Residues().ExecuteIf(lambda p: p.HasAnyHostOrganismGenus("X", "Y"))</code>
:: ''Returns residues in structures that contain all given properties.''
----
=== HasAnyHostOrganismId ===
<code>HasAnyHostOrganismId(pattern&#58; Pattern, properties&#58; String+) -&gt; Bool</code><br/>
''Determines if the parent structure contains any of the given host organism identifierss. The comparison is not case sensitive.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
: properties&#58; String+ - ''Properties.''
;Examples
: <code>Residues().ExecuteIf(lambda p: p.HasAnyHostOrganismId("7108", "11244"))</code>
:: ''Returns residues in structures that contain all given properties.''
----
=== HasAnyKeyword ===
<code>HasAnyKeyword(pattern&#58; Pattern, properties&#58; String+) -&gt; Bool</code><br/>
''Determines if the parent structure contains any of the given keywords. The comparison is not case sensitive.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
: properties&#58; String+ - ''Properties.''
;Examples
: <code>Residues().ExecuteIf(lambda p: p.HasAnyKeyword("membrane", "glycoprotein"))</code>
:: ''Returns residues in structures that contain all given properties.''
----
=== HasAnyOriginOrganism ===
<code>HasAnyOriginOrganism(pattern&#58; Pattern, properties&#58; String+) -&gt; Bool</code><br/>
''Determines if the parent structure contains any of the given origin organism names. The comparison is not case sensitive.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
: properties&#58; String+ - ''Properties.''
;Examples
: <code>Residues().ExecuteIf(lambda p: p.HasAnyOriginOrganism("Nipah virus", "Mus musculus"))</code>
:: ''Returns residues in structures that contain all given properties.''
----
=== HasAnyOriginOrganismGenus ===
<code>HasAnyOriginOrganismGenus(pattern&#58; Pattern, properties&#58; String+) -&gt; Bool</code><br/>
''Determines if the parent structure contains any of the given origin organism identifierss. The comparison is not case sensitive.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
: properties&#58; String+ - ''Properties.''
;Examples
: <code>Residues().ExecuteIf(lambda p: p.HasAnyOriginOrganismGenus("X", "Y"))</code>
:: ''Returns residues in structures that contain all given properties.''
----
=== HasAnyOriginOrganismId ===
<code>HasAnyOriginOrganismId(pattern&#58; Pattern, properties&#58; String+) -&gt; Bool</code><br/>
''Determines if the parent structure contains any of the given origin organism identifierss. The comparison is not case sensitive.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
: properties&#58; String+ - ''Properties.''
;Examples
: <code>Residues().ExecuteIf(lambda p: p.HasAnyOriginOrganismId("121791", "10090"))</code>
:: ''Returns residues in structures that contain all given properties.''
----
=== HostOrganismGenus ===
<code>HostOrganismGenus(pattern&#58; Pattern) -&gt; String</code><br/>
''Returns host organism identifiers of the parent structure separated by a semicolon. If the value is not available, null is returned.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
----
=== HostOrganismIds ===
<code>HostOrganismIds(pattern&#58; Pattern) -&gt; String</code><br/>
''Returns host organism identifiers of the parent structure separated by a semicolon. If the value is not available, null is returned.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
----
=== HostOrganisms ===
<code>HostOrganisms(pattern&#58; Pattern) -&gt; String</code><br/>
''Returns host organism names of the parent structure separated by a semicolon. If the value is not available, null is returned.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
----
=== Keywords ===
<code>Keywords(pattern&#58; Pattern) -&gt; String</code><br/>
''Returns keywords of the parent structure separated by a semicolon. If the value is not available, null is returned.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
----
=== LatestRevisionDate ===
<code>LatestRevisionDate(pattern&#58; Pattern) -&gt; Value</code><br/>
''Get the latest revision date of the parent structure. The value has to be compared to the DateTime(year, month, day) object. If the value is not available, null is returned.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
;Examples
: <code>Residues().ExecuteIf(lambda p: p.LatestRevisionDate() >= DateTime(2008, 1, 1))</code>
:: ''Returns residues in structures that satisfy the property.''
----
=== LatestRevisionYear ===
<code>LatestRevisionYear(pattern&#58; Pattern) -&gt; Integer</code><br/>
''Get the latest revision year of the parent structure. If the value is not available, null is returned.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
;Examples
: <code>Residues().ExecuteIf(lambda p: p.LatestRevisionYear() == 2006)</code>
:: ''Returns residues in structures that satisfy the property.''
----
=== OriginOrganismGenus ===
<code>OriginOrganismGenus(pattern&#58; Pattern) -&gt; String</code><br/>
''Returns origin organism identifiers of the parent structure separated by a semicolon. If the value is not available, null is returned.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
----
=== OriginOrganismIds ===
<code>OriginOrganismIds(pattern&#58; Pattern) -&gt; String</code><br/>
''Returns origin organism identifiers of the parent structure separated by a semicolon. If the value is not available, null is returned.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
----
=== OriginOrganisms ===
<code>OriginOrganisms(pattern&#58; Pattern) -&gt; String</code><br/>
''Returns origin organism names of the parent structure separated by a semicolon. If the value is not available, null is returned.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
----
=== PolymerType ===
<code>PolymerType(pattern&#58; Pattern) -&gt; String</code><br/>
''Get the polymer type of the structure. Possible values are: NotAssigned, Protein, DNA, RNA, ProteinDNA, ProteinRNA, NucleicAcids, Mixture, Sugar, Other. If the value is not available, null is returned.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
;Examples
: <code>Residues().ExecuteIf(lambda p: p.PolymerType() == "ProteinDNA")</code>
:: ''Returns residues in structures that satisfy the property.''
----
=== ProteinStoichiometry ===
<code>ProteinStoichiometry(pattern&#58; Pattern) -&gt; String</code><br/>
''Get the protein stoichiometry of the parent structure. Possible values are: NotAssigned, Monomer, Homomer, Heteromer. If the value is not available, null is returned.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
;Examples
: <code>Residues().ExecuteIf(lambda p: p.ProteinStoichiometry() == "Heteromer")</code>
:: ''Returns residues in structures that satisfy the property.''
----
=== ProteinStoichiometryString ===
<code>ProteinStoichiometryString(pattern&#58; Pattern) -&gt; String</code><br/>
''Get the protein stoichiometry string of the parent structure. If the value is not available, null is returned.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
----
=== ReleaseDate ===
<code>ReleaseDate(pattern&#58; Pattern) -&gt; Value</code><br/>
''Get the release date of the parent structure. The value has to be compared to the DateTime(year, month, day) object. If the value is not available, null is returned.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
;Examples
: <code>Residues().ExecuteIf(lambda p: p.ReleaseDate() >= DateTime(2008, 1, 1))</code>
:: ''Returns residues in structures that satisfy the property.''
----
=== ReleaseYear ===
<code>ReleaseYear(pattern&#58; Pattern) -&gt; Integer</code><br/>
''Get the release year of the parent structure. If the value is not available, null is returned.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
;Examples
: <code>Residues().ExecuteIf(lambda p: p.ReleaseYear() == 2006)</code>
:: ''Returns residues in structures that satisfy the property.''
----
=== Resolution ===
<code>Resolution(pattern&#58; Pattern) -&gt; Real</code><br/>
''Get the resolution in angstroms of the parent structure. If the value is not available, null is returned.''<br/>
;Arguments
: pattern&#58; Pattern - ''Pattern.''
;Examples
: <code>Residues().ExecuteIf(lambda p: p.Resolution() <= 2.4)</code>
:: ''Returns residues in structures that satisfy the property.''
----
=== Weight ===
<code>Weight(pattern&#58; Pattern) -&gt; Real</code><br/>
''Get the weight of the molecule in kDa. If the value is not available, null is returned.''<br/>
;Arguments
;Arguments
: current&#58; Motive - ''A motive to test.''
: pattern&#58; Pattern - ''Pattern.''  
: motive&#58; Motives - ''Motive sequence to test against.''  
;Examples
;Example
: <code>Residues().ExecuteIf(lambda p: p.Weight() > 100000.0)</code>
: <code>Atoms().Filter(lambda m: m.NearestDistanceTo(Residues("ASP")) >= 5)</code>
:: ''Returns residues in structures that satisfy the property.''
: ''Finds all atoms that are at least 5 (angstroms) away from any ASP residue.''
<br/>
<br/>
== Miscellaneous Functions ==
== Miscellaneous Functions ==
''Various useful functions.''
''Various useful functions. These function often require a special setup (i.e. only useful in Scripting window or in specific applications).''
=== AminoSequenceString ===
<code>AminoSequenceString(pattern&#58; Pattern) -&gt; String</code><br/>
''Returns a string of single-letter amino acids contained in the pattern.''<br/>
<small>''Note:'' This function cannot be used directly to query patterns from MotiveExplorer or Queries service.</small><br/>
;Arguments
: pattern&#58; Pattern - ''Pattern to convert.''
;Examples
: <code>Pattern("1tqn_12").AminoSequenceString()</code>
:: ''Returns a string representing amino acids in the pattern '1tqn_12'.''
: <code>RegularMotifs(Pattern("1tqn_12").AminoSequenceString())</code>
:: ''Returns all regular patterns that correspond to the AMK sequence in 1tqn_12.''
----
=== AtomProperty ===
=== AtomProperty ===
<code>AtomProperty(atomMotive&#58; Motive, name&#58; String) -&gt; ?</code><br/>
<code>AtomProperty(atomPattern&#58; Pattern, name&#58; String) -&gt; ?</code><br/>
''If the property exists and the motive consits of a single atom, returns the property. Otherwise, returns Nothing.''<br/>
''If the property exists and the pattern consists of a single atom, returns the property. Otherwise, returns Nothing.''<br/>
<small>''Note:'' This function cannot be used directly to query patterns from MotiveExplorer or Queries service.</small><br/>
;Arguments
;Arguments
: atomMotive&#58; Motive - ''Single atom motive.''  
: atomPattern&#58; Pattern - ''Single atom pattern.''  
: name&#58; String - ''Property name.''  
: name&#58; String - ''Property name.''  
;Example
;Examples
: <code>a.Property("my_charges")</code>
: <code>a.AtomProperty("charge")</code>
: ''Gets the 'my_charges' property of the atom a.''
:: ''Gets the 'charge' property of the atom a. Where a is a single atom Pattern. This example will not work directly.''
: <code>Atoms().Filter(lambda a: a.AtomProperty("charge") >= 2)</code>
:: ''All atoms with the charge property greater or equal to 2. This example will only work in cases where a suitable property is defined. For example in Scripting window in the Charges app.''
----
----
=== AtomSimilarity ===
=== AtomSimilarity ===
<code>AtomSimilarity(a&#58; Motive, b&#58; Motive) -&gt; Real</code><br/>
<code>AtomSimilarity(a&#58; Pattern, b&#58; Pattern) -&gt; Real</code><br/>
''Computes Jaccard/Tanimoto coefficient on atoms (element symbols) of both structures.''<br/>
''Computes Jaccard/Tanimoto coefficient on atoms (element symbols) of both structures.''<br/>
<small>''Note:'' This function cannot be used directly to query patterns from MotiveExplorer or Queries service.</small><br/>
;Arguments
: a&#58; Pattern - ''First pattern.''
: b&#58; Pattern - ''Second pattern.''
;Examples
: <code>AtomSimilarity(Current(),Pattern("1tqn_12"))</code>
:: ''Computes the atom similarity between the current pattern and 1tqn_12. This example can be used in SiteBinder to create a descriptor (assuming a structure with id '1tqn_12' is loaded).''
----
=== CommonAtoms ===
<code>CommonAtoms(modelId&#58; String) -&gt; PatternSeq</code><br/>
''Returns a single pattern with atoms common with the model. Properties checked: atom id, element symbol, chain, residue number. This query is useful for example for atom selection in SiteBinder.''<br/>
<small>''Note:'' This function cannot be used directly to query patterns from MotiveExplorer or Queries service.</small><br/>
;Arguments
;Arguments
: a&#58; Motive - ''First motive.''  
: modelId&#58; String - ''Id of the model.''  
: b&#58; Motive - ''Second motive.''  
;Examples
;Example
: <code>CommonAtoms("1tqn_12")</code>
: <code>AtomSimilarity(m,Motive("1tqn_12"))</code>
:: ''Returns a pattern formed by atoms common with the '1tqn_12' structure.''
: ''Computes the atom similarity between motives m and 1tqn_12.''
----
=== CSA ===
<code>CSA() -&gt; PatternSeq</code><br/>
''Entries from Catalytic Site Atlas represented as patterns. Works only if used from the command line version of Queries and property configured.''<br/>
<small>''Note:'' This function cannot be used directly to query patterns from MotiveExplorer or Queries service.</small><br/>
;Examples
: <code>CSA()</code>
:: ''All CSA sites for the given structure. This example will only work if used from the command line version of Queries and property configured.''
----
=== Current ===
<code>Current() -&gt; Pattern</code><br/>
''A variable that is assigned by the application environment.''<br/>
<small>''Note:'' This function cannot be used directly to query patterns from MotiveExplorer or Queries service.</small><br/>
;Examples
: <code>AtomSimilarity(Current(), Pattern("model"))</code>
:: ''Returns the atom similarity of the current pattern and the model. This example will work for example when defining a structure descriptor in SiteBinder and there is a structure with id 'model' loaded.''
----
----
=== Descriptor ===
=== Descriptor ===
<code>Descriptor(motive&#58; Motive, name&#58; String) -&gt; ?</code><br/>
<code>Descriptor(pattern&#58; Pattern, name&#58; String) -&gt; ?</code><br/>
''Returns the descriptor. If the descriptor does not exist, 'null' is returned.''<br/>
''Returns the descriptor. If the descriptor does not exist, 'null' is returned.''<br/>
<small>''Note:'' This function cannot be used directly to query patterns from MotiveExplorer or Queries service.</small><br/>
;Arguments
;Arguments
: motive&#58; Motive - ''Motive that represents entire structure.''  
: pattern&#58; Pattern - ''Pattern that represents entire structure.''  
: name&#58; String - ''Descriptor name.''  
: name&#58; String - ''Descriptor name.''  
;Example
;Examples
: <code>Current().Descriptor("similarity")</code>
: <code>Current().Descriptor("similarity") >= 0.75</code>
: ''Returns the 'similarity' descriptor of the current motive.''
:: ''Returns True if 'similarity' descriptor of the current pattern is at least 0.75. This example will work for example in SiteBinder's structure selection if the 'similarity' descriptor has been previously defined.''
----
=== DynamicInvoke ===
<code>DynamicInvoke(value&#58; Value, name&#58; String, isProperty&#58; Bool, args&#58; Value) -&gt; Value</code><br/>
''Dynamically invoke a member. (internal)''<br/>
<small>''Note:'' This function cannot be used directly to query patterns from MotiveExplorer or Queries service.</small><br/>
;Arguments
: value&#58; Value - ''InnerQuery.''
: name&#58; String - ''Member name.''
: isProperty&#58; Bool - ''Is this a property.''
: args&#58; Value - ''Array of arguments.''
----
=== Find ===
<code>Find(source&#58; Pattern, patterns&#58; PatternSeq) -&gt; PatternSeq</code><br/>
''Converts the source pattern to a structure and finds patterns within it.''<br/>
<small>''Note:'' This function cannot be used directly to query patterns from MotiveExplorer or Queries service.</small><br/>
;Arguments
: source&#58; Pattern - ''Where to look.''
: patterns&#58; PatternSeq - ''Patterns to find.''
;Examples
: <code>AtomSimilarity(Current().Find(NotAtoms("N")).ToPattern(), Pattern("model").Find(NotAtoms("N")).ToPattern())</code>
:: ''Computes the atom similarity of the 'current' and 'model' patterns, but ignores N atoms. This example can be used in SiteBinder to create a descriptor (assuming a structure with id 'model' is loaded).''
----
=== GroupedAtoms ===
<code>GroupedAtoms(symbols&#58; String*) -&gt; PatternSeq</code><br/>
''Groups atoms using the element symbol and then returns each group as a single pattern.''<br/>
<small>''Note:'' This function cannot be used directly to query patterns from MotiveExplorer or Queries service.</small><br/>
;Arguments
: symbols&#58; String* - ''Allowed element symbols.''
;Examples
: <code>GroupedAtoms()</code>
:: ''Returns groups of all atom types. For example if the input has atoms 5xC-1xO, patterns with 5xC and 1xO atoms are returned.''
: <code>GroupedAtoms('C', 'O')</code>
:: ''Returns groups of all atom types. For example if the input has atoms 5xC-1xO-6xH, patterns with 5xC and 1xO atoms are returned (but the H atoms are ignored).''
----
=== Pattern ===
<code>Pattern(structureName&#58; String) -&gt; Pattern</code><br/>
''Returns a structure represented as a pattern.''<br/>
<small>''Note:'' This function cannot be used directly to query patterns from MotiveExplorer or Queries service.</small><br/>
;Arguments
: structureName&#58; String - ''Name of a structure.''
;Examples
: <code>Pattern("1tqn_12")</code>
:: ''Returns the structure '1tqn_12' represented as a pattern. Usable in defining descriptors or in Scripting window (using MQ.Execute).''
----
----
=== ResidueSimilarity ===
=== ResidueSimilarity ===
<code>ResidueSimilarity(a&#58; Motive, b&#58; Motive) -&gt; Real</code><br/>
<code>ResidueSimilarity(a&#58; Pattern, b&#58; Pattern) -&gt; Real</code><br/>
''Computes Jaccard/Tanimoto coefficient on residue names of both structures.''<br/>
''Computes Jaccard/Tanimoto coefficient on residue names of both structures.''<br/>
<small>''Note:'' This function cannot be used directly to query patterns from MotiveExplorer or Queries service.</small><br/>
;Arguments
: a&#58; Pattern - ''First pattern.''
: b&#58; Pattern - ''Second pattern.''
;Examples
: <code>ResidueSimilarity(Current(), Pattern("1tqn_12"))</code>
:: ''Computes the residue similarity between the current pattern and '1tqn_12'. This example can be used in SiteBinder to create a descriptor (assuming a structure with id '1tqn_12' is loaded).''
----
=== ToPattern ===
<code>ToPattern(patterns&#58; PatternSeq) -&gt; Pattern</code><br/>
''Converts a sequence of Patterns (AtomSetSeq) to a single Pattern by merging all atoms into a single atom set. The Pattern type is required by some function such as AtomSimilarity.''<br/>
<small>''Note:'' This function cannot be used directly to query patterns from MotiveExplorer or Queries service.</small><br/>
;Arguments
: patterns&#58; PatternSeq - ''Patterns to convert.''
;Examples
: <code>Residues("HIS").ToPattern()</code>
:: ''Converts a sequence of HIS residue Patterns to a single Pattern.''
: <code>AtomSimilarity(Current().Find(NotAtoms("N")).ToPattern(), Pattern("model").Find(NotAtoms("N")).ToPattern())</code>
:: ''Computes the atom similarity of the 'current' and 'model' patterns, but ignores N atoms.''
<br/>
== Value Functions ==
''Functions such as addition or comparison of numbers.''
=== Abs ===
<code>Abs(x&#58; Number) -&gt; Number</code><br/>
''Computes the 'Abs' function of the argument.''<br/>
;Arguments
: x&#58; Number - ''Argument.''
;Examples
: <code>Abs(x)</code>
:: ''Evaluates the expression.''
----
=== Divide (/) ===
<code>Divide(x&#58; Number, y&#58; Number) -&gt; Number</code><br/>
''Computes the 'Divide' function of the values.''<br/>
;Arguments
: x&#58; Number - ''Left argument.''
: y&#58; Number - ''Right argument.''
;Examples
: <code>x / y</code>
:: ''Evaluates the expression.''
----
=== Equal (==) ===
<code>Equal(x&#58; Value, y&#58; Value) -&gt; Bool</code><br/>
''Determines the 'Equal' relation between two values.''<br/>
;Arguments
: x&#58; Value - ''Left argument.''
: y&#58; Value - ''Right argument.''
;Examples
: <code>x == y</code>
:: ''Evaluates to True or False based on the value of x and y.''
----
=== Greater (&gt;) ===
<code>Greater(x&#58; Number, y&#58; Number) -&gt; Bool</code><br/>
''Determines the 'Greater' relation between two values.''<br/>
;Arguments
: x&#58; Number - ''Left argument.''
: y&#58; Number - ''Right argument.''
;Examples
: <code>x > y</code>
:: ''Evaluates to True or False based on the value of x and y.''
----
=== GreaterEqual (&gt;=) ===
<code>GreaterEqual(x&#58; Number, y&#58; Number) -&gt; Bool</code><br/>
''Determines the 'GreaterEqual' relation between two values.''<br/>
;Arguments
: x&#58; Number - ''Left argument.''
: y&#58; Number - ''Right argument.''
;Examples
: <code>x >= y</code>
:: ''Evaluates to True or False based on the value of x and y.''
----
=== Less (&lt;) ===
<code>Less(x&#58; Number, y&#58; Number) -&gt; Bool</code><br/>
''Determines the 'Less' relation between two values.''<br/>
;Arguments
: x&#58; Number - ''Left argument.''
: y&#58; Number - ''Right argument.''
;Examples
: <code>x < y</code>
:: ''Evaluates to True or False based on the value of x and y.''
----
=== LessEqual (&lt;=) ===
<code>LessEqual(x&#58; Number, y&#58; Number) -&gt; Bool</code><br/>
''Determines the 'LessEqual' relation between two values.''<br/>
;Arguments
: x&#58; Number - ''Left argument.''
: y&#58; Number - ''Right argument.''
;Examples
: <code>x <= y</code>
:: ''Evaluates to True or False based on the value of x and y.''
----
=== LogicalAnd (&) ===
<code>LogicalAnd(xs&#58; Bool+) -&gt; Bool</code><br/>
''Computes 'LogicalAnd' of the input values.''<br/>
;Arguments
: xs&#58; Bool+ - ''Arguments.''
;Examples
: <code>x & y</code>
:: ''Evaluates to True or False based on the values of x and y.''
----
=== LogicalNot (Not) ===
<code>LogicalNot(x&#58; Bool) -&gt; Bool</code><br/>
''Computes 'LogicalNot' of the input value. This function can be called using the shorthand 'Not'.''<br/>
;Arguments
: x&#58; Bool - ''Argument.''
;Examples
: <code>LogicalNot(x)</code>
:: ''Evaluates to True or False based on the value of x.''
: <code>x.Not()</code>
:: ''Evaluates to True or False based on the value of x.''
----
=== LogicalOr (|) ===
<code>LogicalOr(xs&#58; Bool+) -&gt; Bool</code><br/>
''Computes 'LogicalOr' of the input values.''<br/>
;Arguments
: xs&#58; Bool+ - ''Arguments.''
;Examples
: <code>x | y</code>
:: ''Evaluates to True or False based on the values of x and y.''
----
=== LogicalXor (Xor) ===
<code>LogicalXor(xs&#58; Bool+) -&gt; Bool</code><br/>
''Computes 'LogicalXor' of the input values. This function can be called using the shorthand 'Xor'.''<br/>
;Arguments
: xs&#58; Bool+ - ''Arguments.''
;Examples
: <code>LogicalXor(x, y)</code>
:: ''Evaluates to True or False based on the values of x and y.''
: <code>Xor(x, y)</code>
:: ''Evaluates to True or False based on the values of x and y.''
----
=== Minus (-) ===
<code>Minus(x&#58; Number) -&gt; Number</code><br/>
''Computes the arithmetic negation of the argument.''<br/>
;Arguments
: x&#58; Number - ''Argument.''
;Examples
: <code>-x</code>
:: ''Arithmetic negation of x.''
----
=== NotEqual (!=) ===
<code>NotEqual(x&#58; Value, y&#58; Value) -&gt; Bool</code><br/>
''Determines the 'NotEqual' relation between two values.''<br/>
;Arguments
: x&#58; Value - ''Left argument.''
: y&#58; Value - ''Right argument.''
;Examples
: <code>x != y</code>
:: ''Evaluates to True or False based on the value of x and y.''
----
=== Plus (+) ===
<code>Plus(x&#58; Number, y&#58; Number) -&gt; Number</code><br/>
''Computes the 'Plus' function of the values.''<br/>
;Arguments
;Arguments
: a&#58; Motive - ''First motive.''  
: x&#58; Number - ''Left argument.''  
: b&#58; Motive - ''Second motive.''  
: y&#58; Number - ''Right argument.''  
;Example
;Examples
: <code>ResidueSimilarity(m, Motive("1tqn_12"))</code>
: <code>x + y</code>
: ''Computes the residue similarity between motives m and 1tqn_12.''
:: ''Evaluates the expression.''
----
=== Power (^) ===
<code>Power(x&#58; Number, y&#58; Number) -&gt; Number</code><br/>
''Computes the 'Power' function of the values.''<br/>
;Arguments
: x&#58; Number - ''Left argument.''
: y&#58; Number - ''Right argument.''
;Examples
: <code>x ^ y</code>
:: ''Evaluates the expression.''
----
=== Subtract (-) ===
<code>Subtract(x&#58; Number, y&#58; Number) -&gt; Number</code><br/>
''Computes the 'Subtract' function of the values.''<br/>
;Arguments
: x&#58; Number - ''Left argument.''
: y&#58; Number - ''Right argument.''
;Examples
: <code>x - y</code>
:: ''Evaluates the expression.''
----
=== Times (*) ===
<code>Times(x&#58; Number, y&#58; Number) -&gt; Number</code><br/>
''Computes the 'Times' function of the values.''<br/>
;Arguments
: x&#58; Number - ''Left argument.''
: y&#58; Number - ''Right argument.''
;Examples
: <code>x * y</code>
:: ''Evaluates the expression.''
<br/>
<br/>

Latest revision as of 12:38, 11 July 2016

Introduction

[edit]

PatternQuery (PQ) is a user friendly chemical language primarily designed for defining atom patterns in molecules. PQ combines the clarity and brevity of programming languages with the versatility of natural language, aiming for an efficient inclusion of chemical and biochemical knowledge into the definition of patterns. PQ allows definitions based on chemical connectivity and three-dimensional structure at the same time. Additionally, in the case of molecules based on residue chains (such as proteins, nucleic acids, saccharides, etc.), PQ allows the user to include any amount of information regarding the residue level structure directly into the definition of the patternss.

PatternQuery is a subset of the Python programming language. Therefore, if you have experience with it, it should not be a problem to use PQ as well.

  • The language is case sensitive - "filter" is NOT the same as "FiLtEr".

Some of the functions return PatternSeq while other return Pattern.

  • Pattern is a set of atoms.
  • PatternSeq is a sequence of Pattern (the sets of atoms).

When a molecule is queried, say using the expression Rings(5 * ["C"] + ["O"]) a sequences of patterns each containing 6 atoms (5 C and 1 O) is returned. However, some functions such as Filter need to operate on a single pattern (the set of atoms) - not the whole sequences. The query Residues().Filter(lambda r: r.Count(Atoms()) > 10) first finds all residue patterns (PatternSeq) and then passes every single Pattern (set of atoms) to a function that counts the atoms in the pattern and returns True if there is at least 11 of them. This is the reasoning behind these two types.

Basic Query Functions

[edit]

Basic building blocks of the language - i.e. atoms, residues, and the like.

AminoAcids

[edit]

AminoAcids() -> Residues
Sequence of all residues with the 20 basic amino acid names.

Options
ChargeType: String = "" - Specify type of the charge. Allowed values: Positive, Negative, Aromatic, Polar, NonPolar.
Examples
AminoAcids()
All amino acids.
AminoAcids(ChargeType = "Polar")
Amino acids with polar charge.

AtomIdRange

[edit]

AtomIdRange(minId: Integer, maxId: ?Integer) -> Atoms
Sequence of atoms with minId <= atomId <= maxId.

Arguments
minId: Integer - Minimum id.
maxId: ?Integer - Maximum id. If not specified, maxId = minId.
Examples
AtomIdRange(152, 161)
Returns all atoms with id between 152 and 161 inclusive.

AtomIds

[edit]

AtomIds(ids: Integer+) -> Atoms
Sequence of atoms with specified identifiers.

Arguments
ids: Integer+ - Identifiers.
Examples
AtomIds(1, 2, 3)
Returns atoms with ids 1, 2, 3.

AtomNames

[edit]

AtomNames(names: String+) -> Atoms
Sequence of atoms with specified names.

Arguments
names: String+ - Allowed names.
Examples
AtomNames("O1","NH1")
Returns all atoms with names O1 or NH1.

Atoms

[edit]

Atoms(symbols: String*) -> Atoms
Sequence of atoms with specified element symbols. If no symbols are specified, yields all atoms one by one.

Arguments
symbols: String* - Allowed element symbols.
Examples
Atoms("Zn","Ca")
Returns all atoms with element symbol Zn or Ca

Chains

[edit]

Chains(identifiers: Value*) -> PatternSeq
Splits the structures into chains. If no identifiers are specified, all chains are returned.

Arguments
identifiers: Value* - Chain identifiers.
Examples
Chains()
Returns all chains.
Chains("")
Returns chains without specific identifier.
Chains("A", "B")
Returns chains A and B.

Helices

[edit]

Helices() -> PatternSeq
Returns all helices. This assumes the information about helices was present in the input structure.

Examples
Helices()
Returns all helices.

HetResidues

[edit]

HetResidues() -> Residues
Sequence of all residues that contain HET atoms.

Options
NoWaters: Bool = True - Ignore water residues such as HOH.
Examples
HetResidues()
Returns all residues that contain HET atoms (ignores water).
HetResidues(NoWaters=False)
Returns all residues that contain HET atoms (includes water).

ModifiedResidues

[edit]

ModifiedResidues(parentNames: String*) -> Residues
Sequence of modified residues that originate from the specified name. If no names are specified, yields all modified residues one by one.

Arguments
parentNames: String* - Parent residue names.
Examples
ModifiedResidues("MET")
Returns all residues modified from MET (for example MSE).

Named

[edit]

Named(patterns: PatternSeq) -> PatternSeq
'Names' the pattern by its lowest atom id.

Arguments
patterns: PatternSeq - Patterns to name.
Examples
Atoms("Zn").Named().AmbientAtoms(7)
When exported, the result files will have names in the format '[parent id]_[pseudorandom number]_[zn atomid]'. If the Named function was not used, the name would be just '[parent id]_[pseudorandom number]'.

NotAminoAcids

[edit]

NotAminoAcids() -> Residues
Sequence of all residues that are not any of the 20 basic amino acids.

Options
NoWaters: Bool = True - Ignore water residues such as HOH.
Examples
NotAminoAcids()
Returns all residues that are not amino acids.

NotAtomIds

[edit]

NotAtomIds(ids: Integer+) -> Atoms
Sequence of atoms that do not have specified identifiers.

Arguments
ids: Integer+ - Identifiers.
Examples
NotAtomIds(1, 2, 3)
Returns atoms that do not have id 1, 2, nor 3.

NotAtomNames

[edit]

NotAtomNames(names: String+) -> Atoms
Sequence of atoms that do not have a specified name.

Arguments
names: String+ - Forbidden names.
Examples
NotAtomNames("O4")
Returns all atoms that are not called O4.

NotAtoms

[edit]

NotAtoms(symbols: String+) -> Atoms
Sequence of atoms that are not particular elements.

Arguments
symbols: String+ - Forbidden element symbols.
Examples
NotAtoms("O")
Returns all atoms that are not O.

NotResidues

[edit]

NotResidues(names: Value+) -> Residues
Sequence of residues that are not called by the specified names.

Arguments
names: Value+ - Forbidden residue names.
Examples
NotResidues("THR","CYS")
Returns all residues that are not THR or CYS.

RegularMotifs

[edit]

RegularMotifs(regex: Value) -> PatternSeq
Identifies regular motifs. The protein is split into individual chains and the residues are sorted by their Sequence Number before the motifs are identified. The query does not check if adjacent residues have consecutive Sequence Numbers. The query works in two modes: Amino and Nucleotide, on amino acids and nucleotides respectively. In the Amino mode, all the derivatives of standard residues are treated as the standard residues, as long as this information is properly annotated in MODRES or _pdbx_struct_mod_residue field. The default mode is 'Amino'

Arguments
regex: Value - Regular expression on one letter abbreviations of amino acids.
Options
Type: String = "Amino" - Determines the type of the query. Allowed values: Amino, Nucleotide.
Examples
RegularMotifs("RGD")
Finds all RGD motifs.
RegularMotifs("ACGTU", Type = 'Nucleotide')
Finds all consecutive occurrences of the ACGTU nucleotides.
RegularMotifs(".HC.").Filter(lambda m: m.IsConnected())
Finds all 4 residue motifs with ?-HIS-CYS-? that are connected.

ResidueIdRange

[edit]

ResidueIdRange(chain: String, min: Integer, max: ?Integer) -> Residues
Sequence of residues with specific chain and min <= sequence number <= max.

Arguments
chain: String - Chain identifier. Case sensitive (a != A).
min: Integer - Minimum sequence number.
max: ?Integer - Maximum sequence number. If not specified, max = min.
Examples
ResidueIdRange("A", 161, 165)
Returns all residues on chain A with seq. number between 161 and 165 inclusive.

ResidueIds

[edit]

ResidueIds(ids: String+) -> Residues
Sequence of residues with specific identifiers. If the structure does not contain a residue with the given identifier, it is skipped.

Arguments
ids: String+ - One or more identifiers in the format 'NUMBER [CHAIN] [i:INSERTIONCODE]' (parameters in [] are optional, for example '175 i:12' or '143 B'). Case sensitive (a != A).
Examples
ResidueIds("132 A", "178 A")
Returns residues A 123 and A 178 (provided the input structure contains them).

Residues

[edit]

Residues(names: String*) -> Residues
Sequence of residues with specified names. If no names are specified, yields all residues one by one.

Arguments
names: String* - Allowed residue names.
Examples
Residues("HIS", "CYS")
Returns all HIS or CYS residues.

RingAtoms

[edit]

RingAtoms(atom: Atoms, ring: ?Rings) -> Atoms
Returns all rings atoms.

Arguments
atom: Atoms - Atom types.
ring: ?Rings - Specific ring.
Examples
RingAtoms(Atoms("C"), Rings(4 * ["C"] + ["O"]))
Returns all C atoms on a ring with 4C and O.

Rings

[edit]

Rings(atoms: Value*) -> Rings
Sequence of rings with particular atoms. If no atoms are specified, yields all rings (cycles) one by one. The order of atoms matters.

Arguments
atoms: Value* - Ring atoms.
Examples
Rings()
Returns all rings.
Rings(5 * ["C"] + ["O"])
Returns all rings with 5C and 1O atoms.
Rings(["C", "C", "N", "C", "N"])
Returns all rings with C-C-N-C-N atoms.
Or(Rings(["C", "C", "N", "C", "N"]), Rings(["C", "C", "C", "N", "N"]))
Returns all rings with C-C-N-C-N or C-C-C-N-N atoms.

Sheets

[edit]

Sheets() -> PatternSeq
Returns all sheets. This assumes the information about sheets was present in the input structure.

Examples
Sheets()
Returns all sheets.


Advanced Query Functions

[edit]

Advanced building blocks of the language.

Flatten

[edit]

Flatten(patterns: PatternSeq, selector: Pattern->PatternSeq) -> PatternSeq
Converts a sequence of sequence of patterns into a single 'flat' sequence.

Arguments
patterns: PatternSeq - Patterns to project.
selector: Pattern->PatternSeq - The selector.
Examples
Residues("HIS").Flatten(lambda m: m.Find(Atoms("C")))
Returns all C atoms on HIS residues.

Inside

[edit]

Inside(patterns: PatternSeq, where: PatternSeq) -> PatternSeq
Finds patterns within another pattern. Equivalent to where.Flatten(lambda m: m.Find(patterns))

Arguments
patterns: PatternSeq - Patterns to find.
where: PatternSeq - Where to find them.
Examples
Atoms("C").Inside(Residues("HIS"))
Returns all C atoms on HIS residues.

Or

[edit]

Or(patterns: PatternSeq+) -> PatternSeq
Merges several pattern sequences into one.

Arguments
patterns: PatternSeq+ - Patterns to merge.
Examples
Or(Atoms("Zn").ConnectedResidues(1), Rings())
Finds all zincs and their connected residues or rings.

ToAtoms

[edit]

ToAtoms(patterns: PatternSeq) -> PatternSeq
Collects all 'inner' patterns and yields all unique atoms one by one.

Arguments
patterns: PatternSeq - Patterns to split.
Examples
Residues("HIS").ToAtoms()
Returns all atoms on HIS residues one by one.

ToResidues

[edit]

ToResidues(patterns: PatternSeq) -> PatternSeq
Collects all 'inner' patterns and yields all unique residues one by one. The residues contain only the atoms that have been yielded by the inner query.

Arguments
patterns: PatternSeq - Patterns to split.
Examples
Atoms("C").ToResidues()
Returns all C atoms grouped by residues.

Union

[edit]

Union(patterns: PatternSeq) -> PatternSeq
Collects all 'inner' patterns and yields one created from their unique atoms.

Arguments
patterns: PatternSeq - Patterns to merge.
Examples
Rings().Union()
Creates a single pattern that contains all rings.


Filter Functions

[edit]

Functions useful for filtering patterns.

Contains

[edit]

Contains(where: Pattern, what: PatternSeq) -> Bool
Checks if a pattern is contained within another one. Equivalent to where.Count(what) > 0.

Arguments
where: Pattern - Where to look.
what: PatternSeq - What to find.
Examples
HetResidues().Filter(lambda m: m.Contains(Rings(5*['C']+['O'])).Not())
Returns all HET residues that do not contain a 5CO ring.

Count

[edit]

Count(where: Pattern, what: PatternSeq) -> Integer
Counts all occurrences of pattern 'what' in pattern 'where'.

Arguments
where: Pattern - Where to count it.
what: PatternSeq - What pattern to count.
Examples
m.Count(Residues("HIS"))
Returns the count of HIS residues in the pattern m. Where m is a Pattern (for example when using the Filter function or returned by the ToPattern() function). This example will not work directly and is here to illustrate a concept.
Atoms("Zn").ConnectedResidues(1).Filter(lambda m: m.Count(Residues("HIS")) == 2)
Patterns with Zn atoms and its connected residues with exactly 2 HIS residues.

ExecuteIf

[edit]

ExecuteIf(query: PatternSeq, condition: Pattern->Bool) -> PatternSeq
Executes a query only if the condition is met. Otherwise, return an empty sequence of patterns.

Arguments
query: PatternSeq - Query to execute.
condition: Pattern->Bool - Condition that must be satisfied for the parent structure/pattern.
Examples
Residues().ExecuteIf(lambda p: p.Resolution() <= 2.4)
Returns residues in structures that have resolution lower than 2.4ang.
AminoAcids().ExecuteIf(lambda p: p.Count(Atoms('Fe')) > 3)
Returns all amino acids in structures that have at least 3 Fe atoms.

Filter

[edit]

Filter(patterns: PatternSeq, filter: Pattern->Bool) -> PatternSeq
Filters a sequence of patterns with a given predicate.

Arguments
patterns: PatternSeq - Patterns to filter.
filter: Pattern->Bool - Filter predicate.
Examples
Residues().Filter(lambda m: m.Count(Atoms("C")) >= 3)
Returns all residues that contain at least 3 C atoms.

IsConnected

[edit]

IsConnected(pattern: Pattern) -> Bool
Checks if a particular pattern is a connected graph.

Arguments
pattern: Pattern - A pattern to test.
Examples
Atoms("Zn").AmbientResidues(3).Filter(lambda m: m.IsConnected())
Finds all patterns with a Zn and residues within 3 ang, where all the ambient residues are connected to the central atom.

IsConnectedTo

[edit]

IsConnectedTo(where: Pattern, patterns: PatternSeq) -> Bool
Checks if a particular pattern is connected to any other specified pattern. The patterns must have empty intersection for this function to return true.

Arguments
where: Pattern - A pattern to test.
patterns: PatternSeq - Pattern sequence to test against.
Examples
Atoms().Filter(lambda a: a.IsConnectedTo(Rings()))
Finds all atoms that are connected to a ring they do not belong to.

IsNotConnectedTo

[edit]

IsNotConnectedTo(what: Pattern, patterns: PatternSeq) -> Bool
Checks if a particular pattern is not connected to any other specified pattern. The patterns must have empty intersection for this function to return true.

Arguments
what: Pattern - A pattern to test.
patterns: PatternSeq - Pattern sequence to test against.
Examples
Residues().Filter(lambda r: r.IsNotConnectedTo(Atoms("Ca")))
Finds all residues that are not connected to Ca atoms. The residue itself can still contain Ca atoms.

NearestDistanceTo

[edit]

NearestDistanceTo(where: Pattern, patterns: PatternSeq) -> Real
Finds the distance to a particular pattern.

Arguments
where: Pattern - A pattern to test.
patterns: PatternSeq - Pattern sequence to test against.
Examples
Atoms().Filter(lambda m: m.NearestDistanceTo(Residues("ASP")) >= 5)
Finds all atoms that are at least 5 (angstroms) away from any ASP residue.

SeqCount

[edit]

SeqCount(what: PatternSeq) -> Integer
Counts the length of a sequence of motifs.

Arguments
what: PatternSeq - What pattern sequence to count.
Examples
Atoms("Zn").AmbientResidues(3).Filter(lambda m: m.Find(Residues("HIS")).SeqCount() > 1)
Returns a sequence of patterns with Zn atom and residues within 3ang if the pattern contains at least 2 HIS residues.


Topology Functions

[edit]

Functions that rely on the topology of patterns.

ConnectedAtoms

[edit]

ConnectedAtoms(pattern: PatternSeq, n: Integer) -> PatternSeq
Surrounds the inner pattern by n layers of atoms.

Arguments
pattern: PatternSeq - Basic pattern.
n: Integer - Number of atom layers to connect.
Options
YieldNamedDuplicates: Bool = False - Yield duplicate patterns if they have a different name.
Examples
Residues("MAN").ConnectedAtoms(2)
Finds all MAN residues and then adds two connected levels of atoms to them.

ConnectedResidues

[edit]

ConnectedResidues(pattern: PatternSeq, n: Integer) -> PatternSeq
Surrounds the inner pattern by n layers of residues.

Arguments
pattern: PatternSeq - Basic pattern.
n: Integer - Number of residue layers to connect.
Options
YieldNamedDuplicates: Bool = False - Yield duplicate patterns if they have a different name.
Examples
Atoms("Zn").ConnectedResidues(1)
Finds all Zn atoms and adds all residues that are connected to them.

Path

[edit]

Path(patterns: PatternSeq+) -> PatternSeq
Creates a new pattern from 'connected' parts.

Arguments
patterns: PatternSeq+ - Patterns to path.
Examples
Path(Atoms("O"), Atoms("C"), Atoms("O"))
Finds patterns with two O and one C atoms where the C atoms is connected to the O ones.

Star

[edit]

Star(center: PatternSeq, patterns: PatternSeq+) -> PatternSeq
Creates a new pattern from a central one and connected parts.

Arguments
center: PatternSeq - Center pattern.
patterns: PatternSeq+ - Patterns to chain.
Examples
Star(Atoms("C"), Atoms("O"), Atoms("O"))
Finds patterns with two O atoms and one C atom in the center.
Atoms("C").Star(Atoms("O"), Atoms("O"))
Finds patterns with two O atoms and one C atom in the center.


Geometry Functions

[edit]

Functions that rely on the geometry of patterns.

AmbientAtoms

[edit]

AmbientAtoms(pattern: PatternSeq, r: Number) -> PatternSeq
Surrounds the inner pattern by atoms that within the given radius from the inner pattern.

Arguments
pattern: PatternSeq - Basic pattern.
r: Number - Radius.
Options
ExcludeBase: Bool = False - Exclude the central original pattern.
NoWaters: Bool = True - Ignore water residues such as HOH.
YieldNamedDuplicates: Bool = False - Yield duplicate patterns if they have a different name.
Examples
Atoms("Fe").AmbientAtoms(4)
Finds Fe atoms and all atoms within 4 (angstroms) from each of them.

AmbientResidues

[edit]

AmbientResidues(pattern: PatternSeq, r: Number) -> PatternSeq
Surrounds the inner pattern by residues that have at least one atom within the given radius from the inner pattern.

Arguments
pattern: PatternSeq - Basic pattern.
r: Number - Radius.
Options
ExcludeBase: Bool = False - Exclude the central original pattern.
NoWaters: Bool = True - Ignore water residues such as HOH.
YieldNamedDuplicates: Bool = False - Yield duplicate patterns if they have a different name.
Examples
Rings(6 * ["C"]).AmbientResidues(4)
Finds rings with 6C atoms and all residues within 4 (angstroms) from each of them.

Cluster

[edit]

Cluster(r: Number, patterns: PatternSeq+) -> PatternSeq
Clusters all patterns that are pairwise closer than r (angstroms).

Arguments
r: Number - Maximum distance between two patterns in the cluster.
patterns: PatternSeq+ - Patterns to cluster.
Examples
Cluster(4, Atoms("Ca"), Rings(5 * ["C"] + ["O"]))
Finds all instance of one or more rings with 5C and O atoms and one or more Ca atoms that are closer than 4 (angstroms).

Filled

[edit]

Filled(pattern: PatternSeq) -> PatternSeq
Adds all atoms that fall within the circumsphere (with radius multiplied by the factor) of the basic pattern.

Arguments
pattern: PatternSeq - Basic pattern.
Options
NoWaters: Bool = True - Ignore water residues such as HOH.
RadiusFactor: Number = 0.75 - Circumsphere radius factor.
Examples
Cluster(4, Residues("HIS")).Filled(RadiusFactor = 0.75)
Finds clusters of HIS residues and all atoms within the circumsphere.

Near

[edit]

Near(r: Number, patterns: PatternSeq+) -> PatternSeq
Clusters all patterns that are pairwise closer than r (angstroms) and checks if the "counts" match.

Arguments
r: Number - Maximum distance between two sub-patterns in the pattern.
patterns: PatternSeq+ - Patterns to 'cluster'.
Examples
Near(4, Atoms("Ca"), Atoms("Ca"), Rings(5 * ["C"] + ["O"]))
Finds all instance of a single ring with 5C and O atoms and two Ca atoms that are closer than 4 (angstroms).

Spherify

[edit]

Spherify(pattern: PatternSeq, r: Number) -> PatternSeq
Identifies the geometrical center of the base pattern and then includes all atoms within the specified radius.

Arguments
pattern: PatternSeq - Basic pattern.
r: Number - Radius.
Options
ExcludeBase: Bool = False - Exclude the central original pattern.
NoWaters: Bool = True - Ignore water residues such as HOH.
YieldNamedDuplicates: Bool = False - Yield duplicate patterns if they have a different name.
Examples

Rings(6 * ["C"]).Spherify(5)
Finds benzene moiety, computes centroid of each pattern, and includes all atoms within 5 angstroms from it.

Meta-data Functions

[edit]

Functions dealing with meta-data about structures such as release date or authors.

Authors

[edit]

Authors(pattern: Pattern) -> String
Returns authors of the parent structure separated by a semicolon. If the value is not available, null is returned.

Arguments
pattern: Pattern - Pattern.

ECNumbers

[edit]

ECNumbers(pattern: Pattern) -> String
Returns Enzymatic Commission numbers assigned to enzymes in the parent structure separated by a semicolon. If the value is not available, null is returned.

Arguments
pattern: Pattern - Pattern.

EntitySources

[edit]

EntitySources(pattern: Pattern) -> String
Returns entity sources of the parent structure separated by a semicolon. If the value is not available, null is returned.

Arguments
pattern: Pattern - Pattern.

ExperimentMethod

[edit]

ExperimentMethod(pattern: Pattern) -> String
Get the experiment method. The value is always an upper-case string. If the value is not available, null is returned.

Arguments
pattern: Pattern - Pattern.
Examples
Residues().ExecuteIf(lambda p: p.ExperimentMethod() == "INFRARED SPECTROSCOPY")
Returns residues in structures that satisfy the property.

HasAllAuthors

[edit]

HasAllAuthors(pattern: Pattern, properties: String+) -> Bool
Determines if the parent structure contains all given authors. The comparison is case sensitive.

Arguments
pattern: Pattern - Pattern.
properties: String+ - Properties.
Examples
Residues().ExecuteIf(lambda p: p.HasAllAuthors("Holmes", "Watson"))
Returns residues in structures that contain all given properties.

HasAllECNumbers

[edit]

HasAllECNumbers(pattern: Pattern, properties: String+) -> Bool
Determines if the parent structure contains all given Enzymatic Commission numbers. It is possible to enter just a number prefix without the '.'. The comparison is not case sensitive.

Arguments
pattern: Pattern - Pattern.
properties: String+ - Properties.
Examples
Residues().ExecuteIf(lambda p: p.HasAllECNumbers("3.2.1.18", "3.3"))
Returns residues in structures that contain all given properties.

HasAllEntitySources

[edit]

HasAllEntitySources(pattern: Pattern, properties: String+) -> Bool
Determines if the parent structure contains all given entity sources. The comparison is not case sensitive.

Arguments
pattern: Pattern - Pattern.
properties: String+ - Properties.
Examples
Residues().ExecuteIf(lambda p: p.HasAllEntitySources("GMO", "Natural", "Synthetic"))
Returns residues in structures that contain all given properties.

HasAllHostOrganismGenus

[edit]

HasAllHostOrganismGenus(pattern: Pattern, properties: String+) -> Bool
Determines if the parent structure contains all given host organism identifiers. The comparison is not case sensitive.

Arguments
pattern: Pattern - Pattern.
properties: String+ - Properties.
Examples
Residues().ExecuteIf(lambda p: p.HasAllHostOrganismGenus("X", "Y"))
Returns residues in structures that contain all given properties.

HasAllHostOrganismIds

[edit]

HasAllHostOrganismIds(pattern: Pattern, properties: String+) -> Bool
Determines if the parent structure contains all given host organism identifiers. The comparison is not case sensitive.

Arguments
pattern: Pattern - Pattern.
properties: String+ - Properties.
Examples
Residues().ExecuteIf(lambda p: p.HasAllHostOrganismIds("7108", "11244"))
Returns residues in structures that contain all given properties.

HasAllHostOrganisms

[edit]

HasAllHostOrganisms(pattern: Pattern, properties: String+) -> Bool
Determines if the parent structure contains all given host organism names. The comparison is not case sensitive.

Arguments
pattern: Pattern - Pattern.
properties: String+ - Properties.
Examples
Residues().ExecuteIf(lambda p: p.HasAllHostOrganisms("Spodoptera frugiperda", "Mus musculus"))
Returns residues in structures that contain all given properties.

HasAllKeywords

[edit]

HasAllKeywords(pattern: Pattern, properties: String+) -> Bool
Determines if the parent structure contains all given keywords. The comparison is not case sensitive.

Arguments
pattern: Pattern - Pattern.
properties: String+ - Properties.
Examples
Residues().ExecuteIf(lambda p: p.HasAllKeywords("membrane", "glycoprotein"))
Returns residues in structures that contain all given properties.

HasAllOriginOrganismGenus

[edit]

HasAllOriginOrganismGenus(pattern: Pattern, properties: String+) -> Bool
Determines if the parent structure contains all given origin organism identifiers. The comparison is not case sensitive.

Arguments
pattern: Pattern - Pattern.
properties: String+ - Properties.
Examples
Residues().ExecuteIf(lambda p: p.HasAllOriginOrganismGenus("X", "Y"))
Returns residues in structures that contain all given properties.

HasAllOriginOrganismIds

[edit]

HasAllOriginOrganismIds(pattern: Pattern, properties: String+) -> Bool
Determines if the parent structure contains all given origin organism identifiers. The comparison is not case sensitive.

Arguments
pattern: Pattern - Pattern.
properties: String+ - Properties.
Examples
Residues().ExecuteIf(lambda p: p.HasAllOriginOrganismIds("121791", "10090"))
Returns residues in structures that contain all given properties.

HasAllOriginOrganisms

[edit]

HasAllOriginOrganisms(pattern: Pattern, properties: String+) -> Bool
Determines if the parent structure contains all given origin organism names. The comparison is not case sensitive.

Arguments
pattern: Pattern - Pattern.
properties: String+ - Properties.
Examples
Residues().ExecuteIf(lambda p: p.HasAllOriginOrganisms("Nipah virus", "Mus musculus"))
Returns residues in structures that contain all given properties.

HasAnyAuthor

[edit]

HasAnyAuthor(pattern: Pattern, properties: String+) -> Bool
Determines if the parent structure contains any of the given authors. The comparison is case sensitive.

Arguments
pattern: Pattern - Pattern.
properties: String+ - Properties.
Examples
Residues().ExecuteIf(lambda p: p.HasAnyAuthor("Holmes", "Watson"))
Returns residues in structures that contain all given properties.

HasAnyECNumber

[edit]

HasAnyECNumber(pattern: Pattern, properties: String+) -> Bool
Determines if the parent structure contains any of the given Enzymatic Commission number. It is possible to enter just a number prefix without the '.'s. The comparison is not case sensitive.

Arguments
pattern: Pattern - Pattern.
properties: String+ - Properties.
Examples
Residues().ExecuteIf(lambda p: p.HasAnyECNumber("3.2.1.19", "3.3"))
Returns residues in structures that contain all given properties.

HasAnyEntitySources

[edit]

HasAnyEntitySources(pattern: Pattern, properties: String+) -> Bool
Determines if the parent structure contains any of the given entity sources. The comparison is not case sensitive.

Arguments
pattern: Pattern - Pattern.
properties: String+ - Properties.
Examples
Residues().ExecuteIf(lambda p: p.HasAnyEntitySources("GMO", "Natural", "Synthetic"))
Returns residues in structures that contain all given properties.

HasAnyHostOrganism

[edit]

HasAnyHostOrganism(pattern: Pattern, properties: String+) -> Bool
Determines if the parent structure contains any of the given host organism names. The comparison is not case sensitive.

Arguments
pattern: Pattern - Pattern.
properties: String+ - Properties.
Examples
Residues().ExecuteIf(lambda p: p.HasAnyHostOrganism("Spodoptera frugiperda", "Mus musculus"))
Returns residues in structures that contain all given properties.

HasAnyHostOrganismGenus

[edit]

HasAnyHostOrganismGenus(pattern: Pattern, properties: String+) -> Bool
Determines if the parent structure contains any of the given host organism identifierss. The comparison is not case sensitive.

Arguments
pattern: Pattern - Pattern.
properties: String+ - Properties.
Examples
Residues().ExecuteIf(lambda p: p.HasAnyHostOrganismGenus("X", "Y"))
Returns residues in structures that contain all given properties.

HasAnyHostOrganismId

[edit]

HasAnyHostOrganismId(pattern: Pattern, properties: String+) -> Bool
Determines if the parent structure contains any of the given host organism identifierss. The comparison is not case sensitive.

Arguments
pattern: Pattern - Pattern.
properties: String+ - Properties.
Examples
Residues().ExecuteIf(lambda p: p.HasAnyHostOrganismId("7108", "11244"))
Returns residues in structures that contain all given properties.

HasAnyKeyword

[edit]

HasAnyKeyword(pattern: Pattern, properties: String+) -> Bool
Determines if the parent structure contains any of the given keywords. The comparison is not case sensitive.

Arguments
pattern: Pattern - Pattern.
properties: String+ - Properties.
Examples
Residues().ExecuteIf(lambda p: p.HasAnyKeyword("membrane", "glycoprotein"))
Returns residues in structures that contain all given properties.

HasAnyOriginOrganism

[edit]

HasAnyOriginOrganism(pattern: Pattern, properties: String+) -> Bool
Determines if the parent structure contains any of the given origin organism names. The comparison is not case sensitive.

Arguments
pattern: Pattern - Pattern.
properties: String+ - Properties.
Examples
Residues().ExecuteIf(lambda p: p.HasAnyOriginOrganism("Nipah virus", "Mus musculus"))
Returns residues in structures that contain all given properties.

HasAnyOriginOrganismGenus

[edit]

HasAnyOriginOrganismGenus(pattern: Pattern, properties: String+) -> Bool
Determines if the parent structure contains any of the given origin organism identifierss. The comparison is not case sensitive.

Arguments
pattern: Pattern - Pattern.
properties: String+ - Properties.
Examples
Residues().ExecuteIf(lambda p: p.HasAnyOriginOrganismGenus("X", "Y"))
Returns residues in structures that contain all given properties.

HasAnyOriginOrganismId

[edit]

HasAnyOriginOrganismId(pattern: Pattern, properties: String+) -> Bool
Determines if the parent structure contains any of the given origin organism identifierss. The comparison is not case sensitive.

Arguments
pattern: Pattern - Pattern.
properties: String+ - Properties.
Examples
Residues().ExecuteIf(lambda p: p.HasAnyOriginOrganismId("121791", "10090"))
Returns residues in structures that contain all given properties.

HostOrganismGenus

[edit]

HostOrganismGenus(pattern: Pattern) -> String
Returns host organism identifiers of the parent structure separated by a semicolon. If the value is not available, null is returned.

Arguments
pattern: Pattern - Pattern.

HostOrganismIds

[edit]

HostOrganismIds(pattern: Pattern) -> String
Returns host organism identifiers of the parent structure separated by a semicolon. If the value is not available, null is returned.

Arguments
pattern: Pattern - Pattern.

HostOrganisms

[edit]

HostOrganisms(pattern: Pattern) -> String
Returns host organism names of the parent structure separated by a semicolon. If the value is not available, null is returned.

Arguments
pattern: Pattern - Pattern.

Keywords

[edit]

Keywords(pattern: Pattern) -> String
Returns keywords of the parent structure separated by a semicolon. If the value is not available, null is returned.

Arguments
pattern: Pattern - Pattern.

LatestRevisionDate

[edit]

LatestRevisionDate(pattern: Pattern) -> Value
Get the latest revision date of the parent structure. The value has to be compared to the DateTime(year, month, day) object. If the value is not available, null is returned.

Arguments
pattern: Pattern - Pattern.
Examples
Residues().ExecuteIf(lambda p: p.LatestRevisionDate() >= DateTime(2008, 1, 1))
Returns residues in structures that satisfy the property.

LatestRevisionYear

[edit]

LatestRevisionYear(pattern: Pattern) -> Integer
Get the latest revision year of the parent structure. If the value is not available, null is returned.

Arguments
pattern: Pattern - Pattern.
Examples
Residues().ExecuteIf(lambda p: p.LatestRevisionYear() == 2006)
Returns residues in structures that satisfy the property.

OriginOrganismGenus

[edit]

OriginOrganismGenus(pattern: Pattern) -> String
Returns origin organism identifiers of the parent structure separated by a semicolon. If the value is not available, null is returned.

Arguments
pattern: Pattern - Pattern.

OriginOrganismIds

[edit]

OriginOrganismIds(pattern: Pattern) -> String
Returns origin organism identifiers of the parent structure separated by a semicolon. If the value is not available, null is returned.

Arguments
pattern: Pattern - Pattern.

OriginOrganisms

[edit]

OriginOrganisms(pattern: Pattern) -> String
Returns origin organism names of the parent structure separated by a semicolon. If the value is not available, null is returned.

Arguments
pattern: Pattern - Pattern.

PolymerType

[edit]

PolymerType(pattern: Pattern) -> String
Get the polymer type of the structure. Possible values are: NotAssigned, Protein, DNA, RNA, ProteinDNA, ProteinRNA, NucleicAcids, Mixture, Sugar, Other. If the value is not available, null is returned.

Arguments
pattern: Pattern - Pattern.
Examples
Residues().ExecuteIf(lambda p: p.PolymerType() == "ProteinDNA")
Returns residues in structures that satisfy the property.

ProteinStoichiometry

[edit]

ProteinStoichiometry(pattern: Pattern) -> String
Get the protein stoichiometry of the parent structure. Possible values are: NotAssigned, Monomer, Homomer, Heteromer. If the value is not available, null is returned.

Arguments
pattern: Pattern - Pattern.
Examples
Residues().ExecuteIf(lambda p: p.ProteinStoichiometry() == "Heteromer")
Returns residues in structures that satisfy the property.

ProteinStoichiometryString

[edit]

ProteinStoichiometryString(pattern: Pattern) -> String
Get the protein stoichiometry string of the parent structure. If the value is not available, null is returned.

Arguments
pattern: Pattern - Pattern.

ReleaseDate

[edit]

ReleaseDate(pattern: Pattern) -> Value
Get the release date of the parent structure. The value has to be compared to the DateTime(year, month, day) object. If the value is not available, null is returned.

Arguments
pattern: Pattern - Pattern.
Examples
Residues().ExecuteIf(lambda p: p.ReleaseDate() >= DateTime(2008, 1, 1))
Returns residues in structures that satisfy the property.

ReleaseYear

[edit]

ReleaseYear(pattern: Pattern) -> Integer
Get the release year of the parent structure. If the value is not available, null is returned.

Arguments
pattern: Pattern - Pattern.
Examples
Residues().ExecuteIf(lambda p: p.ReleaseYear() == 2006)
Returns residues in structures that satisfy the property.

Resolution

[edit]

Resolution(pattern: Pattern) -> Real
Get the resolution in angstroms of the parent structure. If the value is not available, null is returned.

Arguments
pattern: Pattern - Pattern.
Examples
Residues().ExecuteIf(lambda p: p.Resolution() <= 2.4)
Returns residues in structures that satisfy the property.

Weight

[edit]

Weight(pattern: Pattern) -> Real
Get the weight of the molecule in kDa. If the value is not available, null is returned.

Arguments
pattern: Pattern - Pattern.
Examples
Residues().ExecuteIf(lambda p: p.Weight() > 100000.0)
Returns residues in structures that satisfy the property.


Miscellaneous Functions

[edit]

Various useful functions. These function often require a special setup (i.e. only useful in Scripting window or in specific applications).

AminoSequenceString

[edit]

AminoSequenceString(pattern: Pattern) -> String
Returns a string of single-letter amino acids contained in the pattern.
Note: This function cannot be used directly to query patterns from MotiveExplorer or Queries service.

Arguments
pattern: Pattern - Pattern to convert.
Examples
Pattern("1tqn_12").AminoSequenceString()
Returns a string representing amino acids in the pattern '1tqn_12'.
RegularMotifs(Pattern("1tqn_12").AminoSequenceString())
Returns all regular patterns that correspond to the AMK sequence in 1tqn_12.

AtomProperty

[edit]

AtomProperty(atomPattern: Pattern, name: String) -> ?
If the property exists and the pattern consists of a single atom, returns the property. Otherwise, returns Nothing.
Note: This function cannot be used directly to query patterns from MotiveExplorer or Queries service.

Arguments
atomPattern: Pattern - Single atom pattern.
name: String - Property name.
Examples
a.AtomProperty("charge")
Gets the 'charge' property of the atom a. Where a is a single atom Pattern. This example will not work directly.
Atoms().Filter(lambda a: a.AtomProperty("charge") >= 2)
All atoms with the charge property greater or equal to 2. This example will only work in cases where a suitable property is defined. For example in Scripting window in the Charges app.

AtomSimilarity

[edit]

AtomSimilarity(a: Pattern, b: Pattern) -> Real
Computes Jaccard/Tanimoto coefficient on atoms (element symbols) of both structures.
Note: This function cannot be used directly to query patterns from MotiveExplorer or Queries service.

Arguments
a: Pattern - First pattern.
b: Pattern - Second pattern.
Examples
AtomSimilarity(Current(),Pattern("1tqn_12"))
Computes the atom similarity between the current pattern and 1tqn_12. This example can be used in SiteBinder to create a descriptor (assuming a structure with id '1tqn_12' is loaded).

CommonAtoms

[edit]

CommonAtoms(modelId: String) -> PatternSeq
Returns a single pattern with atoms common with the model. Properties checked: atom id, element symbol, chain, residue number. This query is useful for example for atom selection in SiteBinder.
Note: This function cannot be used directly to query patterns from MotiveExplorer or Queries service.

Arguments
modelId: String - Id of the model.
Examples
CommonAtoms("1tqn_12")
Returns a pattern formed by atoms common with the '1tqn_12' structure.

CSA

[edit]

CSA() -> PatternSeq
Entries from Catalytic Site Atlas represented as patterns. Works only if used from the command line version of Queries and property configured.
Note: This function cannot be used directly to query patterns from MotiveExplorer or Queries service.

Examples
CSA()
All CSA sites for the given structure. This example will only work if used from the command line version of Queries and property configured.

Current

[edit]

Current() -> Pattern
A variable that is assigned by the application environment.
Note: This function cannot be used directly to query patterns from MotiveExplorer or Queries service.

Examples
AtomSimilarity(Current(), Pattern("model"))
Returns the atom similarity of the current pattern and the model. This example will work for example when defining a structure descriptor in SiteBinder and there is a structure with id 'model' loaded.

Descriptor

[edit]

Descriptor(pattern: Pattern, name: String) -> ?
Returns the descriptor. If the descriptor does not exist, 'null' is returned.
Note: This function cannot be used directly to query patterns from MotiveExplorer or Queries service.

Arguments
pattern: Pattern - Pattern that represents entire structure.
name: String - Descriptor name.
Examples
Current().Descriptor("similarity") >= 0.75
Returns True if 'similarity' descriptor of the current pattern is at least 0.75. This example will work for example in SiteBinder's structure selection if the 'similarity' descriptor has been previously defined.

DynamicInvoke

[edit]

DynamicInvoke(value: Value, name: String, isProperty: Bool, args: Value) -> Value
Dynamically invoke a member. (internal)
Note: This function cannot be used directly to query patterns from MotiveExplorer or Queries service.

Arguments
value: Value - InnerQuery.
name: String - Member name.
isProperty: Bool - Is this a property.
args: Value - Array of arguments.

Find

[edit]

Find(source: Pattern, patterns: PatternSeq) -> PatternSeq
Converts the source pattern to a structure and finds patterns within it.
Note: This function cannot be used directly to query patterns from MotiveExplorer or Queries service.

Arguments
source: Pattern - Where to look.
patterns: PatternSeq - Patterns to find.
Examples
AtomSimilarity(Current().Find(NotAtoms("N")).ToPattern(), Pattern("model").Find(NotAtoms("N")).ToPattern())
Computes the atom similarity of the 'current' and 'model' patterns, but ignores N atoms. This example can be used in SiteBinder to create a descriptor (assuming a structure with id 'model' is loaded).

GroupedAtoms

[edit]

GroupedAtoms(symbols: String*) -> PatternSeq
Groups atoms using the element symbol and then returns each group as a single pattern.
Note: This function cannot be used directly to query patterns from MotiveExplorer or Queries service.

Arguments
symbols: String* - Allowed element symbols.
Examples
GroupedAtoms()
Returns groups of all atom types. For example if the input has atoms 5xC-1xO, patterns with 5xC and 1xO atoms are returned.
GroupedAtoms('C', 'O')
Returns groups of all atom types. For example if the input has atoms 5xC-1xO-6xH, patterns with 5xC and 1xO atoms are returned (but the H atoms are ignored).

Pattern

[edit]

Pattern(structureName: String) -> Pattern
Returns a structure represented as a pattern.
Note: This function cannot be used directly to query patterns from MotiveExplorer or Queries service.

Arguments
structureName: String - Name of a structure.
Examples
Pattern("1tqn_12")
Returns the structure '1tqn_12' represented as a pattern. Usable in defining descriptors or in Scripting window (using MQ.Execute).

ResidueSimilarity

[edit]

ResidueSimilarity(a: Pattern, b: Pattern) -> Real
Computes Jaccard/Tanimoto coefficient on residue names of both structures.
Note: This function cannot be used directly to query patterns from MotiveExplorer or Queries service.

Arguments
a: Pattern - First pattern.
b: Pattern - Second pattern.
Examples
ResidueSimilarity(Current(), Pattern("1tqn_12"))
Computes the residue similarity between the current pattern and '1tqn_12'. This example can be used in SiteBinder to create a descriptor (assuming a structure with id '1tqn_12' is loaded).

ToPattern

[edit]

ToPattern(patterns: PatternSeq) -> Pattern
Converts a sequence of Patterns (AtomSetSeq) to a single Pattern by merging all atoms into a single atom set. The Pattern type is required by some function such as AtomSimilarity.
Note: This function cannot be used directly to query patterns from MotiveExplorer or Queries service.

Arguments
patterns: PatternSeq - Patterns to convert.
Examples
Residues("HIS").ToPattern()
Converts a sequence of HIS residue Patterns to a single Pattern.
AtomSimilarity(Current().Find(NotAtoms("N")).ToPattern(), Pattern("model").Find(NotAtoms("N")).ToPattern())
Computes the atom similarity of the 'current' and 'model' patterns, but ignores N atoms.


Value Functions

[edit]

Functions such as addition or comparison of numbers.

Abs

[edit]

Abs(x: Number) -> Number
Computes the 'Abs' function of the argument.

Arguments
x: Number - Argument.
Examples
Abs(x)
Evaluates the expression.

Divide (/)

[edit]

Divide(x: Number, y: Number) -> Number
Computes the 'Divide' function of the values.

Arguments
x: Number - Left argument.
y: Number - Right argument.
Examples
x / y
Evaluates the expression.

Equal (==)

[edit]

Equal(x: Value, y: Value) -> Bool
Determines the 'Equal' relation between two values.

Arguments
x: Value - Left argument.
y: Value - Right argument.
Examples
x == y
Evaluates to True or False based on the value of x and y.

Greater (>)

[edit]

Greater(x: Number, y: Number) -> Bool
Determines the 'Greater' relation between two values.

Arguments
x: Number - Left argument.
y: Number - Right argument.
Examples
x > y
Evaluates to True or False based on the value of x and y.

GreaterEqual (>=)

[edit]

GreaterEqual(x: Number, y: Number) -> Bool
Determines the 'GreaterEqual' relation between two values.

Arguments
x: Number - Left argument.
y: Number - Right argument.
Examples
x >= y
Evaluates to True or False based on the value of x and y.

Less (<)

[edit]

Less(x: Number, y: Number) -> Bool
Determines the 'Less' relation between two values.

Arguments
x: Number - Left argument.
y: Number - Right argument.
Examples
x < y
Evaluates to True or False based on the value of x and y.

LessEqual (<=)

[edit]

LessEqual(x: Number, y: Number) -> Bool
Determines the 'LessEqual' relation between two values.

Arguments
x: Number - Left argument.
y: Number - Right argument.
Examples
x <= y
Evaluates to True or False based on the value of x and y.

LogicalAnd (&)

[edit]

LogicalAnd(xs: Bool+) -> Bool
Computes 'LogicalAnd' of the input values.

Arguments
xs: Bool+ - Arguments.
Examples
x & y
Evaluates to True or False based on the values of x and y.

LogicalNot (Not)

[edit]

LogicalNot(x: Bool) -> Bool
Computes 'LogicalNot' of the input value. This function can be called using the shorthand 'Not'.

Arguments
x: Bool - Argument.
Examples
LogicalNot(x)
Evaluates to True or False based on the value of x.
x.Not()
Evaluates to True or False based on the value of x.

LogicalOr (|)

[edit]

LogicalOr(xs: Bool+) -> Bool
Computes 'LogicalOr' of the input values.

Arguments
xs: Bool+ - Arguments.
Examples
x | y
Evaluates to True or False based on the values of x and y.

LogicalXor (Xor)

[edit]

LogicalXor(xs: Bool+) -> Bool
Computes 'LogicalXor' of the input values. This function can be called using the shorthand 'Xor'.

Arguments
xs: Bool+ - Arguments.
Examples
LogicalXor(x, y)
Evaluates to True or False based on the values of x and y.
Xor(x, y)
Evaluates to True or False based on the values of x and y.

Minus (-)

[edit]

Minus(x: Number) -> Number
Computes the arithmetic negation of the argument.

Arguments
x: Number - Argument.
Examples
-x
Arithmetic negation of x.

NotEqual (!=)

[edit]

NotEqual(x: Value, y: Value) -> Bool
Determines the 'NotEqual' relation between two values.

Arguments
x: Value - Left argument.
y: Value - Right argument.
Examples
x != y
Evaluates to True or False based on the value of x and y.

Plus (+)

[edit]

Plus(x: Number, y: Number) -> Number
Computes the 'Plus' function of the values.

Arguments
x: Number - Left argument.
y: Number - Right argument.
Examples
x + y
Evaluates the expression.

Power (^)

[edit]

Power(x: Number, y: Number) -> Number
Computes the 'Power' function of the values.

Arguments
x: Number - Left argument.
y: Number - Right argument.
Examples
x ^ y
Evaluates the expression.

Subtract (-)

[edit]

Subtract(x: Number, y: Number) -> Number
Computes the 'Subtract' function of the values.

Arguments
x: Number - Left argument.
y: Number - Right argument.
Examples
x - y
Evaluates the expression.

Times (*)

[edit]

Times(x: Number, y: Number) -> Number
Computes the 'Times' function of the values.

Arguments
x: Number - Left argument.
y: Number - Right argument.
Examples
x * y
Evaluates the expression.