code: def seq_info(names, id2names, insertions, sequences):
      
      seqs = {} # seqs[id] = [gene, model, [[i-gene_pos, i-model_pos, i-length, iseq, [orfs], [introns]], ...]]
      for name in names:
          id = id2names[name]
          gene = name.split('fromHMM::', 1)[0].rsplit(' ', 1)[1]
          model = name.split('fromHMM::', 1)[1].split('=', 1)[1].split()[0]
          i_gene_pos = insertions[id] # coordinates of each insertion wrt gene
          i_model_pos = name.split('fromHMM::', 1)[1].split('model-pos(ins-len)=')[1].split()[0].split(';') # model overlap
          i_info = []
          for i, ins in enumerate(i_gene_pos):
              model_pos = i_model_pos[i].split('-')[1].split('(')[0]
              length = i_model_pos[i].split('(')[1].split(')')[0]
              iheader = '>%s_%s insertion::seq=%s type=insertion strand=n/a gene-pos=%s-%s model-pos=%s'\
                      % (id, (i + 1), (i + 1), ins[0], ins[1], model_pos)
              iseq = sequences[id][1][ins[0]:(ins[1] + 1)]
              iseq = [iheader, iseq]
              info = [ins, model_pos, length, iseq, [], []]
              i_info.append(info)
          seqs[id] = [gene, model, i_info]
      return seqs
docs: get insertion information from header