#! /bin/csh -f
#
# script to make author index for the genbank library
#
# NOTE only active for primate file
#

echo "genbauthor.script Version 1.0"

set RM = "echo /bin/rm -f"
set SORT = "sort -T tmp"

#
#
#
set WORDS = $STADENROOT/seqman/stopwords

genbauthor gbpri.seq gbpri.list
if ( $status ) goto abort
genbauthor gbrod.seq gbrod.list
if ( $status ) goto abort
genbauthor gbmam.seq gbmam.list
if ( $status ) goto abort
genbauthor gbvrt.seq gbvrt.list
if ( $status ) goto abort
genbauthor gbinv.seq gbinv.list
if ( $status ) goto abort
genbauthor gbpln.seq gbpln.list
if ( $status ) goto abort
genbauthor gborg.seq gborg.list
if ( $status ) goto abort
genbauthor gbbct.seq gbbct.list
if ( $status ) goto abort
genbauthor gbrna.seq gbrna.list
if ( $status ) goto abort
genbauthor gbvrl.seq gbvrl.list
if ( $status ) goto abort
genbauthor gbphg.seq gbphg.list
if ( $status ) goto abort
genbauthor gbsyn.seq gbsyn.list
if ( $status ) goto abort
genbauthor gbuna.seq gbuna.list
if ( $status ) goto abort

${SORT} -u gbpri.list gbrod.list gbmam.list gbvrt.list gbinv.list gbpln.list gborg.list gbbct.list gbrna.list gbvrl.list gbphg.list gbsyn.list gbuna.list >! author.sorted
if ( $status ) goto abort
${RM} gbpri.list gbrod.list gbmam.list gbvrt.list gbinv.list gbpln.list gborg.list gbbct.list gbrna.list gbvrl.list gbphg.list gbsyn.list gbuna.list 

# sort on entry name
#${SORT} -u gbpri.list >! author.sorted
#if ( $status ) goto abort
#${RM} gbpri.list

# include entry numbers in the file
freetext2 author.sorted author.entry
if ( $status ) goto abort
${RM} author.sorted

# sort on text
${SORT} -b +2 author.entry >! author.sorted2
if ( $status ) goto abort
${RM} author.entry

# create the index
hitNtrg author.sorted2 author.trg author.hit 35
if ( $status ) goto abort
${RM} author.sorted2

exit 0

#
# Abort
#
abort:
echo "genbauthor.script: aborting due to serious error"
exit 2
