Standardizer Developer's Guide

Version 5.8.2

Contents

 

Introduction

Standardizer brings molecules to a standardized form by applying standardization actions to the molecules. These actions are specified in a configuration XML or in a simple action string.

 

Architecture

Using the Standardizer API is fairly simple:

  1. First create a Standardizer object by any of its constructors, but typically you will use Standardizer(File file) with a configuration file or Standardizer(String str) with a configuration XML string or a simple action string.

  2. Optionally you can add a final clean action to recalculate coordinates of changed atoms only or else to perform full clean in a specified dimension or in the original molecule dimension by calling one of setFinalClean(), setFinalClean(int dim), setFinalClean(int dim, boolean partial), or setFinalClean(int dim, boolean partial, boolean optional).

  3. Then call standardize(Molecule) to standardize a single molecule or standardize(Molecule[]) to standardize an array of molecules by actions specified in the configuration.

  4. You can call getAppliedTaskIndexes() or getAppliedTaskIDs() to get the task indexes / IDs of Standardizer actions that modified the previously standardized molecule.
 

Example

API usage examples can be found in the Standardizer class header.

In the example code below, we demonstrate a typical usage of Standardizer:

    // create Standardizer with XML configuration file
    Standardizer standardizer = new Standardizer(new File("config.xml"));

    // set final clean action to arranged changed atoms
    standardizer.setFinalClean();

    MolExporter exporter = new MolExporter(System.out, "sdf");
    MolImporter importer = new MolImporter("mols.sdf");
    Molecule mol = null;
    while ((mol = importer.read()) != null) {

        // standardize molecule
	standardizer.standardize(mol);

        // get applied task indexes
	int[] inds = standardizer.getAppliedTaskIndexes();

	// get applied task IDs
	String[] ids = standardizer.getAppliedTaskIDs();

	// store applied task indexes and IDs in molecule properties
	String indsprop = "";
	for (int i=0; i < inds.length; ++i) {
	    indsprop += inds[i] + " ";
	}
	String idsprop = "";
	for (int i=0; i < ids.length; ++i) {
	    idsprop += ids[i] + " ";
	}
	mol.setProperty("TASK_INDEXES", indsprop);
	mol.setProperty("TASK_IDS", idsprop);

	// write output
	exporter.write(mol);
    }
    importer.close();
    exporter.close();

In this example we write the standardized molecules in SDF format with applied task indexes and IDs set in molecule properties.

Do you have a question? Would you like to learn more? Please browse among the related topics on our support forum or search the website. If you want to suggest modifications or improvements to our documentation email our support directly!