## Chain.write() — write out chain sequence to an alignment file

`write(file, atom_file, align_code, comment=”, format='PIR', chop_nonstd_termini=True)`

> This writes out the residue sequence of the chain to an alignment file.

> file can be either a file name or a modfile.File() object open in write mode (in which case the structure is appended to the file).

> atom_file and align_code specify the name of the chain's associated atom file, and its alignment code, respectively; suitable values can be obtained from Chain.atom_file_and_code(). comment, if given, specifies a comment to prepend to the alignment file.

> format specifies the format of the output file; see alignment.write(). `PIR` or `FASTA` formats are supported.

> chop_nonstd_termini trims non-standard terminal residues in exactly the same way as for Chain.filter().

> This command is not available for alignment sequences, because the PDB residue numbers (only available in template structures or models) are needed to write the PIR header.

Example: See Chain.filter() command.