Chemistry Reference
In-Depth Information
The directories named in these commands are valid for version 8.2 of
PostgreSQL running on a Ubuntu linux machine. They may be valid
for other distributions of linux, but may need to be adjusted for another
installation.
Finally, the function is defined using the following SQL.
Create Or Replace Function nbits_set(bit)
Returns integer AS 'bits', 'nbits_set' Language c Immutable Strict;
Comment On Function nbits_set(bit) Is 'number of bits set';
In fu nctions written i in other languages, the code appears i in the create com-
mand, whether it is written in SQL, plpgsql, plperl, or plpython. For C lan-
guage functions, the name of the shared object, here bits.so, and the name
of the c function, here nbits _ set are named in the create command.
A.8 Database Utilities Dbutils
Several utility functions are discussed in Chapter 13 that can be used from
the linux command line. These are molgrep , molcat , molview , molarb ,
molrandom , and molnear . They operate on tables named structure that
contain columns of SMILES, fingerprints, and names. Schemas containing
tables like these can be created using the smiloader and sdfloader
functions described in the next section. This section lists the shell script
that defines the molgrep and other commands.
#! /bin/bash
# take your pick of options to psql
PSQL='psql -t -A -P fieldsep=,'
PSQL='psql -H'
PSQL='psql -t -A'
# schema where core chemical functions are: gnova,openbabel,frowns,
perlmol
FUNC="openbabel"
_molgrep() {
$PSQL -c "Select isosmiles,name from \"$2\".structure where $FUNC.
contains(fp, $FUNC.fp('$3')) and $FUNC.matches(isosmiles, '$3')"
}
_molcat() {
$PSQL -c "Select isosmiles,name from \"$2\".structure"
}
_molview() {
echo "<script src='/marvin/marvin.js'></script>"
if [ "$3" == "" ]; then
$PSQL -c "Select marvin_view(isosmiles) from \"$2\".structure"
else
$PSQL -c "Select marvin_view(isosmiles,'$3') from \"$2\".structure"
fi
}
Search WWH ::




Custom Search