File: lowhomo.sh

package info (click to toggle)
andi 0.14-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 996 kB
  • sloc: ansic: 2,296; sh: 426; cpp: 99; makefile: 76; awk: 51
file content (54 lines) | stat: -rwxr-xr-x 1,293 bytes parent folder | download | duplicates (2)
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
#!/bin/sh -f

# copied and enhanced from upstream

set -e
pkg=andi

export LC_ALL=C.UTF-8
if [ "${AUTOPKGTEST_TMP}" = "" ] ; then
  AUTOPKGTEST_TMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
  # Double quote below to expand the temporary directory variable now versus
  # later is on purpose.
  # shellcheck disable=SC2064
  trap "rm -rf ${AUTOPKGTEST_TMP}" 0 INT QUIT ABRT PIPE TERM
fi

cp test/test_fasta.cxx "${AUTOPKGTEST_TMP}"

cd "${AUTOPKGTEST_TMP}"

g++ -O2 -Wall -o test_fasta test_fasta.cxx
RANDOM_SEED=1729



#--- only small changes below ---

SEED=${RANDOM_SEED:-0}
SEED2=0
SEED3=0
if test $SEED -ne 0; then
	SEED=$((SEED + 1))
	SEED2=$((SEED + 2))
	SEED3=$((SEED + 3))
fi

./test_fasta -s $SEED -l 100000 > a_low.fa
./test_fasta -s $SEED2 -l 100000 > b_low.fa
./test_fasta -s $SEED3 -l 100 > both_low.fa

cat both_low.fa a_low.fa | awk -v RS='>' '{if($1 == "S0")print ">"$0 > "S0_low.fa"}'
cat both_low.fa b_low.fa | awk -v RS='>' '{if($1 == "S1")print ">"$0 > "S1_low.fa"}'

# this is expected to trigger the low homology warning
andi -j S0_low.fa S1_low.fa 2>&1 | grep 'homology'
EXIT_VAL=$?

if [ ${EXIT_VAL} -ge 1 ]; then
	echo "Triggering low homology failed" >&2
	grep '^>' a_low.fa b_low.fa both_low.fa
fi

rm -f a_low.fa b_low.fa both_low.fa S0_low.fa S1_low.fa
exit $EXIT_VAL