runcheck

来自「EM算法的改进」· 代码 · 共 220 行

TXT
220
字号
#!/bin/sh# runcheck - for testing of meme and mast## $Id: runcheck 1339 2006-09-21 19:46:28Z tbailey $## $Log$# Revision 1.7  2006/03/08 20:50:11  nadya# merge chamges from v3_5_2 branch## Revision 1.6.4.2  2006/01/24 02:24:29  nadya# EXT is obsoleted by using printf()## Revision 1.6.4.1  2006/01/24 02:04:55  nadya# source meme_config to set needed environment# make output table-like## Revision 1.6  2005/10/07 02:54:28  nadya# clean debugging output, fix typo## Revision 1.5  2005/10/04 20:03:23  nadya# changes to accommodate sh on solaris:# substitute array with awk parsing and  initialize err.## Revision 1.4  2005/10/04 00:02:04  nadya# change to "-f", the option "-e" does not run solaris## Revision 1.3  2005/10/02 05:09:39  nadya# add extension ".bin" to executables names for meme and mast## Revision 1.2  2005/09/01 00:42:05  nadya# call executables from $topdir befiore they are installed# update sed regexpr## Revision 1.1  2005/08/31 04:51:55  nadya# create script and target for "make check"## set meme environmenttop=`pwd`/.. MEME_DIRECTORY="$top"export MEME_DIRECTORYetcdir=$top/etctestdir=$top/testsmake_logodds=$top/scripts/make_logoddsmeme=$top/src/meme.binmast=$top/src/mast.binconf=$top/scripts/meme_configif [ ! -f $make_logodds ] ; then    echo "$make_logodds does not exist"    echo "Run 'make' before running 'make check'"    exit 1fiif [ ! -x $meme ] ; then    echo "$meme does not exist or is not executable"    echo "Run 'make' before running 'make check'"    exit 1fiif [ ! -x $mast ] ; then    echo "$mast does not exist or is not executable"    echo "Run 'make' before running 'make check'"    exit 1fiif [ -f $conf ] ; then    . $confelse    echo "$conf does not exist"    echo "Run 'make' before running 'make check'"    exit 1fi#####################################################################                      define functions ##################################################################### run mast tests func_run_mast () {    echo ""    echo  "              Mast test for "    echo  "    ---------------------------------"    echo  "      Dataset       Model     result "     echo  "    ---------------------------------"    for mod in $models    do        memefile=meme.$dset.$mod$suffix        mastfile=mast.$dset.$mod$suffix        logodds=$dirout/logodds.$$        info=`perl $make_logodds $dir/$memefile $logodds`        alphabet=`echo $info | awk '{print $1}'`        vardb=`echo $info | awk '{print $2}'`        database=$dir/`basename $vardb`        params="-nostatus -logodds $logodds -alphabet $alphabet -mf $dir/$memefile"        params="$params -database $database -df $database"        $mast "mast $memefile" $params > $dirout/$mastfile        func_diff $mastfile     done}# run meme tests func_run_meme () {    echo ""    echo  "              Meme test for "    echo  "    ---------------------------------"    echo  "      Dataset       Model     result "     echo  "    ---------------------------------"    for mod in $models    do        memefile=meme.$dset.$mod$suffix        $meme $pargs $dir/$dset.s -mod $mod $params > $dirout/$memefile        func_diff $memefile     done}# remove lines specified by regexpr from the file# takes a filename as an argumentfunc_sed () {    e1="/Release date/d"    e2="/http:/d"    e3="/MOTIFS/d"    e4="/Time/d"    e5="/CPU:/d"    e6="/DATAFILE=/d"    e7="/DATABASE/d"    e8="/command: /d"    e9="/Background letter frequencies/d"    e10="/Last updated/d"    sed -e "$e1" -e "$e2" -e "$e3" -e "$e4" -e "$e5" \        -e "$e6" -e "$e7" -e "$e8" -e "$e9" -e "$e10" $1 > $1.sed}# checks two files for differences.  Arguments - a filename# and a string containing dataset and model info to print.func_diff () {    f1=$dir/$1      # first file    f2=$dirout/$1   # second file    # string to print	str=`echo $dset $mod | awk '{printf("    %-16s%-8s  ",$1,$2)}'`    if [ ! -f  $f1 ]; then        echo "File $f1 does not exist, can't compare output"        echo "$str" "SKIPPED"        return     fi    if [ ! -f  $f2 ]; then        echo "File $f2 does not exist, can't compare output"        echo "$str" "SKIPPED"        return     fi    func_sed $f1     func_sed $f2     num=`diff $f1.sed $f2.sed | wc -l`    status=$?    if [ $status -eq 0 -a  $num -eq 0 ]; then        echo "$str" "OK"    else        echo "$str" "FAIL"        err=1    fi    return }# initializes tests parametersfunc_set () {    dset="crp0"    models="oops zoops tcm"    params="-dna -revcomp -nostatus -nmotifs 2 -minw 8"    dir=$top/tests    dirout=$top/tests/results    if [ ! -d $dirout ]; then        cmd=`mkdir $dirout`        status=$?        if [ $status -eq 1 ] ; then             exit 1        fi    fi    err=0}# removes temp output filesfunc_clean () {    /bin/rm -rf $dir/*.sed $dirout/*.sed $dirout/logodds.*    if [ ! $err ] ; then        /bin/rm -rf $dirout    fi    echo }#####################################################################             check command line arguments and run tests##################################################################### check argumentswhile test $# -gt 0; do    case "$1" in    -p)        shift        procs=$1        pargs="-p $1"        suffix=".$1"        ;;    esac    shiftdone# run testsfunc_set func_run_memefunc_run_mastfunc_cleanexit $err

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?