uk.ac.cam.ch.wwmm.opsin
Class NameToStructure

java.lang.Object
  extended by uk.ac.cam.ch.wwmm.opsin.NameToStructure

public class NameToStructure
extends java.lang.Object

The "master" class, to turn a name into a structure.


Method Summary
static NameToStructure getInstance()
           
static ParseRules getOpsinParser()
          Returns an OPSIN parser This can be used to determine whether a word can be interpreted as being part of a chemical name.
static void main(java.lang.String[] args)
          Run OPSIN as a command-line application.
 OpsinResult parseChemicalName(java.lang.String name)
          Parses a chemical name, returning an OpsinResult which represents the molecule.
 OpsinResult parseChemicalName(java.lang.String name, NameToStructureConfig n2sConfig)
          Parses a chemical name, returning an OpsinResult which represents the molecule.
 nu.xom.Element parseToCML(java.lang.String name)
          Convenience method for converting a name to CML with OPSIN's default options
 java.lang.String parseToSmiles(java.lang.String name)
          Convenience method for converting a name to SMILES with OPSIN's default options
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static NameToStructure getInstance()
                                   throws NameToStructureException
Throws:
NameToStructureException

parseToCML

public nu.xom.Element parseToCML(java.lang.String name)
Convenience method for converting a name to CML with OPSIN's default options

Parameters:
name - The chemical name to parse.
Returns:
A CML element, containing the parsed molecule, or null if the name was uninterpretable.

parseToSmiles

public java.lang.String parseToSmiles(java.lang.String name)
Convenience method for converting a name to SMILES with OPSIN's default options

Parameters:
name - The chemical name to parse.
Returns:
A SMILES string describing the parsed molecule, or null if the name was uninterpretable.

parseChemicalName

public OpsinResult parseChemicalName(java.lang.String name)
Parses a chemical name, returning an OpsinResult which represents the molecule. This object contains in the status whether the name was parsed successfully A message which may contain additional information if the status was warning/failure The OpsinResult has methods to generate a SMILES or CML representation For InChI, the OpsinResult should be given to the NameToInchi class

Parameters:
name - The chemical name to parse.
Returns:
OpsinResult

parseChemicalName

public OpsinResult parseChemicalName(java.lang.String name,
                                     NameToStructureConfig n2sConfig)
Parses a chemical name, returning an OpsinResult which represents the molecule. This object contains in the status whether the name was parsed successfully A message which may contain additional information if the status was warning/failure A CML representation of the structure

Parameters:
name - The chemical name to parse.
n2sConfig - Options to control how OPSIN interprets the name.
Returns:
OpsinResult

getOpsinParser

public static ParseRules getOpsinParser()
                                 throws NameToStructureException
Returns an OPSIN parser This can be used to determine whether a word can be interpreted as being part of a chemical name. Just because a word can be split into tokens does not mean the word constitutes a valid chemical name e.g. ester is interpretable but is not in itself a chemical name

Returns:
Throws:
NameToStructureException

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Run OPSIN as a command-line application.

Parameters:
args -
Throws:
java.lang.Exception