MotiveQuery Language Reference (development)

From WebChem Wiki
Jump to: navigation, search

Contents

Introduction

MotiveQuery (MQ) is a user friendly chemical language primarily designed for defining structural fragments. MQ 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 structural fragments. MQ 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.), MQ allows the user to include any amount of information regarding the residue level structure directly into the definition of the fragments.

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.

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

Some of the functions return FragmentSeq while other return Fragment.

  • Fragment is a set of atoms.
  • FragmentSeq is a sequence of Fragment (the sets of atoms).

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

Using MotiveQuery in Silverlight applications

MotiveQuery can be used in SiteBinder, EEM Charges, and MotiveExplorer from the the corresponding UI elements. Moreover, it is possible to use MQ from the Scripting window. This is achieved using the MQ.Execute function. The function takes two parameters: the query and an optional target structure list.

Examples

These examples can be executed from the Scripting window of SiteBinder, MotiveExplorer, or other Silverlight applications.

q = Atoms("Zn").ConnectedAtoms(2) 
MQ.Execute(q)
This command finds all fragments specified by the query q in all loaded structures.
MQ.Execute(Residues("HEM"), [ Session.StructureMap["1tqn"], Session.StructureMap["2wer"] ])
This command finds all HEM residues in structures 1tqn and 2wer (provided structures with these names are loaded).
q = AtomSimilarity(Fragment("model"), Fragment("1gtz_0"))
MQ.Execute(q)
This command computes the atom similarity (Jaccard coefficient) for structures model and 1gtz_0.
q = ResidueSimilarity(Fragment("model"), Current())
MQ.Execute(q, Session.Structures)
This command computes the residue similarity (Jaccard coefficient) for the structure with id 'model' (which is loaded using the Fragment function) and all other loaded structures (computed one by one using the function Current()). The result is returned in CSV format.

Basic Query Functions

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

AminoAcids

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

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

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

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

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

Helices

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

Examples
Helices()
Returns all helices.

HetResidues

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

Chains

Chains(identifiers: Value*) -> FragmentSeq
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.

Named

Named(fragments: FragmentSeq) -> FragmentSeq
'Names' the fragment by its lowest atom id.

Arguments
fragments: FragmentSeq - Fragments 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

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

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

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

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

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

RegularMotifs(regex: Value) -> FragmentSeq
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. 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

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

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

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

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

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

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

Examples
Sheets()
Returns all sheets.


Advanced Query Functions

Advanced building blocks of the language.

Flatten

Flatten(fragments: FragmentSeq, selector: Fragment->FragmentSeq) -> FragmentSeq
Converts a sequence of sequence of fragments into a single 'flat' sequence.

Arguments
fragments: FragmentSeq - Fragments to project.
selector: Fragment->FragmentSeq - The selector.
Examples
Residues("HIS").Flatten(lambda m: m.Find(Atoms("C")))
Returns all C atoms on HIS residues.

Inside

Inside(fragments: FragmentSeq, where: FragmentSeq) -> FragmentSeq
Finds fragments within another fragment. Equivalent to where.Flatten(lambda m: m.Find(fragments))

Arguments
fragments: FragmentSeq - Fragments to find.
where: FragmentSeq - Where to find them.
Examples
Atoms("C").Inside(Residues("HIS"))
Returns all C atoms on HIS residues.

Or

Or(fragments: FragmentSeq+) -> FragmentSeq
Merges several fragment sequences into one.

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

ToAtoms

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

Arguments
fragments: FragmentSeq - Fragments to split.
Examples
Residues("HIS").ToAtoms()
Returns all atoms on HIS residues one by one.

ToResidues

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

Arguments
fragments: FragmentSeq - Fragments to split.
Examples
Atoms("C").ToResidues()
Returns all C atoms grouped by residues.

Union

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

Arguments
fragments: FragmentSeq - Fragments to merge.
Examples
Rings().Union()
Creates a single fragment that contains all rings.


Filter Functions

Functions useful for filtering fragments.

Contains

Contains(where: Fragment, what: FragmentSeq) -> Bool
Checks if a fragment is contained within another one. Equivalent to where.Count(what) > 0.

Arguments
where: Fragment - Where to look.
what: FragmentSeq - 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

Count(where: Fragment, what: FragmentSeq) -> Integer
Counts all occurrences of fragment 'what' in fragment 'where'.

Arguments
where: Fragment - Where to count it.
what: FragmentSeq - What fragment to count.
Examples
m.Count(Residues("HIS"))
Returns the count of HIS residues in the fragment m. Where m is a Fragment (for example when using the Filter function or returned by the ToFragment() 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)
Fragments with Zn atoms and its connected residues with exactly 2 HIS residues.

ExecuteIf

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

Arguments
query: FragmentSeq - Query to execute.
condition: Fragment->Bool - Condition that must be satisfied for the parent structure/fragment.
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

Filter(fragments: FragmentSeq, filter: Fragment->Bool) -> FragmentSeq
Filters a sequence of fragments with a given predicate.

Arguments
fragments: FragmentSeq - Fragments to filter.
filter: Fragment->Bool - Filter predicate.
Examples
Residues().Filter(lambda m: m.Count(Atoms("C")) >= 3)
Returns all residues that contain at least 3 C atoms.

IsConnected

IsConnected(fragment: Fragment) -> Bool
Checks if a particular fragment is a connected graph.

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

IsConnectedTo

IsConnectedTo(where: Fragment, fragments: FragmentSeq) -> Bool
Checks if a particular fragment is connected to any other specified fragment. The fragments must have empty intersection for this function to return true.

Arguments
where: Fragment - A fragment to test.
fragments: FragmentSeq - Fragment 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

IsNotConnectedTo(what: Fragment, fragments: FragmentSeq) -> Bool
Checks if a particular fragment is not connected to any other specified fragment. The fragments must have empty intersection for this function to return true.

Arguments
what: Fragment - A fragment to test.
fragments: FragmentSeq - Fragment 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

NearestDistanceTo(where: Fragment, fragments: FragmentSeq) -> Real
Finds the distance to a particular fragment.

Arguments
where: Fragment - A fragment to test.
fragments: FragmentSeq - Fragment 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.


Topology Functions

Functions that rely on the topology of fragments.

ConnectedAtoms

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

Arguments
fragment: FragmentSeq - Basic fragment.
n: Integer - Number of atom layers to connect.
Options
YieldNamedDuplicates: Bool = False - Yield duplicate fragments 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

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

Arguments
fragment: FragmentSeq - Basic fragment.
n: Integer - Number of residue layers to connect.
Options
YieldNamedDuplicates: Bool = False - Yield duplicate fragments 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

Path(fragments: FragmentSeq+) -> FragmentSeq
Creates a new fragment from 'connected' parts.

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

Star

Star(center: FragmentSeq, fragments: FragmentSeq+) -> FragmentSeq
Creates a new fragment from a central one and connected parts.

Arguments
center: FragmentSeq - Center fragment.
fragments: FragmentSeq+ - Fragments to chain.
Examples
Star(Atoms("C"), Atoms("O"), Atoms("O"))
Finds fragments with two O atoms and one C atom in the center.
Atoms("C").Star(Atoms("O"), Atoms("O"))
Finds fragments with two O atoms and one C atom in the center.


Geometry Functions

Functions that rely on the geometry of fragments.

AmbientAtoms

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

Arguments
fragment: FragmentSeq - Basic fragment.
r: Number - Radius.
Options
ExcludeBase: Bool = False - Exclude the central original fragment.
NoWaters: Bool = True - Ignore water residues such as HOH.
YieldNamedDuplicates: Bool = False - Yield duplicate fragments 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

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

Arguments
fragment: FragmentSeq - Basic fragment.
r: Number - Radius.
Options
ExcludeBase: Bool = False - Exclude the central original fragment.
NoWaters: Bool = True - Ignore water residues such as HOH.
YieldNamedDuplicates: Bool = False - Yield duplicate fragments 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

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

Arguments
r: Number - Maximum distance between two fragments in the cluster.
fragments: FragmentSeq+ - Fragments 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

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

Arguments
fragment: FragmentSeq - Basic fragment.
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

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

Arguments
r: Number - Maximum distance between two sub-fragments in the fragment.
fragments: FragmentSeq+ - Fragments 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).


Meta-data Functions

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

Authors

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

Arguments
fragment: Fragment - Fragment.

ECNumbers

ECNumbers(fragment: Fragment) -> 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
fragment: Fragment - Fragment.

EntitySources

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

Arguments
fragment: Fragment - Fragment.

ExperimentMethod

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

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

HasAllAuthors

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

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

HasAllECNumbers

HasAllECNumbers(fragment: Fragment, 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
fragment: Fragment - Fragment.
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

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

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

HasAllHostOrganismGenus

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

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

HasAllHostOrganismIds

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

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

HasAllHostOrganisms

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

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

HasAllKeywords

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

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

HasAllOriginOrganismGenus

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

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

HasAllOriginOrganismIds

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

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

HasAllOriginOrganisms

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

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

HasAnyAuthor

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

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

HasAnyECNumber

HasAnyECNumber(fragment: Fragment, 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
fragment: Fragment - Fragment.
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

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

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

HasAnyHostOrganism

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

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

HasAnyHostOrganismGenus

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

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

HasAnyHostOrganismId

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

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

HasAnyKeyword

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

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

HasAnyOriginOrganism

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

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

HasAnyOriginOrganismGenus

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

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

HasAnyOriginOrganismId

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

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

HostOrganismGenus

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

Arguments
fragment: Fragment - Fragment.

HostOrganismIds

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

Arguments
fragment: Fragment - Fragment.

HostOrganisms

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

Arguments
fragment: Fragment - Fragment.

Keywords

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

Arguments
fragment: Fragment - Fragment.

LatestRevisionDate

LatestRevisionDate(fragment: Fragment) -> 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
fragment: Fragment - Fragment.
Examples
Residues().ExecuteIf(lambda p: p.LatestRevisionDate() >= DateTime(2008, 1, 1))
Returns residues in structures that satisfy the property.

LatestRevisionYear

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

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

OriginOrganismGenus

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

Arguments
fragment: Fragment - Fragment.

OriginOrganismIds

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

Arguments
fragment: Fragment - Fragment.

OriginOrganisms

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

Arguments
fragment: Fragment - Fragment.

PolymerType

PolymerType(fragment: Fragment) -> 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
fragment: Fragment - Fragment.
Examples
Residues().ExecuteIf(lambda p: p.PolymerType() == "ProteinDNA")
Returns residues in structures that satisfy the property.

ProteinStoichiometry

ProteinStoichiometry(fragment: Fragment) -> 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
fragment: Fragment - Fragment.
Examples
Residues().ExecuteIf(lambda p: p.ProteinStoichiometry() == "Heteromer")
Returns residues in structures that satisfy the property.

ProteinStoichiometryString

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

Arguments
fragment: Fragment - Fragment.

ReleaseDate

ReleaseDate(fragment: Fragment) -> 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
fragment: Fragment - Fragment.
Examples
Residues().ExecuteIf(lambda p: p.ReleaseDate() >= DateTime(2008, 1, 1))
Returns residues in structures that satisfy the property.

ReleaseYear

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

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

Resolution

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

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

Weight

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

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


Miscellaneous Functions

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

AminoSequenceString

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

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

AtomProperty

AtomProperty(atomFragment: Fragment, name: String) -> ?
If the property exists and the fragment consists of a single atom, returns the property. Otherwise, returns Nothing.
Note: This function cannot be used directly to query fragments from MotiveExplorer or MotiveQuery service.

Arguments
atomFragment: Fragment - Single atom fragment.
name: String - Property name.
Examples
a.AtomProperty("charge")
Gets the 'charge' property of the atom a. Where a is a single atom Fragment. 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

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

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

CommonAtoms

CommonAtoms(modelId: String) -> FragmentSeq
Returns a single fragment 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 fragments from MotiveExplorer or MotiveQuery service.

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

CSA

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

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

Current

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

Examples
AtomSimilarity(Current(), Fragment("model"))
Returns the atom similarity of the current fragment 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(fragment: Fragment, name: String) -> ?
Returns the descriptor. If the descriptor does not exist, 'null' is returned.
Note: This function cannot be used directly to query fragments from MotiveExplorer or MotiveQuery service.

Arguments
fragment: Fragment - Fragment that represents entire structure.
name: String - Descriptor name.
Examples
Current().Descriptor("similarity") >= 0.75
Returns True if 'similarity' descriptor of the current fragment 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

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

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

Find

Find(source: Fragment, fragments: FragmentSeq) -> FragmentSeq
Converts the source fragment to a structure and finds fragments within it.
Note: This function cannot be used directly to query fragments from MotiveExplorer or MotiveQuery service.

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

Fragment

Fragment(structureName: String) -> Fragment
Returns a structure represented as a fragment.
Note: This function cannot be used directly to query fragments from MotiveExplorer or MotiveQuery service.

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

GroupedAtoms

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

Arguments
symbols: String* - Allowed element symbols.
Examples
GroupedAtoms()
Returns groups of all atom types. For example if the input has atoms 5xC-1xO, fragments 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, fragments with 5xC and 1xO atoms are returned (but the H atoms are ignored).

ResidueSimilarity

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

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

ToFragment

ToFragment(fragments: FragmentSeq) -> Fragment
Converts a sequence of Fragments (FragmentSeq) to a single Fragment by merging all atoms into a single atom set. The Fragment type is required by some function such as AtomSimilarity.
Note: This function cannot be used directly to query fragments from MotiveExplorer or MotiveQuery service.

Arguments
fragments: FragmentSeq - Fragments to convert.
Examples
Residues("HIS").ToFragment()
Converts a sequence of HIS residue Fragments to a single Fragment.
AtomSimilarity(Current().Find(NotAtoms("N")).ToFragment(), Fragment("model").Find(NotAtoms("N")).ToFragment())
Computes the atom similarity of the 'current' and 'model' fragments, but ignores N atoms.


Value Functions

Functions such as addition or comparison of numbers.

Abs

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

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

Divide (/)

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 (==)

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

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 (>=)

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

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 (<=)

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 (&)

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)

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

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)

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

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

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

NotEqual (!=)

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 (+)

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 (^)

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

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 (*)

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.