File: run-unit-test

package info (click to toggle)
bioawk 1.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 380 kB
  • sloc: ansic: 5,519; yacc: 407; makefile: 119; awk: 80; sh: 57
file content (46 lines) | stat: -rw-r--r-- 1,452 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
#!/bin/bash
set -e

if [ "$AUTOPKGTEST_TMP" = "" ] ; then
  AUTOPKGTEST_TMP=`mktemp -d /tmp/${pkg}-test.XXXXXX`
  trap "rm -rf $AUTOPKGTEST_TMP" 0 INT QUIT ABRT PIPE TERM
fi

cp /usr/share/doc/seqkit-examples/tests/SIRV_150601a.fasta.gz $AUTOPKGTEST_TMP
cp /usr/share/samtools/test/ampliconclip/ac_test.bed $AUTOPKGTEST_TMP
cp /usr/share/samtools/test/dat/view.001.sam $AUTOPKGTEST_TMP

cd $AUTOPKGTEST_TMP
gunzip -r *
mv SIRV_150601a.fasta input.fasta

echo "Test 1 - Get length for sequences"
bioawk -c fastx '{ print $name, length($seq) }' input.fasta 1>test1 2>>test1
[ -s test1 ] || exit 1
echo "================================="
echo "PASS"

echo "Test 2 - Get reverse compliment"
bioawk -c fastx '{ print ">"$name;print revcomp($seq) }' input.fasta 1>test2 2>>test2
[ -s test2 ] || exit 1
echo "=================================="
echo "PASS"

echo "Test 3 - Convert FASTA to tabular form"
bioawk -t -c fastx '{ print $name, $seq }' input.fasta 1>test3 2>>test3
[ -s test3 ] || exit 1
echo "=================================="
echo "PASS"

echo "Test 4 - Print feature length"
bioawk -c bed '{ print $end - $start }' ac_test.bed 1>test4 2>>test4
[ "$(cat test4 | wc -l)" -gt 1 ] || exit 1
[ -s test4 ] || exit 1
echo "=================================="
echo "PASS"

echo "Test 5 - Extract mapped reads"
bioawk -c sam -H '!and($flag,4)' view.001.sam 1>test5 2>>test5
[ -s test5 ] || exit 1
echo "=================================="
echo "PASS"