-
Notifications
You must be signed in to change notification settings - Fork 1
/
gen.sh.in
executable file
·66 lines (57 loc) · 1.84 KB
/
gen.sh.in
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
#!/bin/bash
# CMake configured paths
STANDARDIZE_BIN=@STANDARDIZE_BIN@
UNSTANDARDIZE_BIN=@UNSTANDARDIZE_BIN@
ISAANDBWT_BIN=@ISAANDBWT_BIN@
READPLCP_BIN=@READPLCP_BIN@
PSASCAN_BIN=@PSASCAN_BIN@
CONSTRUCT_PLCP_SEQ_BIN=@CONSTRUCT_PLCP_SEQ_BIN@
CONSTRUCT_LCP_BIN=@CONSTRUCT_LCP_BIN@
PLCP_BIN=@PLCP_BIN@
TDC_BIN=@TDC_BIN@
# The script
scriptpath=`dirname $(readlink -f "$0")` && cd "$scriptpath"
input=$1
if [[ ! -r "${input}" ]]; then
echo "File ${input} not readable"
exit 1
fi
# escapes symbols that cannot be treated by pSAscan
if [[ ! -r "${input}.0" ]]; then
echo standardize "${input}"
time "${STANDARDIZE_BIN}" "${input}"
fi
# generates SA from text
if [[ ! -r "${input}.0.sa5" ]]; then
echo psascan "${input}.0"
time "${PSASCAN_BIN}" "${input}.0"
fi
# generates BWT and ISA
if [[ ! -r "${input}.0.isa5" ]]; then
echo isaandbwt "${input}.0"
time "${ISAANDBWT_BIN}" "${input}.0"
fi
# generates PLCP from BWT and SA
if [[ ! -r "${input}.0.plcp" ]]; then
echo construct_plcp_sequential "${input}.0"
time "${CONSTRUCT_PLCP_SEQ_BIN}" "${input}.0"
fi
# generates LCP from text and SA
if [[ ! -r "${input}.0.lcp5" ]]; then
echo construct_lcp "${input}.0"
time "${CONSTRUCT_LCP_BIN}" "${input}.0"
fi
#runs plcp, has to be generated with 'make plcp' in tudocomp
echo "plcp ${input}.0 ${input}.0.tdc"
"${PLCP_BIN}" "${input}.0" "${input}.0.tdc"
#decompress plcp-compressed file
TDC_DECODE_ALGORITHM="lcpcomp(coder=huff)"
echo "tdc -a '${TDC_DECODE_ALGORITHM}' -d --raw ${input}.0.tdc -f -o ${input}.0.orig"
"${TDC_BIN}" -a "${TDC_DECODE_ALGORITHM}" -d --raw "${input}.0.tdc" -f -o "${input}.0.orig"
# un-escape decompressed file
echo "${UNSTANDARDIZE_BIN} ${input}.0.orig"
"${UNSTANDARDIZE_BIN}" "${input}.0.orig"
# compare decompressed file with original file
echo "diff ${input} ${input}.0.orig.1"
diff "${input}" "${input}.0.orig.1"
[[ $? -eq 0 ]] && echo 'PERFECT'