diff -Nru dnapi-1.1/debian/changelog dnapi-1.1/debian/changelog --- dnapi-1.1/debian/changelog 2020-03-26 10:24:49.000000000 +0000 +++ dnapi-1.1/debian/changelog 2020-10-24 20:17:05.000000000 +0000 @@ -1,3 +1,11 @@ +dnapi (1.1-3) unstable; urgency=medium + + * Team Upload. + * Add autopkgtests + * compat: 13 + + -- Nilesh Patra Sun, 25 Oct 2020 01:47:05 +0530 + dnapi (1.1-2) unstable; urgency=medium * Team upload. diff -Nru dnapi-1.1/debian/control dnapi-1.1/debian/control --- dnapi-1.1/debian/control 2020-03-26 10:24:49.000000000 +0000 +++ dnapi-1.1/debian/control 2020-10-24 20:16:47.000000000 +0000 @@ -4,7 +4,7 @@ Section: science Testsuite: autopkgtest-pkg-python Priority: optional -Build-Depends: debhelper-compat (= 12), +Build-Depends: debhelper-compat (= 13), dh-python, python3-setuptools, python3-all diff -Nru dnapi-1.1/debian/dnapi.examples dnapi-1.1/debian/dnapi.examples --- dnapi-1.1/debian/dnapi.examples 2020-03-26 10:24:49.000000000 +0000 +++ dnapi-1.1/debian/dnapi.examples 2020-10-24 20:08:33.000000000 +0000 @@ -1 +1,3 @@ examples/* +debian/tests/simple_test.py +debian/tests/run-unit-test diff -Nru dnapi-1.1/debian/tests/control dnapi-1.1/debian/tests/control --- dnapi-1.1/debian/tests/control 1970-01-01 00:00:00.000000000 +0000 +++ dnapi-1.1/debian/tests/control 2020-10-24 19:50:24.000000000 +0000 @@ -0,0 +1,3 @@ +Tests: run-unit-test +Depends: @, python3, python3-pytest +Restrictions: allow-stderr diff -Nru dnapi-1.1/debian/tests/run-unit-test dnapi-1.1/debian/tests/run-unit-test --- dnapi-1.1/debian/tests/run-unit-test 1970-01-01 00:00:00.000000000 +0000 +++ dnapi-1.1/debian/tests/run-unit-test 2020-10-24 19:59:24.000000000 +0000 @@ -0,0 +1,38 @@ +#!/bin/bash +set -e + +pkg="dnapi" + +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 -a /usr/share/doc/${pkg}/examples/* $AUTOPKGTEST_TMP + +cd $AUTOPKGTEST_TMP +gunzip -r * + +function compare_ref() +{ + # $1: Test number + # $2, $3: values to be compared + echo "I: Test $1" + if [ "$2" = "$3" ] + then + echo "PASSED!" + else + echo "$2 is not equal to $3" + exit 1 + fi +} + +compare_ref 1 $(dnapi.py good.fq) TGGAATTCTCGG +compare_ref 2 $(dnapi.py -k 8:11:1 -r 1.1:1.4:0.1 good.fq) TGGAATTCTCGG +compare_ref 3 $(dnapi.py --show-all poor.fq | md5sum | awk '{print $1}') 1e4d27f27c0e2bb3ea80871105748d45 +compare_ref 4 $(dnapi.py -k 9 -r 1.4 good.fq) TGGAATTCTCGGGTGCCAAGGAACTCC + +echo "Testing python counterpart ..." +python3 -m pytest -v simple_test.py +echo "PASSED!" + diff -Nru dnapi-1.1/debian/tests/simple_test.py dnapi-1.1/debian/tests/simple_test.py --- dnapi-1.1/debian/tests/simple_test.py 1970-01-01 00:00:00.000000000 +0000 +++ dnapi-1.1/debian/tests/simple_test.py 2020-10-24 20:14:05.000000000 +0000 @@ -0,0 +1,16 @@ +from dnapilib.apred import adapter_prediction +from dnapilib.apred import iterative_adapter_prediction + +def test_functional(): + iterative_result = iterative_adapter_prediction("good.fq", [1.2, 1.3, 1.4], [9, 11], 50000) + single_result = adapter_prediction("good.fq", 1.4, 9, 50000) + + + assert(iterative_result[0][0] == 'TGGAATTCTCGG') + assert(single_result[0][0] == 'TGGAATTCTCGGGTGCCAAGGAACTCC') + + iterative_result = iterative_adapter_prediction("processed.fq", [1.2, 1.3, 1.4], [9, 11], 50000) + single_result = adapter_prediction("processed.fq", 1.4, 9, 50000) + + assert([x[0] for x in iterative_result] == ['TCTGCCCAGTGCTCTG', 'TAATACTGCCTG', 'TGGCAGTGTCTT']) + assert([x[0] for x in single_result] == ['TAATACTGCCTGGTAATGATG', 'TGGCAGTGTCTTAGCTGGTTG', 'CTGCCCAGTGCTCTGAA'])