mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
Some cartridge additions and fixes (#4387)
* update some expected results that changed with previous fixes * Fixes #4386 * try to actually generate an error when the cartridge tests fail * update azure pipelines cartridge builds * ensure psql dev env is there temporarily disable other azure pipelines builds * psql version * gather info * gather info * gather info * gather info * gather info * more descriptors * try forcing psql12 * remove the package correctly * remove the package correctly * remove the package correctly * sooo much fun * sooooo much fun * seems to be working now, enable the others * support v3k output in cartridge * tests do not pass * docs * update expected tests
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
steps:
|
||||
- bash: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libboost-all-dev postgresql-10 postgresql-server-dev-10
|
||||
sudo service postgresql start
|
||||
#sudo su postgres
|
||||
sudo apt-get remove postgresql postgresql-13 postgresql-client-13 postgresql-common postgresql-client-common
|
||||
sudo apt purge postgresql postgresql-13 postgresql-client-13 postgresql-common postgresql-client-common
|
||||
sudo apt-get install -y libboost-all-dev postgresql-common postgresql-12 postgresql-server-dev-12
|
||||
echo "add user"
|
||||
sudo -u postgres createuser -s `whoami`
|
||||
displayName: Setup build environment
|
||||
- bash: |
|
||||
@@ -37,6 +38,7 @@ steps:
|
||||
if [ -e ./Code/PgSQL/rdkit/regression.diffs ]
|
||||
then
|
||||
cat ./Code/PgSQL/rdkit/regression.diffs
|
||||
exit 1
|
||||
fi
|
||||
displayName: Run tests
|
||||
|
||||
|
||||
@@ -352,7 +352,11 @@ extern "C" char *makeMolText(CROMol data, int *len, bool asSmarts,
|
||||
StringData = MolToCXSmiles(*mol);
|
||||
}
|
||||
} else {
|
||||
StringData = MolToSmarts(*mol, false);
|
||||
if (!cxSmiles) {
|
||||
StringData = MolToSmarts(*mol, false);
|
||||
} else {
|
||||
StringData = MolToCXSmarts(*mol);
|
||||
}
|
||||
}
|
||||
} catch (...) {
|
||||
ereport(
|
||||
@@ -367,14 +371,18 @@ extern "C" char *makeMolText(CROMol data, int *len, bool asSmarts,
|
||||
}
|
||||
|
||||
extern "C" char *makeCtabText(CROMol data, int *len,
|
||||
bool createDepictionIfMissing) {
|
||||
bool createDepictionIfMissing, bool useV3000) {
|
||||
auto *mol = (ROMol *)data;
|
||||
|
||||
try {
|
||||
if (createDepictionIfMissing && mol->getNumConformers() == 0) {
|
||||
RDDepict::compute2DCoords(*mol);
|
||||
}
|
||||
StringData = MolToMolBlock(*mol);
|
||||
if (!useV3000) {
|
||||
StringData = MolToMolBlock(*mol);
|
||||
} else {
|
||||
StringData = MolToV3KMolBlock(*mol);
|
||||
}
|
||||
} catch (...) {
|
||||
ereport(WARNING,
|
||||
(errcode(ERRCODE_WARNING),
|
||||
@@ -571,7 +579,9 @@ extern "C" int MolSubstructCount(CROMol i, CROMol a, bool uniquify) {
|
||||
}
|
||||
MOLDESCR(FractionCSP3, RDKit::Descriptors::calcFractionCSP3, double)
|
||||
MOLDESCR(TPSA, RDKit::Descriptors::calcTPSA, double)
|
||||
MOLDESCR(LabuteASA, RDKit::Descriptors::calcLabuteASA, double)
|
||||
MOLDESCR(AMW, RDKit::Descriptors::calcAMW, double)
|
||||
MOLDESCR(ExactMW, RDKit::Descriptors::calcExactMW, double)
|
||||
MOLDESCR(HBA, RDKit::Descriptors::calcLipinskiHBA, int)
|
||||
MOLDESCR(HBD, RDKit::Descriptors::calcLipinskiHBD, int)
|
||||
MOLDESCR(NumHeteroatoms, RDKit::Descriptors::calcNumHeteroatoms, int)
|
||||
@@ -592,6 +602,9 @@ MOLDESCR(NumAliphaticCarbocycles,
|
||||
MOLDESCR(NumSaturatedCarbocycles,
|
||||
RDKit::Descriptors::calcNumSaturatedCarbocycles, int)
|
||||
MOLDESCR(NumHeterocycles, RDKit::Descriptors::calcNumHeterocycles, int)
|
||||
MOLDESCR(NumSpiroAtoms, RDKit::Descriptors::calcNumSpiroAtoms, int)
|
||||
MOLDESCR(NumBridgeheadAtoms, RDKit::Descriptors::calcNumBridgeheadAtoms, int)
|
||||
MOLDESCR(NumAmideBonds, RDKit::Descriptors::calcNumAmideBonds, int)
|
||||
|
||||
MOLDESCR(NumRotatableBonds, RDKit::Descriptors::calcNumRotatableBonds, int)
|
||||
MOLDESCR(Chi0v, RDKit::Descriptors::calcChi0v, double)
|
||||
@@ -607,9 +620,8 @@ MOLDESCR(Chi4n, RDKit::Descriptors::calcChi4n, double)
|
||||
MOLDESCR(Kappa1, RDKit::Descriptors::calcKappa1, double)
|
||||
MOLDESCR(Kappa2, RDKit::Descriptors::calcKappa2, double)
|
||||
MOLDESCR(Kappa3, RDKit::Descriptors::calcKappa3, double)
|
||||
MOLDESCR(HallKierAlpha, RDKit::Descriptors::calcHallKierAlpha, double)
|
||||
MOLDESCR(Phi, RDKit::Descriptors::calcPhi, double)
|
||||
MOLDESCR(NumSpiroAtoms, RDKit::Descriptors::calcNumSpiroAtoms, int)
|
||||
MOLDESCR(NumBridgeheadAtoms, RDKit::Descriptors::calcNumBridgeheadAtoms, int)
|
||||
|
||||
extern "C" double MolLogP(CROMol i) {
|
||||
double logp, mr;
|
||||
|
||||
@@ -26,21 +26,21 @@ select mol_inchi(mol_from_ctab((Chr(10) || Chr(10) || Chr(10) ||
|
||||
' 0 0 0 0 0 0 0 0 0 0999 V2000' ||
|
||||
Chr(10) ||
|
||||
'M END')::cstring));
|
||||
mol_inchi
|
||||
------------
|
||||
InChI=1S//
|
||||
mol_inchi
|
||||
-----------
|
||||
|
||||
(1 row)
|
||||
|
||||
select mol_inchi('');
|
||||
mol_inchi
|
||||
------------
|
||||
InChI=1S//
|
||||
mol_inchi
|
||||
-----------
|
||||
|
||||
(1 row)
|
||||
|
||||
select mol_inchikey('');
|
||||
mol_inchikey
|
||||
-----------------------------
|
||||
MOSFIJXAXDLOML-UHFFFAOYSA-N
|
||||
mol_inchikey
|
||||
--------------
|
||||
|
||||
(1 row)
|
||||
|
||||
select mol_inchi('CC1=NC=CN1'::mol);
|
||||
|
||||
@@ -5,6 +5,12 @@ SELECT mol_amw('c1ccccc1'::mol) mol_amw;
|
||||
78.114
|
||||
(1 row)
|
||||
|
||||
SELECT mol_exactmw('c1ccccc1'::mol) mol_exactmw;
|
||||
mol_exactmw
|
||||
-------------
|
||||
78.047
|
||||
(1 row)
|
||||
|
||||
SELECT mol_logp('c1ccccc1'::mol) mol_logp;
|
||||
mol_logp
|
||||
----------
|
||||
@@ -161,6 +167,18 @@ SELECT mol_phi('CC(C)(C)C(C)C'::mol) v;
|
||||
1.85185
|
||||
(1 row)
|
||||
|
||||
SELECT mol_hallkieralpha('CC(O)(C)C(C)C'::mol) v;
|
||||
v
|
||||
-------
|
||||
-0.04
|
||||
(1 row)
|
||||
|
||||
SELECT mol_numamidebonds('O=C(C)NC'::mol) v;
|
||||
v
|
||||
---
|
||||
1
|
||||
(1 row)
|
||||
|
||||
-- Mol formula tests - SQL equivalents of tests in testMolDescriptors.py.
|
||||
select mol_formula('[2H]C([3H])O'::mol);
|
||||
mol_formula
|
||||
@@ -256,6 +274,12 @@ SELECT mol_tpsa('CCO'::mol) val;
|
||||
20.23
|
||||
(1 row)
|
||||
|
||||
SELECT mol_labuteasa('CCC'::mol) val;
|
||||
val
|
||||
---------
|
||||
21.4691
|
||||
(1 row)
|
||||
|
||||
SELECT mol_numrings('CCC'::mol) val;
|
||||
val
|
||||
-----
|
||||
|
||||
@@ -496,6 +496,53 @@ M END', true));
|
||||
|
||||
(1 row)
|
||||
|
||||
-- mol_to_ctab() - force v3000.
|
||||
select mol_to_ctab(mol('CCC'), false, true);
|
||||
mol_to_ctab
|
||||
------------------------------------------
|
||||
+
|
||||
RDKit 2D +
|
||||
+
|
||||
0 0 0 0 0 0 0 0 0 0999 V3000 +
|
||||
M V30 BEGIN CTAB +
|
||||
M V30 COUNTS 3 2 0 0 0 +
|
||||
M V30 BEGIN ATOM +
|
||||
M V30 1 C 0.000000 0.000000 0.000000 0 +
|
||||
M V30 2 C 1.299038 0.750000 0.000000 0 +
|
||||
M V30 3 C 2.598076 -0.000000 0.000000 0+
|
||||
M V30 END ATOM +
|
||||
M V30 BEGIN BOND +
|
||||
M V30 1 1 1 2 +
|
||||
M V30 2 1 2 3 +
|
||||
M V30 END BOND +
|
||||
M V30 END CTAB +
|
||||
M END +
|
||||
|
||||
(1 row)
|
||||
|
||||
select mol_to_v3kctab(mol('CCC'), false);
|
||||
mol_to_v3kctab
|
||||
------------------------------------------
|
||||
+
|
||||
RDKit 2D +
|
||||
+
|
||||
0 0 0 0 0 0 0 0 0 0999 V3000 +
|
||||
M V30 BEGIN CTAB +
|
||||
M V30 COUNTS 3 2 0 0 0 +
|
||||
M V30 BEGIN ATOM +
|
||||
M V30 1 C 0.000000 0.000000 0.000000 0 +
|
||||
M V30 2 C 1.299038 0.750000 0.000000 0 +
|
||||
M V30 3 C 2.598076 -0.000000 0.000000 0+
|
||||
M V30 END ATOM +
|
||||
M V30 BEGIN BOND +
|
||||
M V30 1 1 1 2 +
|
||||
M V30 2 1 2 3 +
|
||||
M V30 END BOND +
|
||||
M V30 END CTAB +
|
||||
M END +
|
||||
|
||||
(1 row)
|
||||
|
||||
select all_values_lt(torsion_fp('c1ccccc1C'::mol),2);
|
||||
all_values_lt
|
||||
---------------
|
||||
@@ -1155,6 +1202,18 @@ SELECT mol_to_cxsmiles(mol_from_smiles('C[C@H](F)[C@H](C)[C@@H](C)Br |a:1,o1:4,5
|
||||
C[C@H](F)[C@H](C)[C@@H](C)Br |a:1,o1:4,5|
|
||||
(1 row)
|
||||
|
||||
SELECT mol_to_cxsmarts(mol_from_smiles('C[C@H](F)[C@H](C)[C@@H](C)Br |a:1,o1:4,5|'));
|
||||
mol_to_cxsmarts
|
||||
--------------------------------------------------------------------
|
||||
[#6]-[#6@H](-[#9])-[#6@H](-[#6])-[#6@@H](-[#6])-[#35] |a:1,o1:4,5|
|
||||
(1 row)
|
||||
|
||||
SELECT mol_to_cxsmarts(mol_from_smarts('C[C@H]([F,Cl,Br])[C@H](C)[C@@H](C)Br |a:1,o1:4,5|'));
|
||||
mol_to_cxsmarts
|
||||
------------------------------------------------------------------
|
||||
C[C@&H1](-,:[F,Cl,Br])[C@&H1](-,:C)[C@@&H1](-,:C)Br |a:1,o1:4,5|
|
||||
(1 row)
|
||||
|
||||
-- CXSmiles from mol_out
|
||||
SELECT mol_out(mol_from_smiles('C[C@H](F)[C@H](C)[C@@H](C)Br |a:1,o1:4,5|'));
|
||||
mol_out
|
||||
|
||||
@@ -20,15 +20,15 @@ SELECT reaction_from_smiles('c1ccccc1>CC(=O)O>c1cccnc1');
|
||||
(1 row)
|
||||
|
||||
SELECT reaction_from_smarts('[c1:1][c:2][c:3][c:4]c[c1:5]>CC(=O)O>[c1:1][c:2][c:3][c:4]n[c1:5]');
|
||||
reaction_from_smarts
|
||||
---------------------------------------------------------------------------------
|
||||
c([cH:4][cH:3][cH:2][cH2:1])[cH2:5]>CC(=O)O>n([cH:4][cH:3][cH:2][cH2:1])[cH2:5]
|
||||
reaction_from_smarts
|
||||
-------------------------------------------------------------------
|
||||
c([c:4][c:3][c:2][c:1])[c:5]>CC(O)=O>n([c:4][c:3][c:2][c:1])[c:5]
|
||||
(1 row)
|
||||
|
||||
SELECT reaction_from_smarts('C(F)(F)F.[c1:1][c:2][c:3][c:4]c[c1:5]>CC(=O)O>[c1:1][c:2][c:3][c:4]n[c1:5]');
|
||||
reaction_from_smarts
|
||||
----------------------------------------------------------------------------------------
|
||||
c([cH:4][cH:3][cH:2][cH2:1])[cH2:5]>CC(=O)O.FC(F)F>n([cH:4][cH:3][cH:2][cH2:1])[cH2:5]
|
||||
reaction_from_smarts
|
||||
--------------------------------------------------------------------------
|
||||
c([c:4][c:3][c:2][c:1])[c:5]>CC(O)=O.FC(F)F>n([c:4][c:3][c:2][c:1])[c:5]
|
||||
(1 row)
|
||||
|
||||
SELECT reaction_from_smarts('c1ccc[n,c]c1>>c1nccnc1');
|
||||
|
||||
@@ -154,8 +154,10 @@ Datum mol_substruct_count(PG_FUNCTION_ARGS) {
|
||||
}
|
||||
|
||||
MOLDESCR(amw, MolAMW, FLOAT4)
|
||||
MOLDESCR(exactmw, MolExactMW, FLOAT4)
|
||||
MOLDESCR(logp, MolLogP, FLOAT4)
|
||||
MOLDESCR(tpsa, MolTPSA, FLOAT4)
|
||||
MOLDESCR(labuteasa, MolLabuteASA, FLOAT4)
|
||||
MOLDESCR(hba, MolHBA, INT32)
|
||||
MOLDESCR(hbd, MolHBD, INT32)
|
||||
MOLDESCR(numatoms, MolNumAtoms, INT32)
|
||||
@@ -173,6 +175,7 @@ MOLDESCR(numaromaticcarbocycles, MolNumAromaticCarbocycles, INT32)
|
||||
MOLDESCR(numaliphaticcarbocycles, MolNumAliphaticCarbocycles, INT32)
|
||||
MOLDESCR(numsaturatedcarbocycles, MolNumSaturatedCarbocycles, INT32)
|
||||
MOLDESCR(numheterocycles, MolNumHeterocycles, INT32)
|
||||
MOLDESCR(numamidebonds, MolNumAmideBonds, INT32)
|
||||
|
||||
MOLDESCR(fractioncsp3, MolFractionCSP3, FLOAT4)
|
||||
MOLDESCR(chi0n, MolChi0n, FLOAT4)
|
||||
@@ -188,6 +191,7 @@ MOLDESCR(chi4v, MolChi4v, FLOAT4)
|
||||
MOLDESCR(kappa1, MolKappa1, FLOAT4)
|
||||
MOLDESCR(kappa2, MolKappa2, FLOAT4)
|
||||
MOLDESCR(kappa3, MolKappa3, FLOAT4)
|
||||
MOLDESCR(hallkieralpha, MolHallKierAlpha, FLOAT4)
|
||||
MOLDESCR(phi, MolPhi, FLOAT4)
|
||||
|
||||
MOLDESCR(numspiroatoms, MolNumSpiroAtoms, INT32)
|
||||
|
||||
@@ -105,7 +105,8 @@ CROMol parseMolText(char *data, bool asSmarts, bool warnOnFail, bool asQuery);
|
||||
CROMol parseMolCTAB(char *data, bool keepConformer, bool warnOnFail,
|
||||
bool asQuery);
|
||||
char *makeMolText(CROMol data, int *len, bool asSmarts, bool cxSmiles);
|
||||
char *makeCtabText(CROMol data, int *len, bool createDepictionIfMissing);
|
||||
char *makeCtabText(CROMol data, int *len, bool createDepictionIfMissing,
|
||||
bool useV3000);
|
||||
const char *makeMolJSON(CROMol data);
|
||||
CROMol parseMolJSON(char *data, bool warnOnFail);
|
||||
|
||||
@@ -122,6 +123,7 @@ int MolSubstructCount(CROMol i, CROMol a, bool uniquify);
|
||||
bytea *makeMolSignature(CROMol data);
|
||||
|
||||
double MolAMW(CROMol i);
|
||||
double MolExactMW(CROMol i);
|
||||
double MolLogP(CROMol i);
|
||||
int MolHBA(CROMol i);
|
||||
int MolHBD(CROMol i);
|
||||
@@ -140,9 +142,11 @@ int MolNumAromaticCarbocycles(CROMol i);
|
||||
int MolNumAliphaticCarbocycles(CROMol i);
|
||||
int MolNumSaturatedCarbocycles(CROMol i);
|
||||
int MolNumHeterocycles(CROMol i);
|
||||
int MolNumAmideBonds(CROMol i);
|
||||
|
||||
double MolFractionCSP3(CROMol i);
|
||||
double MolTPSA(CROMol i);
|
||||
double MolLabuteASA(CROMol i);
|
||||
double MolChi0v(CROMol i);
|
||||
double MolChi1v(CROMol i);
|
||||
double MolChi2v(CROMol i);
|
||||
@@ -157,6 +161,7 @@ double MolKappa1(CROMol i);
|
||||
double MolKappa2(CROMol i);
|
||||
double MolKappa3(CROMol i);
|
||||
double MolPhi(CROMol i);
|
||||
double MolHallKierAlpha(CROMol i);
|
||||
|
||||
int MolNumSpiroAtoms(CROMol i);
|
||||
int MolNumBridgeheadAtoms(CROMol i);
|
||||
|
||||
@@ -231,7 +231,19 @@ RETURNS cstring
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE C STRICT IMMUTABLE;
|
||||
|
||||
CREATE OR REPLACE FUNCTION mol_to_ctab(mol,bool default true)
|
||||
CREATE OR REPLACE FUNCTION mol_to_cxsmarts(mol)
|
||||
RETURNS cstring
|
||||
@RDKIT_PARALLEL_SAFE@
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE C STRICT IMMUTABLE;
|
||||
|
||||
CREATE OR REPLACE FUNCTION mol_to_ctab(mol,bool default true, bool default false)
|
||||
RETURNS cstring
|
||||
@RDKIT_PARALLEL_SAFE@
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE C STRICT IMMUTABLE;
|
||||
|
||||
CREATE OR REPLACE FUNCTION mol_to_v3kctab(mol,bool default true)
|
||||
RETURNS cstring
|
||||
@RDKIT_PARALLEL_SAFE@
|
||||
AS 'MODULE_PATHNAME'
|
||||
@@ -280,6 +292,12 @@ RETURNS cstring
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE C STRICT IMMUTABLE;
|
||||
|
||||
CREATE OR REPLACE FUNCTION mol_to_cxsmarts(qmol)
|
||||
RETURNS cstring
|
||||
@RDKIT_PARALLEL_SAFE@
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE C STRICT IMMUTABLE;
|
||||
|
||||
CREATE OR REPLACE FUNCTION mol_to_json(qmol)
|
||||
RETURNS cstring
|
||||
@RDKIT_PARALLEL_SAFE@
|
||||
@@ -451,6 +469,12 @@ RETURNS real
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE C STRICT IMMUTABLE;
|
||||
|
||||
CREATE OR REPLACE FUNCTION mol_exactmw(mol)
|
||||
RETURNS real
|
||||
@RDKIT_PARALLEL_SAFE@
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE C STRICT IMMUTABLE;
|
||||
|
||||
CREATE OR REPLACE FUNCTION mol_logp(mol)
|
||||
RETURNS real
|
||||
@RDKIT_PARALLEL_SAFE@
|
||||
@@ -469,6 +493,12 @@ RETURNS real
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE C STRICT IMMUTABLE;
|
||||
|
||||
CREATE OR REPLACE FUNCTION mol_labuteasa(mol)
|
||||
RETURNS real
|
||||
@RDKIT_PARALLEL_SAFE@
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE C STRICT IMMUTABLE;
|
||||
|
||||
CREATE OR REPLACE FUNCTION mol_chi0n(mol)
|
||||
RETURNS real
|
||||
@RDKIT_PARALLEL_SAFE@
|
||||
@@ -553,6 +583,12 @@ RETURNS real
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE C STRICT IMMUTABLE;
|
||||
|
||||
CREATE OR REPLACE FUNCTION mol_hallkieralpha(mol)
|
||||
RETURNS real
|
||||
@RDKIT_PARALLEL_SAFE@
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE C STRICT IMMUTABLE;
|
||||
|
||||
|
||||
-- mol integer descriptors
|
||||
|
||||
@@ -670,6 +706,12 @@ RETURNS int
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE C STRICT IMMUTABLE;
|
||||
|
||||
CREATE OR REPLACE FUNCTION mol_numamidebonds(mol)
|
||||
RETURNS int
|
||||
@RDKIT_PARALLEL_SAFE@
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE C STRICT IMMUTABLE;
|
||||
|
||||
|
||||
-- mol text descriptors
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <access/gist.h>
|
||||
#include <access/skey.h>
|
||||
#include <utils/memutils.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "rdkit.h"
|
||||
#include "guc.h"
|
||||
|
||||
@@ -218,6 +218,7 @@ mol_to_ctab(PG_FUNCTION_ARGS) {
|
||||
int len;
|
||||
|
||||
bool createDepictionIfMissing = PG_GETARG_BOOL(1);
|
||||
bool usev3000 = PG_GETARG_BOOL(2);
|
||||
|
||||
fcinfo->flinfo->fn_extra = searchMolCache(
|
||||
fcinfo->flinfo->fn_extra,
|
||||
@@ -225,7 +226,29 @@ mol_to_ctab(PG_FUNCTION_ARGS) {
|
||||
PG_GETARG_DATUM(0),
|
||||
NULL, &mol, NULL);
|
||||
|
||||
str = makeCtabText(mol, &len, createDepictionIfMissing);
|
||||
str = makeCtabText(mol, &len, createDepictionIfMissing, usev3000);
|
||||
|
||||
PG_RETURN_CSTRING( pnstrdup(str, len) );
|
||||
}
|
||||
|
||||
PGDLLEXPORT Datum mol_to_v3kctab(PG_FUNCTION_ARGS);
|
||||
PG_FUNCTION_INFO_V1(mol_to_v3kctab);
|
||||
Datum
|
||||
mol_to_v3kctab(PG_FUNCTION_ARGS) {
|
||||
CROMol mol;
|
||||
char *str;
|
||||
int len;
|
||||
|
||||
bool createDepictionIfMissing = PG_GETARG_BOOL(1);
|
||||
bool usev3000 = 1;
|
||||
|
||||
fcinfo->flinfo->fn_extra = searchMolCache(
|
||||
fcinfo->flinfo->fn_extra,
|
||||
fcinfo->flinfo->fn_mcxt,
|
||||
PG_GETARG_DATUM(0),
|
||||
NULL, &mol, NULL);
|
||||
|
||||
str = makeCtabText(mol, &len, createDepictionIfMissing, usev3000);
|
||||
|
||||
PG_RETURN_CSTRING( pnstrdup(str, len) );
|
||||
}
|
||||
@@ -284,6 +307,24 @@ mol_to_smarts(PG_FUNCTION_ARGS) {
|
||||
PG_RETURN_CSTRING( pnstrdup(str, len) );
|
||||
}
|
||||
|
||||
PGDLLEXPORT Datum mol_to_cxsmarts(PG_FUNCTION_ARGS);
|
||||
PG_FUNCTION_INFO_V1(mol_to_cxsmarts);
|
||||
Datum
|
||||
mol_to_cxsmarts(PG_FUNCTION_ARGS) {
|
||||
CROMol mol;
|
||||
char *str;
|
||||
int len;
|
||||
|
||||
fcinfo->flinfo->fn_extra = searchMolCache(
|
||||
fcinfo->flinfo->fn_extra,
|
||||
fcinfo->flinfo->fn_mcxt,
|
||||
PG_GETARG_DATUM(0),
|
||||
NULL, &mol, NULL);
|
||||
str = makeMolText(mol, &len,true,true);
|
||||
|
||||
PG_RETURN_CSTRING( pnstrdup(str, len) );
|
||||
}
|
||||
|
||||
PGDLLEXPORT Datum mol_from_pkl(PG_FUNCTION_ARGS);
|
||||
PG_FUNCTION_INFO_V1(mol_from_pkl);
|
||||
Datum
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
SET extra_float_digits=0;
|
||||
SELECT mol_amw('c1ccccc1'::mol) mol_amw;
|
||||
SELECT mol_exactmw('c1ccccc1'::mol) mol_exactmw;
|
||||
SELECT mol_logp('c1ccccc1'::mol) mol_logp;
|
||||
SELECT mol_hba('c1ccccc1'::mol) mol_hba;
|
||||
SELECT mol_hbd('c1ccccc1'::mol) mol_hbd;
|
||||
@@ -26,6 +27,8 @@ SELECT mol_numbridgeheadatoms('C1CCC2(C1)CC1CCC2CC1'::mol) v;
|
||||
SELECT mol_numspiroatoms('CC1(C)CC2(C)CCC1(C)CC2'::mol) v;
|
||||
SELECT mol_numbridgeheadatoms('CC1(C)CC2(C)CCC1(C)CC2'::mol) v;
|
||||
SELECT mol_phi('CC(C)(C)C(C)C'::mol) v;
|
||||
SELECT mol_hallkieralpha('CC(O)(C)C(C)C'::mol) v;
|
||||
SELECT mol_numamidebonds('O=C(C)NC'::mol) v;
|
||||
|
||||
|
||||
-- Mol formula tests - SQL equivalents of tests in testMolDescriptors.py.
|
||||
@@ -48,6 +51,7 @@ SELECT mol_numheteroatoms('CCC'::mol) val;
|
||||
SELECT mol_numheteroatoms('CCO'::mol) val;
|
||||
SELECT mol_tpsa('CCC'::mol) val;
|
||||
SELECT mol_tpsa('CCO'::mol) val;
|
||||
SELECT mol_labuteasa('CCC'::mol) val;
|
||||
SELECT mol_numrings('CCC'::mol) val;
|
||||
SELECT mol_numrings('C1CC1'::mol) val;
|
||||
SELECT mol_murckoscaffold('c1ccccc1CCC'::mol) val;
|
||||
|
||||
@@ -196,6 +196,9 @@ select mol_to_ctab(mol_from_ctab('chiral1.mol
|
||||
1 4 1 1
|
||||
1 5 1 0
|
||||
M END', true));
|
||||
-- mol_to_ctab() - force v3000.
|
||||
select mol_to_ctab(mol('CCC'), false, true);
|
||||
select mol_to_v3kctab(mol('CCC'), false);
|
||||
|
||||
select all_values_lt(torsion_fp('c1ccccc1C'::mol),2);
|
||||
select all_values_lt(torsion_fp('c1ccccc1C'::mol),3);
|
||||
@@ -392,6 +395,8 @@ select 'C1C([2H])C1CCCC'::mol @> mol_adjust_query_properties('C1CC1CC'::mol,'{"a
|
||||
-- CXSmiles
|
||||
SELECT mol_to_smiles(mol_from_smiles('C[C@H](F)[C@H](C)[C@@H](C)Br |a:1,o1:4,5|'));
|
||||
SELECT mol_to_cxsmiles(mol_from_smiles('C[C@H](F)[C@H](C)[C@@H](C)Br |a:1,o1:4,5|'));
|
||||
SELECT mol_to_cxsmarts(mol_from_smiles('C[C@H](F)[C@H](C)[C@@H](C)Br |a:1,o1:4,5|'));
|
||||
SELECT mol_to_cxsmarts(mol_from_smarts('C[C@H]([F,Cl,Br])[C@H](C)[C@@H](C)Br |a:1,o1:4,5|'));
|
||||
|
||||
-- CXSmiles from mol_out
|
||||
SELECT mol_out(mol_from_smiles('C[C@H](F)[C@H](C)[C@@H](C)Br |a:1,o1:4,5|'));
|
||||
|
||||
@@ -10,6 +10,30 @@ RETURNS real
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE C STRICT IMMUTABLE;
|
||||
|
||||
CREATE OR REPLACE FUNCTION mol_exactmw(mol)
|
||||
RETURNS real
|
||||
@RDKIT_PARALLEL_SAFE@
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE C STRICT IMMUTABLE;
|
||||
|
||||
CREATE OR REPLACE FUNCTION mol_labuteasa(mol)
|
||||
RETURNS real
|
||||
@RDKIT_PARALLEL_SAFE@
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE C STRICT IMMUTABLE;
|
||||
|
||||
CREATE OR REPLACE FUNCTION mol_hallkieralpha(mol)
|
||||
RETURNS real
|
||||
@RDKIT_PARALLEL_SAFE@
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE C STRICT IMMUTABLE;
|
||||
|
||||
CREATE OR REPLACE FUNCTION mol_numamidebonds(mol)
|
||||
RETURNS int
|
||||
@RDKIT_PARALLEL_SAFE@
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE C STRICT IMMUTABLE;
|
||||
|
||||
CREATE OR REPLACE FUNCTION substruct_count(mol, qmol, bool default true)
|
||||
RETURNS int
|
||||
@RDKIT_PARALLEL_SAFE@
|
||||
@@ -33,3 +57,37 @@ RETURNS mol
|
||||
@RDKIT_PARALLEL_SAFE@
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE C STRICT IMMUTABLE;
|
||||
|
||||
CREATE OR REPLACE FUNCTION mol_to_ctab(mol,bool default true, bool default false)
|
||||
RETURNS cstring
|
||||
@RDKIT_PARALLEL_SAFE@
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE C STRICT IMMUTABLE;
|
||||
|
||||
CREATE OR REPLACE FUNCTION mol_to_v3kctab(mol,bool default true)
|
||||
RETURNS cstring
|
||||
@RDKIT_PARALLEL_SAFE@
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE C STRICT IMMUTABLE;
|
||||
|
||||
CREATE OR REPLACE FUNCTION mol_to_cxsmiles(mol)
|
||||
RETURNS cstring
|
||||
@RDKIT_PARALLEL_SAFE@
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE C STRICT IMMUTABLE;
|
||||
|
||||
CREATE OR REPLACE FUNCTION mol_to_cxsmarts(mol)
|
||||
RETURNS cstring
|
||||
@RDKIT_PARALLEL_SAFE@
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE C STRICT IMMUTABLE;
|
||||
|
||||
CREATE OR REPLACE FUNCTION mol_to_cxsmarts(qmol)
|
||||
RETURNS cstring
|
||||
@RDKIT_PARALLEL_SAFE@
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE C STRICT IMMUTABLE;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -633,9 +633,12 @@ There are additional operators defined in the cartridge, but these are used for
|
||||
- qmol\_from\_smiles(smiles) : returns a query molecule for a SMILES string, NULL if the molecule construction fails. Explicit Hs in the SMILES are converted into query features on the attached atom.
|
||||
- qmol\_from\_ctab(ctab, bool default false) : returns a query molecule for a CTAB (mol block) string, NULL if the molecule construction fails. Explicit Hs in the SMILES are converted into query features on the attached atom. The optional second argument controls whether or not the molecule's coordinates are saved.
|
||||
- mol\_to\_smiles(mol) : returns the canonical SMILES for a molecule.
|
||||
- mol\_to\_cxsmiles(mol) : returns the CXSMILES for a molecule (*available from 2021\_09 release*).
|
||||
- mol\_to\_smarts(mol) : returns SMARTS string for a molecule.
|
||||
- mol\_to\_cxsmarts(mol) : returns the CXSMARTS for a molecule (*available from 2021\_09 release*).
|
||||
- mol\_to\_pkl(mol) : returns binary string (bytea) for a molecule. (*available from Q3 2012 (2012\_09) release*)
|
||||
- mol\_to\_ctab(mol,bool default true) : returns a CTAB (mol block) string for a molecule. The optional second argument controls whether or not 2D coordinates will be generated for molecules that don't have coordinates. (*available from the 2014\_03 release*)
|
||||
- mol\_to\_ctab(mol,bool default true, bool default false) : returns a CTAB (mol block) string for a molecule. The optional second argument controls whether or not 2D coordinates will be generated for molecules that don't have coordinates. The optional third argument (available since the 2021\_09 release) controls whether or not a V3000 ctab should be generated.
|
||||
- mol\_to\_v3kctab(mol,bool default true) : returns a CTAB (mol block) string for a molecule. The optional second argument controls whether or not 2D coordinates will be generated for molecules that don't have coordinates (*available from 2021\_09 release*).
|
||||
- mol\_to\_svg(mol,string default '',int default 250, int default 200, string default '') : returns an SVG with a drawing of the molecule. The optional parameters are a string to use as the legend, the width of the image, the height of the image, and a JSON with additional rendering parameters. (*available from the 2016\_09 release*)
|
||||
- mol\_to\_json(string) : returns the commonchem JSON for a molecule. (*available from the 2021\_09 release*)
|
||||
- mol\_from\_json(string) : returns a molecule for a commonchem JSON string, NULL if the molecule construction fails. (*available from the 2021\_09 release*)
|
||||
@@ -650,8 +653,10 @@ There are additional operators defined in the cartridge, but these are used for
|
||||
##### Descriptors
|
||||
|
||||
- mol\_amw(mol) : returns the AMW for a molecule.
|
||||
- mol\_exactmw(mol) : returns the exact MW for a molecule (*available from 2021\_09 release*).
|
||||
- mol\_logp(mol) : returns the MolLogP for a molecule.
|
||||
- mol\_tpsa(mol) : returns the topological polar surface area for a molecule (*available from Q1 2011 (2011\_03) release*).
|
||||
- mol\_labuteasa(mol) : returns Labute's approximate surface area (ASA) for a molecule (*available from 2021\_09 release*).
|
||||
- mol\_fractioncsp3(mol) : returns the fraction of carbons that are sp3 hybridized (*available from 2013\_03 release*).
|
||||
- mol\_hba(mol) : returns the number of Lipinski H-bond acceptors (i.e. number of Os and Ns) for a molecule.
|
||||
- mol\_hbd(mol) : returns the number of Lipinski H-bond donors (i.e. number of Os and Ns that have at least one H) for a molecule.
|
||||
@@ -682,6 +687,7 @@ There are additional operators defined in the cartridge, but these are used for
|
||||
- mol\_chi0n(mol) - mol\_chi4n(mol) : returns the ChiXn value for a molecule for X=0-4 (*available from 2012\_01 release*).
|
||||
- mol\_kappa1(mol) - mol\_kappa3(mol) : returns the kappaX value for a molecule for X=1-3 (*available from 2012\_01 release*).
|
||||
- mol\_phi(mol) : returns the Kier Phi value for a molecule (*available from 2021\_09 release*).
|
||||
- mol\_hallkieralpha(mol) : returns the Hall-Kier alpha value for a molecule (*available from 2021\_09 release*).
|
||||
|
||||
##### MCS
|
||||
|
||||
|
||||
@@ -73,24 +73,15 @@ jobs:
|
||||
target_platform: 10.9
|
||||
steps:
|
||||
- template: .azure-pipelines/mac_build_java.yml
|
||||
- job: Ubuntu_18_04_x64_cartridge
|
||||
- job: Ubuntu_20_04_x64_cartridge
|
||||
timeoutInMinutes: 90
|
||||
pool:
|
||||
vmImage: ubuntu-18.04
|
||||
vmImage: ubuntu-20.04
|
||||
variables:
|
||||
boost_version: 1.69.0
|
||||
number_of_cores: nproc
|
||||
steps:
|
||||
- template: .azure-pipelines/linux_build_cartridge.yml
|
||||
#- job: Ubuntu_18_04_x64_fuzzer
|
||||
# timeoutInMinutes: 90
|
||||
# pool:
|
||||
# vmImage: ubuntu-18.04
|
||||
# variables:
|
||||
# boost_version: 1.67.0
|
||||
# number_of_cores: nproc
|
||||
# steps:
|
||||
# - template: .azure-pipelines/linux_build_fuzzer.yml
|
||||
- job: Ubuntu_18_04_x64_limitexternaldependencies
|
||||
timeoutInMinutes: 90
|
||||
pool:
|
||||
@@ -103,3 +94,13 @@ jobs:
|
||||
python_name: python38
|
||||
steps:
|
||||
- template: .azure-pipelines/linux_build_limitexternal.yml
|
||||
#
|
||||
# - job: Ubuntu_18_04_x64_fuzzer
|
||||
# timeoutInMinutes: 90
|
||||
# pool:
|
||||
# vmImage: ubuntu-18.04
|
||||
# variables:
|
||||
# boost_version: 1.67.0
|
||||
# number_of_cores: nproc
|
||||
# steps:
|
||||
# - template: .azure-pipelines/linux_build_fuzzer.yml
|
||||
|
||||
Reference in New Issue
Block a user