Shell_Sh_Code_Example

5049 ワード

#   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="../../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 + '
') 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*