## profile.write() — write a profile

`write(file, profile_format)`

> This command will write a profile to a specified file, together with a number of variables that are associated with the profile in the memory. Two formats are supported: `TEXT` and `BINARY`.

> For `TEXT` files, file can be either a file name or a writeable file handle (see modfile.File()). For `BINARY` files, it must be a file name.

Example: examples/commands/aln_to_prof.py

      from modeller import *
      env = environ()

      # Read in the alignment file
      aln = alignment(env)
      aln.append(file='toxin.ali', alignment_format='PIR', align_codes='ALL')

      # Convert the alignment to profile format
      prf = aln.to_profile()

      # Write out the profile

      # in text file
      prf.write(file='alntoprof.prf', profile_format='TEXT')

      # in binary format
      prf.write(file='alntoprof.bin', profile_format='BINARY')