#!/bin/sh
# autopkgtest check: Run miniasm on example data
# Author: Sascha Steinbiss <sascha@steinbiss.name>
set -e

DATADIR=$(pwd)/debian/tests
WORKDIR=$(mktemp -d)

trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
cd $WORKDIR

# prepare reference
cp -p $DATADIR/L_donovani.1.fasta .
gt encseq encode -lossless L_donovani.1.fasta

# sample reads
gt simreads -coverage 40 -minlen 3000 -maxlen 4000 L_donovani.1.fasta \
  | gt mutate > reads.fasta

# self-match and assemble
minimap -Sw5 -L100 -m0 reads.fasta reads.fasta | gzip -1 > out.paf.gz
miniasm -f reads.fasta out.paf.gz > out.gfa

# we expect an output file
[ -s out.gfa ]

echo "run: OK"
