Debian Codegraph @

etc/run_pepstats

raw
1 #!/bin/sh -
2
3 # this script will run pepstats on a sequence input file or on each
4 # file in a file of filenames
5
6 # to customise this script see the function called run_one_prog below
7
8
9 PROG=pepstats
10
11
12 if [ $# = 4 -a x$1 = x-onefile ]
13 then
14 shift
15 ONEFILE=t
16 PARAMETERS=$3 export PARAMETERS
17 else
18 if [ $# = 2 ]
19 then
20 PARAMETERS=$2 export PARAMETERS
21 else
22 echo usage: $0 -onefile input_file output_file parameters 1>&2
23 echo or: $0 file_of_filenames parameters 1>&2
24 exit 1
25 fi
26 fi
27
28
29 ### change this function to suit your site:
30
31 run_one_prog () {
32 INPUT_FILE=$1
33 OUTPUT_FILE=$2
34
35 ### change these lines:
36 EXEC=pepstats
37
38 COMMAND="$EXEC -filter $INPUT_FILE"
39
40 echo
41 echo "input file: $INPUT_FILE"
42 echo "output will be written to: $OUTPUT_FILE"
43 echo "executing command: $COMMAND" 1>&2
44
45 # add/change the flags to suit your site:
46 (head -1 $INPUT_FILE | sed 's/^>//'; echo;
47 $COMMAND) 2>&1 > $OUTPUT_FILE | tee ${PROG}_errors.new 1>&2
48
49 #### end of changes
50
51
52 if [ -s ${PROG}_errors.new ]
53 then
54 ( echo ERROR running $PROG: ; echo;
55 echo ===================================================
56 cat ${PROG}_errors.new ) >> $OUTPUT_FILE
57 cat ${PROG}_errors.new >> ${PROG}_errors
58 fi
59 }
60
61 (echo "#!/bin/sh -"; echo "kill $$") > $PROG.kill
62
63 chmod a+x $PROG.kill
64
65 if [ x$ONEFILE = x ]
66 then
67 for i in `cat $1`
68 do
69 run_one_prog $i $i.out
70 done
71
72 else
73 run_one_prog $1 $2
74 fi
75
76 exit 0