Newer
Older
1
2
3
4
5
6
7
8
9
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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
#!/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: /cvsroot/pathsoft/artemis/etc/run_tblastx,v 1.4 2005-12-20 13:50:10 tjc Exp $"
cleanUp()
{
echo $1
cat $1 | while thisLine=`line`
do
rm -f $thisLine
done
rm -f $1
}
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
DIRNAME=$4
### change these lines:
EXEC=${EXEC-`which blastall 2>/dev/null`}
if [ ! -x "$EXEC" ]; then
EXEC=`find Artemis* -name blastall 2>/dev/null`
fi
if [ ! -d "$BLASTDB" ]; then
DATABASE_TMP="$PWD/"`find Artemis* -name blast-data 2>/dev/null`"/$DATABASE"
if [ -f "$DATABASE_TMP" ]; then
DATABASE="$DATABASE_TMP"
fi
fi
echo "about to start $EXEC with input from $INPUT_FILE and output to" 1>&2
echo "$OUTPUT_FILE using database $DATABASE" 1>&2
EXTRA_ARGS=
# add/change the flags to suit your site:
HOSTNAME=`hostname`
REMOTE=N
case $HOSTNAME in
deskpro*)
REMOTE=Y ;;
*)
esac
if [ $REMOTE = "Y" ]; then
WDIR=`pwd`
export WDIR
# rsh babel "cd $WDIR; lsrun -v blastwrap.pl $EXEC -d $DATABASE -i $INPUT_FILE -p tblastx \
# $EXTRA_ARGS >! $OUTPUT_FILE"
rsh babel "cd $WDIR; bsub -q longblastq -o $OUTPUT_FILE -e ${PROG}_errors.new -I flexi_blast.pl -tx $DATABASE $INPUT_FILE $EXTRA_ARGS"
else
# lsrun -v blastwrap.pl $EXEC -d $DATABASE -i $INPUT_FILE -p tblastx \
# $EXTRA_ARGS 2>&1 > $OUTPUT_FILE |
# tee ${PROG}_errors.new 1>&2
bsub -q long -o $OUTPUT_FILE -e ${PROG}_errors.new -I flexi_blast.pl -tx $DATABASE $INPUT_FILE $EXTRA_ARGS
fi
#### end of changes
# Artemis can read compressed files
count=0; while (test ! -f $OUTPUT_FILE) && (test $count -lt 1000) ; do sleep 2; count+=1; done
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
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
gzip -9 $OUTPUT_FILE
zip -j ${DIRNAME}tblastx.zip ${OUTPUT_FILE}.gz
rm -f ${OUTPUT_FILE}.gz
}
(echo "#!/bin/sh -"; echo "kill $$") > $PROG.kill
chmod a+x $PROG.kill
DIR=`dirname $PWD/$1`
if [ x$ONEFILE = x ]
then
for i in `cat $1`
do
run_one_prog $i $i.out $EXPANDED_DATABASE "$DIR/"
done
else
run_one_prog $1 $2 $EXPANDED_DATABASE "$DIR/"
fi
cleanUp $1
exit 0