#!/bin/sh -e

# Create a temporary file
TABIXDATA=$(mktemp)

# Uncompress example data
zcat /usr/share/doc/tabix/examples/example.gtf.gz > $TABIXDATA

# Compress example data with bgzip
bgzip $TABIXDATA

# Index with tabix
tabix $TABIXDATA.gz

# Extract with tabix the he features on chromosome 1 whose coordinates overlap
# the interval 150,309–150,309.
tabix $TABIXDATA.gz chr1:150309-150309 > $TABIXDATA.out

# Reference result at the bottom of this file
grep H\AVANA /usr/share/doc/tabix/README.test > $TABIXDATA.ref

# No difference ?
diff $TABIXDATA.ref $TABIXDATA.out

# Clean
rm $TABIXDATA.gz $TABIXDATA.gz.tbi $TABIXDATA.out $TABIXDATA.ref
