code: def flip(args):
      
      p = OptionParser(flip.__doc__)
      opts, args = p.parse_args(args)
  
      if len(args) != 1:
          sys.exit(not p.print_help())
  
      fastafile, = args
      outfastafile = fastafile.rsplit(".", 1)[0] + ".flipped.fasta"
      fo = open(outfastafile, "w")
      f = Fasta(fastafile, lazy=True)
      for name, rec in f.iteritems_ordered():
          tmpfasta = "a.fasta"
          fw = open(tmpfasta, "w")
          SeqIO.write([rec], fw, "fasta")
          fw.close()
  
          o = overlap([tmpfasta, name])
          if o.orientation == '-':
              rec.seq = rec.seq.reverse_complement()
  
          SeqIO.write([rec], fo, "fasta")
          os.remove(tmpfasta)
docs: %prog flip fastafile
  
      Go through each FASTA record, check against Genbank file and determines
      whether or not to flip the sequence. This is useful before updates of the
      sequences to make sure the same orientation is used.