def publocus(args):
    """
    %prog publocus idsfile > idsfiles.publocus

    Given a list of model identifiers, convert each into a GenBank approved
    pub_locus.

    Example output:
    Medtr1g007020.1		MTR_1g007020
    Medtr1g007030.1		MTR_1g007030
    Medtr1g007060.1		MTR_1g007060A
    Medtr1g007060.2		MTR_1g007060B
    """
    p = OptionParser(publocus.__doc__)
    p.add_option("--locus_tag", default="MTR_",
                 help="GenBank locus tag [default: %default]")
    opts, args = p.parse_args(args)

    if len(args) != 1:
        sys.exit(not p.print_help())

    locus_tag = opts.locus_tag

    index = AutoVivification()
    idsfile, = args
    fp = must_open(idsfile)
    for row in fp:
        locus, chrom, sep, rank, iso = atg_name(row, retval="locus,chr,sep,rank,iso")
        if None in (locus, chrom, sep, rank, iso):
            logging.warning("{0} is not a valid gene model identifier".format(row))
            continue
        if locus not in index.keys():
            pub_locus = gene_name(chrom, rank, prefix=locus_tag, sep=sep)
            index[locus]['pub_locus'] = pub_locus
            index[locus]['isos'] = set()

        index[locus]['isos'].add(int(iso))

    for locus in index:
        pub_locus = index[locus]['pub_locus']
        index[locus]['isos'] = sorted(index[locus]['isos'])
        if len(index[locus]['isos']) > 1:
            new = [chr(n+64) for n in index[locus]['isos'] if n < 27]
            for i, ni in zip(index[locus]['isos'], new):
                print("\t".join(x for x in ("{0}.{1}".format(locus, i), \
                                            "{0}{1}".format(pub_locus, ni))))
        else:
            print("\t".join(x for x in ("{0}.{1}".format(locus, index[locus]['isos'][0]), \
                                        pub_locus)))
%prog publocus idsfile > idsfiles.publocus

    Given a list of model identifiers, convert each into a GenBank approved
    pub_locus.

    Example output:
    Medtr1g007020.1		MTR_1g007020
    Medtr1g007030.1		MTR_1g007030
    Medtr1g007060.1		MTR_1g007060A
    Medtr1g007060.2		MTR_1g007060B