def print_seqs(seqs, id2name, name):
    """
    print fasta of introns and ORFs
    # seqs[id] = [gene, model, [[i-gene_pos, i-model_pos, i-length, iseq, [orfs], [introns], orfs?, introns?, [orf annotations]], ...]]
    """
    orfs = open('%s.orfs.faa' % name.rsplit('.', 1)[0], 'w')
    introns = open('%s.introns.fa' % name.rsplit('.', 1)[0], 'w')
    insertions = open('%s.insertions.fa' % name.rsplit('.', 1)[0], 'w')
    for seq in seqs:
        for i, ins in enumerate(seqs[seq][2], 1):
            model_pos = ins[1]
            if ins[6] is True:
                for orf in ins[4]:
                    orf_info = orf[0].split('>')[1].split()
                    id = orf_info[0].split('_', 1)[0]
                    name = id2name[id]
                    annotation = orf_info[1]
                    strand = orf_info[7]
                    if strand == '1':
                        strand = '+'
                    else:
                        strand = '-'
                    start, stop = sorted([int(orf_info[3]), int(orf_info[5])])
                    header = (
                        '>%s insertion::seq=%s type=%s strand=%s gene-pos=%s-%s model-pos=%s'
                         % (name, i, annotation, strand, start, stop,
                        model_pos))
                    print('\n'.join([header, orf[1]]), file=orfs)
            if ins[7] is True:
                for intron in ins[5]:
                    id, type, strand, pos = intron[0].split('>', 1)[1].split()
                    name = id2name[id.split('_')[0]]
                    header = (
                        '>%s insertion::seq=%s type=%s strand=%s gene-pos=%s model-pos=%s'
                         % (name, i, type, strand, pos, model_pos))
                    print('\n'.join([header, intron[1]]), file=introns)
            insertion = ins[3]
            id, info = insertion[0].split('>')[1].split(' ', 1)
            name = id2name[id.split('_')[0]]
            header = '>%s %s' % (name, info)
            print('\n'.join([header, insertion[1]]), file=insertions)
    insertions.close()
    orfs.close()
    introns.close()
