Package uk.ac.cam.ch.wwmm.opsin
Class NameToStructure
- java.lang.Object
-
- uk.ac.cam.ch.wwmm.opsin.NameToStructure
-
public class NameToStructure extends java.lang.Object
The "master" class, to turn a name into a structure.- Author:
- ptc24, dl387
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 java.lang.String
getVersion()
Returns the version of the OPSIN libraryOpsinResult
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.java.lang.String
parseToCML(java.lang.String name)
Convenience method for converting a name to CML with OPSIN's default optionsjava.lang.String
parseToSmiles(java.lang.String name)
Convenience method for converting a name to SMILES with OPSIN's default options
-
-
-
Method Detail
-
getInstance
public static NameToStructure getInstance()
-
getVersion
public static java.lang.String getVersion()
Returns the version of the OPSIN library- Returns:
- Version number String
-
parseToCML
public java.lang.String 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 CML and SMILES representations may be retrieved directly from the object InChI may be generate using NameToInchi- Parameters:
name
- The chemical name to parse.n2sConfig
- Options to control how OPSIN interprets the name.- Returns:
- OpsinResult
-
getOpsinParser
public 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. 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:
- Opsin parser for recognition/parsing of a chemical word
-
-