code: def prepare(args):
      
      p = OptionParser(prepare.__doc__)
      p.add_option("--first", default=0, type="int",
                   help="Use only first N reads [default: %default]")
      opts, args = p.parse_args(args)
  
      if len(args) != 1:
          sys.exit(not p.print_help())
  
      jfile, = args
      metafile = jfile + ".meta"
  
      if need_update(jfile, metafile):
          fp = open(jfile)
          fastqfiles = [x.strip() for x in fp if ".fastq" in x]
          metas = [Meta(x) for x in fastqfiles]
  
          fw = open(metafile, "w")
          print("\n".join(str(x) for x in metas), file=fw)
          print("Now modify `{0}`, and restart this script.".\
                              format(metafile), file=sys.stderr)
          print("Each line is : genome library fastqfile", file=sys.stderr)
          fw.close()
          return
  
      mf = MetaFile(metafile)
      for m in mf:
          m.make_link(firstN=opts.first)
docs: %prog prepare jira.txt
  
      Parse JIRA report and prepare input. Look for all FASTQ files in the report
      and get the prefix. Assign fastq to a folder and a new file name indicating
      the library type (e.g. PE-500, MP-5000, etc.).
  
      Note that JIRA report can also be a list of FASTQ files.