code: def fpkm(args):
      
      p = OptionParser(fpkm.__doc__)
      opts, args = p.parse_args(args)
  
      if len(args) < 2:
          sys.exit(not p.print_help())
  
      fastafile = args[0]
      bamfiles = args[1:]
      # Create a DUMMY gff file for cuffdiff
      gffile = fastafile.rsplit(".", 1)[0] + ".gff"
      if need_update(fastafile, gffile):
          fw = open(gffile, "w")
          f = Fasta(fastafile, lazy=True)
          for key, size in f.itersizes_ordered():
              print("\t".join(str(x) for x in (key, "dummy", "transcript",\
                  1, size, ".", ".", ".", "ID=" + key)), file=fw)
          fw.close()
          logging.debug("Dummy GFF created: {0}".format(gffile))
  
      cmd = "cuffdiff {0} {1}".format(gffile, " ".join(bamfiles))
      sh(cmd)
docs: %prog fpkm fastafile *.bam
  
      Calculate FPKM values from BAM file.