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
|
#!/bin/bash
set -e
test_pkg=dnaio
# using these data for testing
source_pkg=unicycler-data
if [ "${AUTOPKGTEST_TMP}" = "" ] ; then
AUTOPKGTEST_TMP=$(mktemp -d /tmp/${test_pkg}-test.XXXXXX)
trap "rm -rf ${AUTOPKGTEST_TMP}" 0 INT QUIT ABRT PIPE TERM
fi
if [ -d /usr/share/${source_pkg}/sample_data ] ; then
cp -a /usr/share/${source_pkg}/sample_data/ ${AUTOPKGTEST_TMP}
else
echo "Please install package unicycler-data to run this script"
exit 1
fi
cd ${AUTOPKGTEST_TMP}
cat > simple_test.py << EOL
import os
import dnaio
dir = 'sample_data'
for filename in os.listdir(dir):
print(filename)
with dnaio.open(dir + '/' + filename) as inf:
bp = 0
for record in inf:
bp += len(record)
print(f'The input file contains {bp/1E6:.1f} Mbp')
EOL
# run test
python3 ./simple_test.py
echo "PASS"
|