4.1.3. Config

class mod.LabelType

Selector for which type of label to use in algorithms.

String

Vertices and edges are considered to be labelled with character strings. If only first-order terms are present, then strings are generated as a serialisation of the term.

Term

Vertices and edges are considered to be labelled with first-order terms. If only strings are present, then first-order terms are generated by parsing the strings. This may result in an TermParsingError if a string can not be parsed.

class mod.LabelRelation

Selector for which type of labelled morphism to use in an algorithm. For strings they are all defined to be equivalent to string equality.

Isomorphism

Terms are considered isomorphic when their most general unifier is a renaming.

Specialisation

A term \(t_2\) is more special than, or isomorphic to, a term \(t_1\) if there is a substitution which can be applied to :math: t_1 to make the terms equal. This relation means that the right-hand side of a comparison is the more specialised term.

Unification

Terms unify if a most general unifier (MGU) exists. The found MGU is used for substitution in some algorithms.

class mod.LabelSettings

A group label settings commonly used together in algorithms.

__init__(type, relation)
__init__(type, relation, stereoRelation)
__init__(type, relation, withStereo, stereoRelation)

Construct label settings that only uses at least the vertex and edge labels. If stereoRelation is given but withStereo is not, then withStereo defaults to True.

Parameters:
  • type (LabelType) – How to interpret labels.

  • relation (LabelRelation) – The relation that should hold in morphisms between two labels.

  • withStereo (bool) – A flag to specify if stereo information should be included. Defaults to False, unless stereoRelation is given, then True.

  • stereoRelation (LabelRelation) – The relation that should hold in morphisms between stereo data. Defaults to LabelRelation.Isomorphism, but is only used when withStereo is True.

type
Type:

LabelType

relation
Type:

LabelRelation

withStereo
Type:

bool

stereoRelation
Type:

LabelRelation

class mod.IsomorphismPolicy

For some functions there is a choice of how to handle given arguments where two different objects may be isomorphic. Most notably the case is with graphs (Graph).

Check

Objects are checked for isomorphism as needed and exceptions are thrown when different objects are isomorphic. If in doubt, use this.

TrustMe

No checks are performed and the function trusts the caller to have performed the equivalent isomorphism checks. Only use this when you are completely sure that no exceptions would have been thrown if using Check.

Warning

Generally the library has undefined behaviour if you use this option but an exception would have been thrown with Check.

class mod.SmilesClassPolicy

When loading SMILES strings, the class labels can be recorded and mapped into the corresponding vertices of the loaded graph. This policy dictates what should happen when the same class label is written on multiple atoms.

AllOrNone

If a class label is duplicated, then no labels are mapped to vertices.

ThrowOnDuplicate

If a class label is duplicated, throw a InputError.

MapUnique

Map all class labels that are unique to vertices.

class mod.Action

Utility enum for deciding what to do in certain cases.

Error

Abort the function and produce an error message, e.g., through and exception.

Warn

Write a warning, but otherwise do as if it was Ignore.

Ignore

Ignore the case. The function taking the action as argument should describe what this means.

class mod.MDLOptions

An aggregation of options for the various loading functions for MDL formats. Generally each option is defaulted to follow the specification of the formats, unless it is harmless to deviate (e.g., relaxed white-space parsing).

addHydrogens = True

Use the MDL valence model to add hydrogens to atoms with default valence, or disable all hydrogen addition.

Type:

bool

allowAbstract = False

Allow non-standard atom symbols. The standard symbols are the element symbols and those specifying wildcard atoms.

Type:

bool

applyV2000AtomAliases = True

In MOL V2000 CTAB blocks, replace atom labels by their aliases. After application, the atom is considered abstract without errors, and hydrogen addition is suppressed.

Type:

bool

Action onPatternIsotope = Action::Error
Action onPatternCharge = Action::Error;
Action onPatternRadical = Action::Error;

What to do when an atom with symbol * has an isotope, charge, or radical. Action.Ignore means assuming the isotope, charge, or radical was not there.

onImplicitValenceOnAbstract = Action.Error

What to do when addHydrogens and allowAbstract and an abstract atom is encountered with implicit valence. Action.Ignore means adding no hydrogens.

Type:

Action

onV2000UnhandledProperty = Action.Warn

What to do when a property line in a V2000 MOL file is not recognized. Action.Ignore means simply ignoring that particular line.

Type:

Action

fullyIgnoreV2000UnhandledKnownProperty = False

Warnings are usually stored as “loading warnings”, even when they are ignored as during parsing. Setting this to True will act as if onV2000UnhandledProperty = Actions::Ignore and skip the storage, but only for a pre-defined known subset of properties.

Type:

bool

onV3000UnhandledAtomProperty = Action.Warn

What to do when a property in atom line in a V3000 MOL file is not recognized. Action.Ignore means simply ignoring that particular property.

Type:

Action

onV2000Charge4 = Action.Warn

What to do when an atom in a V2000 MOL file has the charge 4 (doublet radical).

Type:

Action

onV2000AbstractISO = Action.Warn

What to do when an abstract atom in a V2000 MOL file has a non-default ISO or mass difference value.

Type:

Action

onRAD1 = Action.Error
onRAD3 = Action.Error
onRAD4 = Action.Error
onRAD5 = Action.Error
onRAD6 = Action.Error

What to do when an atom has assigned the indicated radical state. Action.Ignore means pretending the atom has no radical state assigned.

Type:

Action

onUnsupportedQueryBondType = Action.Error

What to do when a bond type 5, 6, or 7 are encountered (constrained query bond types). Action.Ignore means assigning a term variable, as if the type was 8.

Type:

Action

class mod.Config

This class contains a range of inner classes of config settings. See the libMØD documentation.

mod.config

This variable is initialised to the return value of getConfig(), i.e., just use this instead of the method.

mod.getConfig()
Returns:

the singleton Config instance used by the library.