1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
|
/**********************************************************************
logppsa.cpp - Unit tests for Open Babel OBLogP and OBPSA class
Copyright (C) 2007 Tim Vandermmeersch
This file is part of the Open Babel project.
For more information, see <http://openbabel.sourceforge.net/>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
***********************************************************************/
// used to set import/export for Cygwin DLLs
#ifdef WIN32
#define USING_OBDLL
#endif
#include <openbabel/babelconfig.h>
#include <openbabel/mol.h>
#include <openbabel/obconversion.h>
#include <openbabel/groupcontrib.h>
#include <stdio.h>
#include <iostream>
using namespace std;
using namespace OpenBabel;
int main(int argc,char *argv[])
{
// turn off slow sync with C-style output (we don't use it anyway).
std::ios::sync_with_stdio(false);
if (argc != 1)
{
cout << "Usage: logp_psa" << endl;
cout << " Unit tests for OBLogP and OBPSA " << endl;
return(-1);
}
cout << "# Unit tests for OBLogP and OBPSA \n";
// the number of tests for "prove"
cout << "1..7\n";
OBConversion obConversion;
obConversion.SetInAndOutFormats("smi", "mdl");
OBMol obMol;
OBDescriptor* obLogP = OBDescriptor::FindType("logP");
OBDescriptor* obPSA = OBDescriptor::FindType("TPSA");
double logP, psa;
cout << "ok 1\n"; // for loading tests
obConversion.ReadString(&obMol, "Oc1ccccc1OC");
obMol.AddHydrogens();
logP = obLogP->Predict(&obMol);
if (IsNear(logP , 1.4008)) { // value from JOELib2
cout << "ok 2 # " << logP << '\n';
} else {
cout << "not ok 2 # " << logP << '\n';
}
psa = obPSA->Predict(&obMol);
if (IsNear(psa , 29.46)) { // value from JOELib2
cout << "ok 3 # " << psa << '\n';
} else {
cout << "not ok 3 # " << psa << '\n';
}
obConversion.ReadString(&obMol, "c1ccccc1CBr");
obMol.AddHydrogens();
logP = obLogP->Predict(&obMol);
if (IsNear(logP, 2.5815)) { // Value from JOELib2
cout << "ok 4 # " << logP << '\n';
} else {
cout << "not ok 4 # " << logP << '\n';
}
psa = obPSA->Predict(&obMol);
if (IsNear(psa, 0.0)) { // Value from JOELib2
cout << "ok 5 # " << psa << '\n';
} else {
cout << "not ok 5 # " << psa << '\n';
}
obConversion.ReadString(&obMol, "Cc1ccccc1NC(=O)C");
obMol.AddHydrogens();
logP = obLogP->Predict(&obMol);
if (IsNear(logP, 2.0264)) { // JOELib2 = 1.9534, more H added on N
cout << "ok 6 # " << logP << '\n';
} else {
cout << "not ok 6 # " << logP << '\n';
}
psa = obPSA->Predict(&obMol);
if (IsNear(psa, 29.1)) { // Value from JOELib2
cout << "ok 7 # " << psa << '\n';
} else {
cout << "not ok 7 # " << psa << '\n';
}
return(0);
}
|