Chemistry Reference
In-Depth Information
Chapter 7, it is clear that these two structures have the same simple graph
and are therefore tautomers. The following SQL returns true.
Select graph('Oc1ccc(O)c2ccccc12') = graph('O=C3CCC(=O)c4ccccc34');
In order to facilitate tautomer detection, a column of graphs of each struc-
t u re cou ld be stored a nd sea rc hed whenever a new st r uct u re i is entered. T The
user entering the structure could be asked if the tautomeric form already
in the database is perhaps the intended form for this structure. Even if the
new tautomeric form is entered as a new compound, the tautomer relation-
ship between the two structures will be recorded by virtue of them hav-
ing the same graph. The process of creating and comparing graphs can be
added to the add _ new _ structure trigger shown above. The modified
function and the modified table and associated index is shown below.
Create Table structure (
smi Text Unique Not Null,
cansmi Text Not Null,
grf Text Not Null,
id Serial Primary Key,
fp Bit Varying);
Create Index grf_index On structure (grf);
Create Function add_new_structure() Returns Trigger As $EOSQL$
Declare
std_smiles Text;
smirks Text;
std Record;
Begin
For std In Select * from std_smirks Loop
std_smiles = xform(NEW.smi, std.smirks);
If std_smiles != NEW.smi Then
NEW.smi = std_smiles;
End If;
End Loop;
NEW.smi = isosmiles(NEW.smi);
NEW.cansmi = cansmiles(NEW.smi);
NEW.grf = graph(NEW.smi);
NEW.fp = fp(NEW.smi);
Return NEW;
Exception
When OTHERS Then
Insert Into error_log (smi) Values (NEW.smi);
Return Null;
End;
$EOSQL$ Language plpgsql;
This addition does not correct the issues with tautomers, but it does allow an
easy way to detect tautomers in the database. Note also that alerting the user
is the responsibility of the client program and is not performed in this trigger
function or in any of the other constraints in the registration schema.
Search WWH ::




Custom Search