Subsections

 
8.17 OELingoSim

class OELingoSim

The OELingoSim object provides generic access to a fast one or more fast implementations of the lingo 2D similarity method (see Grant et al., JCIM, 46(5):1912 2006 and Vidal, Thormann and Pons, JCIM, 45(2):386 2005). The public api allows construction of an OELingoSim object based on a single molecule or string describing the molecule. Similarity between this original molecule and any subsequent molecule can then be rapidly calculated using another molecule or string.

8.17.1 Constructors

OELingoSim()

Default constructor. This constructor results in an object that reports OELingoSim::IsValid as false. This constructor is available as an implicit version of the const char * version below.

OELingoSim(const OEMolBase &mol, unsigned type = OELingoType::Default)

The molecule api for OELingoSim is provided as a convenience for users. It is significantly slower than using the string-based api. It also provides less flexibility because the strings are generated inside the object and thus limited to a specific string type. That detail aside, they are useful for all but the most cpu demanding tasks and take care of critical details that must be handled externally by users of the string apis. For the lingo type, please see the OELingoType namespace below.

OELingoSim(const char *str=0, unsigned type = OELingoType::Default)
OELingoSim(const std::string &str, unsigned type = OELingoType::Default)

The string api for OELingoSim allows use of any string in both construction and similarity testing. While canonical or isomeric SMILES are the most common string to be used, there is absolutely no requirement to use these strings in generating lingos comparisons. The one critical point is that care must be taken to assure that you are consistent in the type of string you pass to this api whether it be canonical SMILES, isomeric SMILES, IUPAC names or something else. For the lingo type, please see the OELingoType namespace below.

OELingoSim(const OELingoSim &rhs)

Copy constructor.

8.17.2 OELingoType

namespace OELingoType
{
  const unsigned Undefined = 0;
  const unsigned IsoSmiMap = 1;
  const unsigned Default   = 1;
}

These namespace memebers can be passed into the OELingoSim constructors to specify the type of implementation used to carry out the lingos comparison. These can be used to determine the type of string used with the molecule api (see below) as well as the mechanism with which the lingos comparisons are calculated.

The OELingoType::IsoSmiMap implementation (default) perceives atom and bond stereo on the molecule and then generates a smiles string with the OECreateIsoSmiString function call when using the molecule api.

unsigned GetType() const

This function returns the unsigned int matching the value from the OELingoType namespace that reflects the type of implementation being used in the OELingoSim object.

8.17.3 operator =

OELingoSim& operator = (const OELingoSim &rhs)

Assignment operator. This method makes a copy of an existing OELingoSim instance.

8.17.4 IsValid

bool IsValid() const

This method is used to test for successful initialization of an OELingoSim object. If initialization was attempted with an invalid molecule, a string shorter than 4 characters, or was default constructedit will not be valid. Similarity of any object to an invalid OELingoSim will always be 0.0.

8.17.5 Init

bool Init(const OEMolBase &mol)
bool Init(const char *str)
bool Init(const std::string & str)

These three initialization functions are designed to put an OELingoSim object into the same state as though they were just constructed with the same constructor arguments. The single caveat is that the implementation type, which can be set in the constructor, is unchanged by the OELingoSim::Init functions.

8.17.6 Similarity

float Similarity(const OEMolBase &mol) const
float Similarity(const char *str) const
float Similarity(const std::string &cansmi) const

These three functions report the lingos similarity between the molecule or string used to create the OELingoSim object and the molecule or string passed into the OELingoSim::Similarity function. The OEMolBase api is provided for convenience, and is suitable for most uses, but is somewhat less efficient than comparing strings directly. Any string may be used (canonical SMILES, isomeric SMILES, IUPAC names) in the string api, but care must be taken to make sure consistent string types are passed to the constructors and similarity functions!

8.17.7 Implementation

OELingoSimImpl       *GetImpl();
const OELingoSimImpl *GetImpl() const;
void SetImpl(const OELingoSimImpl &impl);

These functions allow access to the private OELingoSimImpl implementation class. The details of this class are private and subject to change. Also see the OELingoSim::GetType and the OELingoType namespace above.