analyze fa (names, insertions) and convert fasta to prodigal/cmscan safe file
    - find insertions (masked sequence)
    - make upper case
    - assign names to id number

def analyze_fa(fa):
    """
    analyze fa (names, insertions) and convert fasta to prodigal/cmscan safe file
    - find insertions (masked sequence)
    - make upper case
    - assign names to id number
    """
    if fa.name == '<stdin>':
        safe = 'temp.id'
    else:
        safe = '%s.id' % (fa.name)
    safe = open(safe, 'w')
    sequences = {} # sequences[id] = sequence
    insertions = {} # insertions[id] = [[start, stop], [start, stop], ...]
    count = 0
    id2name = {}
    names = []
    for seq in parse_fasta(fa):
        id = '%010d' % (count,)
        name = seq[0].split('>', 1)[1]
        id2name[id] = name
        id2name[name] = id
        names.append(name)
        insertions[id] = insertions_from_masked(seq[1])
        sequences[id] = seq
        print('\n'.join(['>%s' % (id), seq[1].upper()]), file=safe)
        count += 1
    safe.close()
    lookup = open('%s.id.lookup' % (fa.name), 'w')
    for i in list(id2name.items()):
        print('\t'.join(i), file=lookup)
    lookup.close()
    return safe.name, sequences, id2name, names, insertions