Emit the short reads first

def get_short_reads(vals):
   (args,txome,seed,chunk) = vals
   #fast forward some ammount
   """Emit the short reads first"""
   txe = TranscriptomeEmitter(txome,TranscriptomeEmitter.Options(seed=seed))
   if args.weights:
      weights = {}
      if args.weights[-3:]=='.gz': inf = gzip.open(args.weights)
      else: inf = open(args.weights)
      for line in inf:
         f = line.rstrip().split("\t")
         weights[f[0]] = float(f[1])
      txs = {}
      for tx in txome.transcripts: txs[tx.name] = tx.length
      for name in weights:
         weights[name] *= txs[name]
      txe.set_weights_by_dict(weights)
   else:
      weights = {}
      txs = {}
      for tx in txome.transcripts: txs[tx.name] = tx.length
      txe.set_weights_by_dict(weights)
   reademit = ReadEmitter(txe)
   shortreads = []
   sp = args.short_read_insert_size
   reademit.cutter.set_custom(sp[0],sp[1],sp[2])
   if args.short_read_error_rate: 
      emfr = ErrorMakerFlatRate(rate=args.short_read_error_rate,rand=reademit.options.rand)
      reademit.add_error_maker(emfr)
   for i in range(0,chunk):
      e = reademit.emit(args.short_read_length)
      shortreads.append(e)
   return shortreads