.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/gallery/structure/ku_superimposition.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_gallery_structure_ku_superimposition.py: Superimposition of two protein structures ========================================= This script superimposes the atom coordinates of the Ku70/80 heterodimer onto the corresponding structure bound to DNA (superimposition of 1JEQ onto 1JEY). The visualisation was coducted with PyMOL. * *Orange*: Ku dimer originally bound to DNA * *Green*: Free Ku dimer .. GENERATED FROM PYTHON SOURCE LINES 13-61 .. code-block:: Python # Code source: Patrick Kunzmann # License: BSD 3 clause from tempfile import NamedTemporaryFile import biotite.structure as struc import biotite.structure.io.pdbx as pdbx import biotite.database.rcsb as rcsb import numpy as np ku_dna_file = NamedTemporaryFile(suffix=".cif") ku_file = NamedTemporaryFile(suffix=".cif") # The output file names # Modify these values for actual file output ku_dna_file_name = ku_dna_file.name ku_file_name = ku_file.name # Download and parse structure files ku_dna = pdbx.get_structure(pdbx.PDBxFile.read(rcsb.fetch("1JEY", "cif")))[0] ku = pdbx.get_structure(pdbx.PDBxFile.read(rcsb.fetch("1JEQ", "cif")))[0] # Remove DNA and water ku_dna = ku_dna[(ku_dna.chain_id == "A") | (ku_dna.chain_id == "B")] ku_dna = ku_dna[~struc.filter_solvent(ku_dna)] ku = ku[~struc.filter_solvent(ku)] # The structures have a differing amount of atoms missing # at the the start and end of the structure # -> Find common structure ku_dna_common = ku_dna[struc.filter_intersection(ku_dna, ku)] ku_common = ku[struc.filter_intersection(ku, ku_dna)] # Superimpose ku_superimposed, transformation = struc.superimpose( ku_dna_common, ku_common, (ku_common.atom_name == "CA") ) # We do not want the cropped structures # -> apply superimposition on original structures ku_superimposed = struc.superimpose_apply(ku, transformation) # Write PDBx files as input for PyMOL cif_file = pdbx.PDBxFile() pdbx.set_structure(cif_file, ku_dna, data_block="ku_dna") cif_file.write(ku_dna_file_name) cif_file = pdbx.PDBxFile() pdbx.set_structure(cif_file, ku_superimposed, data_block="ku") cif_file.write(ku_file_name) # Visualization with PyMOL... ku_dna_file.close() ku_file.close() .. _sphx_glr_download_examples_gallery_structure_ku_superimposition.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: ku_superimposition.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: ku_superimposition.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_