-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrdpclassifier.build
93 lines (68 loc) · 2.11 KB
/
rdpclassifier.build
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
. ./tools.config
set -e
if [ ! -f ${PREFIX}/lib/jdk-17/bin/java ]; then
bash -x jdk.build
fi
VERSION=2.14
wget -q --no-check-certificate -O rdp_classifier.zip https://sourceforge.net/projects/rdp-classifier/files/rdp-classifier/rdp_classifier_${VERSION}.zip/download
unzip rdp_classifier.zip
rm rdp_classifier.zip
cd rdp_classifier_${VERSION}
mkdir -p ${PREFIX}/lib/rdp_classifier_${VERSION}
cp -va dist/* ${PREFIX}/lib/rdp_classifier_${VERSION}
cat << EOS > ${PREFIX}/bin/rdp-classifier-${VERSION}
#!/bin/sh
# Usage: rdp-classifier input-file
# or: rdp-classifier -s < input-file
# configuration settings
RDPVERSION=${VERSION}
CP=${PREFIX}/lib/rdp_classifier_\${RDPVERSION}/lib
JAR=${PREFIX}/lib/rdp_classifier_\${RDPVERSION}/classifier.jar
# end of config
usage() {
cat << EOU
Usage: \$0 input-file
or: \$0 -s < input-file
Input is expected in FASTA format, Output to stdout.
EOU
if [ \$# -gt 0 ]; then
echo ERROR: \"$@\"
exit 1
fi
}
cleanup() {
# remove temporary input file if necessary
if [ ! -z "\${TMP_IN}" ]; then
rm -f \${TMP_IN}
fi
}
if [ \$# -lt 1 ]; then
usage No inputfile or redirection flag given, aborting.
fi
# cleanup if this shell script terminates or aborts
trap cleanup exit
INFILE=\$1
if [ "\${INFILE}" = "-s" ]; then
INFILE=/dev/fd/0
fi
TRAINSET=\$2
# check that we can read the input file
test -e \${INFILE} || usage Input file \$INFILE does not exist, aborting.
test -r \${INFILE} || usage Input file \$INFILE is not readable, aborting.
# create a temporary input file if reading from stdin etc.
if [ ! -f \${INFILE} ]; then
HOST=\`/bin/hostname\`
TMP_IN=/tmp/rdp_\${HOST}_\$\$.in
cat < \${INFILE} > \${TMP_IN}
chmod 600 \${TMP_IN}
INFILE=\${TMP_IN}
fi
err=0
${PREFIX}/lib/jdk-17/bin/java -Xmx900m -cp \${CP} -jar \${JAR} -q \${INFILE} -g \${TRAINSET} -o /dev/fd/1 2>/dev/null || err=\$?
exit \${err}
EOS
chmod 755 ${PREFIX}/bin/rdp-classifier-${VERSION}
chgrp ${GROUP} ${PREFIX}/bin/rdp-classifier-${VERSION}
ln -sf ${PREFIX}/bin/rdp-classifier-${VERSION} ${PREFIX}/bin/rdp-classifier
cd ..
rm -rf rdp_classifier_${VERSION}