Newer
Older
#!/bin/sh -
# this script will run a search program on a sequence input file or on each
# file in a file of filenames
# to customise this script see the function called run_one_prog below
RCS_HEADER="$Header: //tmp/pathsoft/artemis/etc/run_fasta,v 1.3 2004-06-22 10:39:58 tjc Exp $"
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
PROG=`echo $RCS_HEADER | sed 's/.*run_\(.*\),v.*/\1/'`
if [ $# = 4 -a x$1 = x-onefile ]
then
shift
ONEFILE=t
DATABASE=$3 export DATABASE
else
if [ $# = 2 ]
then
DATABASE=$2 export DATABASE
else
echo usage: $0 -onefile input_file output_file database 1>&2
echo or: $0 file_of_filenames database 1>&2
exit 1
fi
fi
# expand any ~ or environment variables
EXPANDED_DATABASE=`echo "echo $DATABASE" | /bin/csh -f`
### change this function to suit your site:
run_one_prog () {
INPUT_FILE=$1
OUTPUT_FILE=$2
DATABASE=$3
### change these lines:
### get sequence size
seq_size=`infoseq "$INPUT_FILE" -length -only -auto | awk '{ sum += $1 } END { print sum }`
FASTLIBS=/nfs/disk222/yeastpub/bio-soft/fasta/pubseqgbs export FASTLIBS
EXEC=/nfs/disk222/yeastpub/bio-soft/fasta/fasta33_t
echo "about to start $EXEC with input from $INPUT_FILE and output to" 1>&2
echo "$OUTPUT_FILE using database $DATABASE" 1>&2
# add/change the flags to suit your site:
COMMAND="$EXEC -B -S -q -b 100 -H $INPUT_FILE $DATABASE ktup 2"
echo "command line: $COMMAND" 1>&2
# lsrun -R 'select[blast && mem > 500] rusage[r1m=1:mem=500]' -v $COMMAND 2>&1 > $OUTPUT_FILE |
if [ "$seq_size" -lt 25000 ]
then
bsub -q babelq2 -n 1 -R 'select[blast && mem > 500] rusage[r1m=1:mem=500]' -I $COMMAND 2>&1 > $OUTPUT_FILE |
tee ${PROG}_errors.new 1>&2
elif [ "$seq_size" -lt 70000 ]
then
bsub -q "longblastq" -n 1 -R 'select[blast && mem > 500] rusage[r1m=1:mem=500]' -I $COMMAND 2>&1 > $OUTPUT_FILE |
tee ${PROG}_errors.new 1>&2
else
bsub -q "local_blastq" -n 1 -R 'select[blast && mem > 500] rusage[r1m=1:mem=500]' -I $COMMAND 2>&1 > $O
UTPUT_FILE |
tee ${PROG}_errors.new 1>&2
fi
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#### end of changes
# Artemis can read compressed files
gzip -9 $OUTPUT_FILE &
if [ -s ${PROG}_errors.new ]
then
( echo ERROR running $PROG: ; echo;
echo ===================================================
cat ${PROG}_errors.new ) >> $OUTPUT_FILE
cat ${PROG}_errors.new >> ${PROG}_errors
fi
}
(echo "#!/bin/sh -"; echo "kill $$") > $PROG.kill
chmod a+x $PROG.kill
if [ x$ONEFILE = x ]
then
for i in `cat $1`
do
run_one_prog $i $i.out $EXPANDED_DATABASE
done
else
run_one_prog $1 $2 $EXPANDED_DATABASE
fi
exit 0