def main ():
    '''Main'''
    options = get_opt()
    try:
        fh = open(options.infile)
    except:
        chilli.print2stderr('Error: can not open file: %s' % (options.infile))

    records = FFP.parse(fh)
    result_fasta_array = convert(records)
    out = format2fasta(result_fasta_array)
    if options.outfile == sys.stdout:
        print out
    else:
        fo = open(options.outfile, 'w')
        fo.write(out)
        fo.close()
def iupac2normal(seq, prefixes=['']):
    '''Returns a list containing degenerate nucleic acid sequences based on the IUPAC table
    Reference: http://lists.open-bio.org/pipermail/biopython/2006-September/003190.html 
    '''
    if len(seq) == 0:
        return prefixes
    else:
        first = seq[0]
        last_seq = seq[1:]
        new_prefixes = []
        for prefix in prefixes:
            if first in iupac_dict:
                for base in iupac_dict[first]:
                    new_prefixes.append(prefix + base)
            else:
                chilli.print2stderr('Error: not recognized base: %s.' % (first))

        return iupac2normal(last_seq, prefixes = new_prefixes)