#!/bin/sh


# given a set of accessions, create a file
# containing the corresponding genbank entries
#
#  $1 file containing LOCUS names or ACCESSION numbers
#  $2 file to contain all of the GenBank entries
# comments may be present in the infile as lines that begin with a semicolon

JOBID=$$
INFILE=$1
OUTFILE=$2

grep -v  -E "\;" < $INFILE > $INFILE.$JOBID

cat $INFILE.$JOBID | efetch -db nucleotide -format gb > $JOBID.tmp  
cat $JOBID.tmp >> $OUTFILE
rm -f $JOBID.tmp
rm -f $INFILE.$JOBID