#!/bin/sh
# Extract an entry using srf_extract_linear
chmod u+w $outdir/proc.srf
/usr/bin/srf_extract_linear $outdir/proc.srf test_run:4:134:369:182 > $outdir/_.srf
cmp $outdir/_.srf $srcdir/data/test_run_4_134_369_182.srf || exit 1

# Extract using the hash table method - should fail
echo "NB: The next line is expected to be an error message" 1>&2
/usr/bin/srf_extract_hash $outdir/proc.srf test_run:4:134:369:182 > $outdir/_.srf
[ $? = 1 ] || exit 1

# Index it
/usr/bin/srf_index_hash $outdir/proc.srf
cmp $outdir/proc.srf $srcdir/data/proc.srf.indexed || exit 1

# Extract using the hash table method
/usr/bin/srf_extract_hash $outdir/proc.srf test_run:4:134:369:182 > $outdir/_.srf
[ $? = 0 ] || exit 1

# Check the archive/name access method too
seq=`/usr/bin/extract_seq $outdir/proc.srf/test_run:4:134:369:182 | tr -d '\012\015'`
[ "$seq" = "GGTAGAGATTCTCTTGTTGACATTTTAAAAGAGCGTGTCTGGAAACGTACGGATTGTTCAGTAACTTGACTCAT" ] || exit 1

