Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- # compare KEGGID with entire ZINC database
- # ZINC database is extracted to ~/ZINC and decompressed
- # with gunzip *.sdf.gz
- # VR
- #some checks
- command -v wget >/dev/null 2>&1 || { echo >&2 "I require wget (gnu.org/software/wget) but it's not installed. Aborting."; exit 1; }
- command -v babel >/dev/null 2>&1 || { echo >&2 "I require openbabel (http://openbabel.org) but it's not installed. Aborting."; exit 1; }
- if [ ! -d ~/ZINC ]; then
- echo "Directory ~/ZINC with local ZINC database do not exist. Make it first."
- exit 1
- fi
- if [ $# -ne 1 ]; then
- echo "Usage ./search_ZINC.sh KEGGID"
- echo "KEGGID is C number from KEGG compound database:"
- echo "http://www.genome.jp/kegg/compound/"
- exit 1
- fi
- KEGGID=$1
- echo "Downloading $KEGGID mol file from KEGG..."
- wget http://www.genome.jp/dbget-bin/www_bget?-f+m+compound+${KEGGID} -O ${KEGGID}.mol
- if [ ! -s ${KEGGID}.mol ]; then
- "File ${KEGGID}.mol is empty. Likely wrong KEGGID"
- exit 1
- fi
- for file in ~/ZINC/*.sdf
- do
- echo "Comparing with ZINC package: $file"
- #Slow part:
- babel ${KEGGID}.mol $file -ofpt -xfFP2 > ${KEGGID}_${file}.log
- #print cases when Tanimoto score is 1
- grep 1$ ${KEGGID}_${file}.log
- #print cases when Tanimoto score is larger than 0.9 and lower than 1
- grep 0\.9.$ ${KEGGID}_${file}.log
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement