File: run-unit-test

package info (click to toggle)
stringtie 2.1.4%2Bds-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 14,280 kB
  • sloc: cpp: 25,948; python: 214; makefile: 143; sh: 89
file content (51 lines) | stat: -rw-r--r-- 1,447 bytes parent folder | download
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
#!/bin/bash
set -e

pkg=stringtie
CUR_DIR=`pwd`

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 ${CUR_DIR}/debian-tests-data/* -a "${AUTOPKGTEST_TMP}"

cd "${AUTOPKGTEST_TMP}"
gunzip -r *

cat long_reads.sam| samtools view -Sb - > long_reads.bam
cat short_reads_and_superreads.sam| samtools view -Sb - > short_reads_and_superreads.bam
cat short_reads.sam| samtools view -Sb - > short_reads.bam

# skipping the first line because it differs due to location of compiled binary
function test_output()
{
	# $1: Test Number
	# $2: output file
	# $3: input bam file
	# $4: expected output file
	echo "Test $1"
	stringtie -o $2 $3
	if [ "$1" = 3 ]
	then
		stringtie -L -o $2 $3
	elif [ "$1" = 4 ]
	then
		stringtie -L -G human-chr19_P.gff -o $2 $3
	fi
	if [ $(dpkg-architecture -qDEB_BUILD_ARCH) = "amd64" ]
	then
		diff -u <(tail -n +3 $2) <(tail -n +3 $4)
		echo "Expected output and generated output are same: PASS"
	else
		[ -s $2 ] || exit 1
		echo "PASS"
	fi
}


test_output 1 short_reads.out.gtf short_reads.bam short_reads.out_expected.gtf
test_output 2 short_reads_and_superreads.out.gtf short_reads_and_superreads.bam short_reads_and_superreads.out_expected.gtf
test_output 3 long_reads.out.gtf long_reads.bam long_reads.out_expected.gtf
test_output 4 long_reads_guided.out.gtf long_reads.bam long_reads_guided.out_expected.gtf