Chemistry Reference
In-Depth Information
_molarb() {
$PSQL -c "Select isosmiles,name from \"$2\".structure order by
md5(id+$4) limit $3"
}
_molrandom() {
$PSQL -c "Select isosmiles,name from \"$2\".structure order by
md5(id+$RANDOM) limit $3"
}
_molnear() {
$PSQL -c "Select isosmiles,name,tanimoto(fp, $FUNC.fp('$3')) from
\"$2\".structure where tanimoto(fp, $FUNC.fp('$3')) > $4"
}
_molsame() {
$PSQL -c "select isosmiles,name from \"$2\".structure where
isosmiles in (select isosmiles from \"$2\".structure intersect
select isosmiles from \"$3\".structure)"
}
ME=./dbutils # could be /usr/local/bin/dbutils
cmd="$0"
if [ "$cmd" == "bash" ]; then
alias molgrep="$ME _molgrep"
alias molcat="$ME _molcat"
alias molview="$ME _molview"
alias molrandom="$ME _molrandom"
alias molarb="$ME _molarb"
alias molnear="$ME _molnear"
alias molsame="$ME _molsame"
else
$1 $*
fi
The file containing these shell commands should be created and called
dbutils. In order to define the molgrep and other commands, the com-
mand source dbutils is issued. After that, the commands molgrep ,
molcat , molview , molarb , molrandom , and molnear become available.
The use of these commands is discussed in Chapter 13.
A.9 Loading Files Into Simple Tables
Most of this topic is devoted to explaining how to design schemas to best
suit the needs of a project involving chemical structures. This section is
intended to bridge the gap between using files and using a complex schema
of tables in a relational database. Sometimes it helps to simply get molecu-
lar structure files into the database, and decide later how best to integrate
them into new or existing schemas. This section shows two utilities that
create a simple schema that can be used for many purposes, such as those
Search WWH ::




Custom Search