#!/bin/sh
# Run scripts with Python (and modpy.sh if needed) if possible, rather
# than the modXXX script (which only works correctly if Python 2.3 is installed)
modpy="../../bin/modpy.sh"
# If modpy.sh doesn't exist, assume we have Python set up correctly already
# (e.g. Mac or RPM install, or PYTHONPATH and LD_LIBRARY_PATH set):
if test "${PYTHON}x" != "x"; then
pyint="${PYTHON}"
else
pyint="python"
fi
if test ! -f ${modpy}; then
modpy="${pyint}"
else
modpy="${modpy} ${pyint}"
fi
# Only use Modeller through Python if 1) an import succeeds, 2) the 'modeller'
# module imported is really Modeller (not a spurious modeller.py in the path
# somewhere) and 3) the version matches that these examples were built with
run_version=`${modpy} - 2>/dev/null <<END
import sys
from modeller import *
v = info.version_info
if isinstance(v, tuple):
v = ".".join([str(i) for i in v])
sys.stdout.write(v + '\n')
END
`
build_version="9.11"
#-- Rewrite By JunH
workPath="../ModellerWorkFolder/TvLDH"
PDBID="TvLDH"
PYFULLPATH="/home/protein/JunHWorkSpace/SimpleModeller"
if [ $# != 2 ]
then
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "!! 输入参数不正确 !!"
echo "!! 导出失败,未生成文件 !!"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
exit 1
fi
workPath=$1
PDBID=$2
# run_script build_profile
if test "${run_version}" = "${build_version}"; then
cmd="${modpy} $PYFULLPATH/build_profile.py $PYFULLPATH $workPath $PDBID.ali > $workPath/temp/build_profile.log"
else
cmd="mod9.11 $PYFULLPATH/build_profile.py"
fi
echo "$cmd"
# 运行Cmd
eval "$cmd"
# translate workPath + '/temp/build_profile.prf' File
# 去除文件$workPath/temp/build_profile.prf的第1-7行后保存在$workPath/temp/build_profile.prf.copy
sed '1,7d' $workPath/temp/build_profile.prf > $workPath/temp/build_profile.prf.copy
# 选取文件$workPath/temp/build_profile.prf.copy中第12个域值中最小的值
minilize=`awk 'BEGIN { a = 1 } { if ($12 < a) a = $12; } END { print a }' $workPath/temp/build_profile.prf.copy`
# 选取文件$workPath/temp/build_profile.prf.copy中所有最小的值
ProteinPDBIDList=`awk '{ if ($12 == '$minilize') print $2 }' $workPath/temp/build_profile.prf.copy`
# format ProteinPDBIDList
# 将$ProteinPDBIDList中所有的" "变成" "
pPDBIDList=`echo $ProteinPDBIDList | sed 's/ / /g'`
#run_script compare
if test "${run_version}" = "${build_version}"; then
cmd="${modpy} $PYFULLPATH/compare.py $PYFULLPATH $workPath $pPDBIDList > $workPath/temp/compare.log"
else
cmd="mod9.11 $PYFULLPATH/compare.py"
fi
echo "$cmd"
eval "$cmd"
# translate workPath + '/temp/family.mat' File
# remove the first count line
sed '1,1d' $workPath/temp/family.mat > $workPath/temp/family.mat.copy
# search minilize score
minScore=1000
# while循环读取$workPath/temp/family.mat.copy每一行
while read line
do
# 将line用" "分割后选取第2个域给atScore
atScore=`echo $line | cut -d" " -f2`
# 将atScore的第2个到最后一个字符截取后赋给score
score=`echo $atScore | cut -c2-`
# 比较score中的数值是否比minScore中的小如果是叫将socre赋给minScore
if (echo ${score} ${minScore} | awk '!($1<$2){exit 1}') then
tpdbID=`echo $line | cut -d" " -f1`
minScore=$score
fi
done < $workPath/temp/family.mat.copy
# 将tpdbID的第1个到第4个字符截取后赋给pdbCode
pdbCode=`echo $tpdbID | cut -c-4`
# 将tpdbID的第5个到最后一个字符截取后赋给pdbChain
pdbChain=`echo $tpdbID | cut -c5-`
#run_script align2d
if test "${run_version}" = "${build_version}"; then
cmd="${modpy} $PYFULLPATH/align2d.py $PYFULLPATH $workPath $PDBID $pdbCode $pdbChain > $workPath/temp/align2d.log"
else
cmd="mod9.11 $PYFULLPATH/align2d.py"
fi
echo "$cmd"
eval "$cmd"
#run_script model-single
if test "${run_version}" = "${build_version}"; then
cmd="${modpy} $PYFULLPATH/model-single.py $workPath $PDBID $tpdbID > $workPath/temp/model-single.log"
else
cmd="mod9.11 $PYFULLPATH/model-single.py"
fi
echo "$cmd"
eval "$cmd"
mv "$PDBID.B99990001.pdb" "$workPath/$PDBID.pdb"
rm -f $PDBID*
#这个是Shell脚本,不是Python命令行文件#!/bin/sh# Run scripts with Python (and modpy.sh if needed) if possible, rather# than the modXXX script (which only works correctly if Python 2.3 is installed)modpy="../