#!/bin/sh

CDIR=$PWD
cd $GB
for division in `cat $CDIR/div`
do
    echo '<${GB}/' > $CDIR/$division.nam
    if [  -e $division.00.psq  ]
    then
       echo $division
       ls -1 $division.[0-9][0-9].psq | sed -e 's/.psq/ 12/' >> $CDIR/$division.nam
    fi
    if [  -e $division.00.nsq  ]
    then
       echo $division
       ls -1 $division.[0-9][0-9].nsq | sed -e 's/.nsq/ 12/' >> $CDIR/$division.nam
    fi 

    # some divisions have more than 100 sequence files, so we have to create lines for those too
    if [  -e $division.100.psq  ]
    then
       echo $division
       ls -1 $division.[0-9][0-9][0-9].psq | sed -e 's/.psq/ 12/' >> $CDIR/$division.nam
    fi
    if [  -e $division.100.nsq  ]
    then
       echo $division
       ls -1 $division.[0-9][0-9][0-9].nsq | sed -e 's/.nsq/ 12/' >> $CDIR/$division.nam
    fi 

    # the PDB nucleotide division is a special case



done
