code: def pomegranate(args):
      
      p = OptionParser(pomegranate.__doc__)
      opts, args, iopts = p.set_image_options(args, figsize="9x7")
  
      if len(args) != 5:
          sys.exit(not p.print_help())
  
      seqidsfile, klayout, datafile, bedfile, slayout = args
  
      fig = plt.figure(1, (iopts.w, iopts.h))
      root = fig.add_axes([0, 0, 1, 1])
  
      Karyotype(fig, root, seqidsfile, klayout)
      Synteny(fig, root, datafile, bedfile, slayout)
  
      # legend showing the orientation of the genes
      draw_gene_legend(root, .42, .52, .48)
  
      labels = ((.04, .96, 'A'), (.04, .52, 'B'))
      panel_labels(root, labels)
  
      root.set_xlim(0, 1)
      root.set_ylim(0, 1)
      root.set_axis_off()
  
      pf = "pomegranate-karyotype"
      image_name = pf + "." + iopts.format
      savefig(image_name, dpi=iopts.dpi, iopts=iopts)
docs: %prog cotton seqids karyotype.layout mcscan.out all.bed synteny.layout
  
      Build a figure that calls graphics.karyotype to illustrate the high ploidy
      of WGD history of pineapple genome. The script calls both graphics.karyotype
      and graphic.synteny.