[8369] | 1 | directory=$1 #basedir containing dirs for mdl |
---|
| 2 | #$4 #basedir for diana output |
---|
| 3 | #not used yet so only echo |
---|
| 4 | echo "got outputdir (base dir for diana output): $outputdir" |
---|
| 5 | logdir=$2 #place to look for existing looks |
---|
| 6 | logoutputdir=$3 |
---|
| 7 | #put new logs into outputdir or central place (would be better) |
---|
| 8 | |
---|
| 9 | #usage <base-dir containing dirs for mdl> |
---|
| 10 | # <log-dir foreach log found the corresponding mdl is exported to diana> |
---|
| 11 | # <log-output dir for this run> |
---|
| 12 | # <base dir for generated diana models> |
---|
| 13 | |
---|
| 14 | |
---|
| 15 | logfile="mdl2diana-runner.log" |
---|
| 16 | scriptfile="mdl2diana-runner.sh" |
---|
| 17 | #reset logfile, otherwise logs will be always appended |
---|
| 18 | echo "running $0 $*">$logfile |
---|
| 19 | #needs to be started with absolute path |
---|
| 20 | mdl2dianascript="/home/rempel/Promot/promot/scripts/promot-server -mdl2dianafromsbml" |
---|
| 21 | |
---|
| 22 | |
---|
| 23 | #reset scriptfile |
---|
| 24 | echo "#!/bin/sh">$scriptfile |
---|
| 25 | for file in $logdir/*log |
---|
| 26 | #check existing logs only proceed if log exists (moving logs to control next step) |
---|
| 27 | do |
---|
| 28 | echo "$file" |
---|
| 29 | #replace xml extension to mdl, in output dir |
---|
| 30 | mdldir=$1/`basename $file ".log"` |
---|
| 31 | mdlfile=$mdldir/`basename $file ".log"`.mdl |
---|
| 32 | echo "mdl dir: $mdldir" |
---|
| 33 | echo "mdl file: $mdlfile" |
---|
| 34 | outputdir=$4/`basename $file ".log"` |
---|
| 35 | echo "output dir: $outputdir" |
---|
| 36 | if [ ! -d $outputdir ]; then mkdir -p $outputdir; fi |
---|
| 37 | |
---|
| 38 | #replace xml extension to log, in log dir $3 |
---|
| 39 | logfilename=$logoutputdir/`basename $file $extension` |
---|
| 40 | echo "$logfilename" |
---|
| 41 | |
---|
| 42 | #log found and generated filenames |
---|
| 43 | echo "found: $file -> $mdlfile $logfilename" >> $logfile |
---|
| 44 | echo "$mdl2dianascript \"$mdlfile\" > $logfilename" >> $logfile |
---|
| 45 | echo "cd $outputdir" >> $scriptfile |
---|
| 46 | echo "$mdl2dianascript \"$mdlfile\"" >> $scriptfile |
---|
| 47 | done |
---|
| 48 | `chmod +x $scriptfile` |
---|
| 49 | exec $scriptfile |
---|
| 50 | |
---|