AUTODETECT      "LOCUS       *\nORIGIN*"

KEYWIDTH        12
FILETAG         GB

BEGIN           "LOCUS*"

# set variables used by feature table 
SETGLOBAL       t GB
SETGLOBAL       u gb

# uncomment next line to tag ALL fields with [GB]
# AUTOTAG "GB"


MATCH           "LOCUS *"
                SRT             "* *=*1"
                WRITE           "name"

MATCH           "LOCUS *"
                SRT             "* *=*1"
                TAG             "GB"
                WRITE           "id"

#MATCH           "LOCUS *"
#                SRT             "     = :    = :   = :  = :* * *=*2"
#                TAG             "GB"
#                WRITE           "db_nuc"

MATCH           "ACCESSION *"
                ACI             "extract_words("0123456789",2.0)"
                WRITE           "acc"

#MATCH           "ACCESSION *"
#                ACI             "extract_words("0123456789",4.0)"
#                TAG             "GB"
#                WRITE           "db_acc"

MATCH           "PROJECT"
#                TAG             "GB"
                WRITE_INT        "insdc"

MATCH           "LOCUS *"
                SRT             "     = :    = :   = :  = :* * * * * * *=*7"
#                TAG             "GB"
                WRITE           "date"

MATCH           "DEFINITION"
#                TAG             "GB"
                WRITE           "description"

MATCH           "KEYWORDS *"
#                TAG             "GB"
                APPEND          "keywords"

MATCH           "  ORGANISM *"
                SRT             "* * *=*1 *2:*|*=*1"
                WRITE           "full_name"

MATCH           "  ORGANISM *"
#                TAG             "GB"
                SRT             "*|*=*1"
                WRITE           "tax_gb_name"

MATCH           "  ORGANISM *"
#                TAG             "GB"
                SRT             "*|*=*2"
                WRITE           "tax_gb"

MATCH           "REFERENCE *"
                SRT             "* *=*1"
                SETVAR          x
                IFNOTSET        x "No REFERENCE seen"
#                TAG             "GB"
#                APPEND          "num_bib"

MATCH           "REFERENCE *"
                SRT             "*(*=*2:bases=:to=-: =:)=:*=[$x]\: *"
#                TAG             "GB"
                APPEND          "nuc_rp"

MATCH           "  MEDLINE *"
#                SRT             "*=[$x]\: *"
#                TAG             "GB"
                APPEND          "medline_id"

MATCH           "   PUBMED *"
#                SRT             "*=[$x]\: *"
#                TAG             "GB"
                APPEND          "pubmed_id"

MATCH           "  CONSRTM *"
                SRT             "*=[$x]\: *"
                TAG             "GB"
                APPEND          "refgrp"
                
MATCH           "  AUTHORS *"
                SRT             "*=[$x]\: *"
#                TAG             "GB"
                APPEND          "author"

MATCH           "  TITLE *"
                SRT             "*=[$x]\: *"
#                TAG             "GB"
                APPEND          "title"

MATCH           "  JOURNAL *"
                SRT             "*=[$x]\: *"
#                TAG             "GB"
                APPEND          "journal"

MATCH           "  JOURNAL *Submitted*"
                SRT             "*Submitted*=*2:\(*\)*=*1"
#                TAG             "GB"
                WRITE           "submit_date"

MATCH           "     Protein*note*"
                SRT             "*/note\=\"*\"*=*2"
                TAG             "GB"
                APPEND          "note"

#MATCH           "     Protein*EC_number*"
#                SRT             "*/EC_number\=\"*\"*=*2"
#                TAG             "GB"
#                APPEND          "EC_number"

#MATCH           "     Protein*product=*"
#                SRT             "*/product\=\"*\"*=*2"
#                TAG             "GB"
#                APPEND          "gene_prod"

# maybe works with FT prefix (untested):
# (@@@ put into feature table when tested)
#MATCH           "FTx*Protein*note*"
#                SRT             "*/note\=\"*\"*=*2"
#                TAG             "GB"
#                APPEND          "description"
#MATCH           "FTx*Protein*EC_number*"
#                SRT             "*/EC_number\=\"*\"*=*2"
#                TAG             "GB"
#                APPEND          "EC_number"
#MATCH           "FTx*Protein*product=*"
#                SRT             "*/product\=\"*\"*=*2"
#                TAG             "GB"
#                APPEND          "gene_prod"

# -----------------------------------------------------------------
# Feature table (used by longebi.ift and longgenbank.ift!)

INCLUDE         "feature_table.ift"

# ---------------------------------------------------------------

SEQUENCEAFTER   "ORIGIN*"
SEQUENCESRT     " =:~=.:*Check*..="
SEQUENCEACI     "remove("0123456789 /")"
SEQUENCECOLUMN  0
SEQUENCEEND     "//"

CREATE_ACC_FROM_SEQUENCE

END             "//"
