Skip to main content
Ctrl+K
Biotite - Home
  • Tutorial
  • Installation
  • API Reference
  • Examples
  • Extensions
  • Contributor guide
  • Logo
  • GitHub
  • PyPI
  • News
  • Tutorial
  • Installation
  • API Reference
  • Examples
  • Extensions
  • Contributor guide
  • Logo
  • GitHub
  • PyPI
  • News

Section Navigation

  • Sequence examples
    • Homology and alignment
      • Pairwise sequence alignment of protein sequences
      • Customized visualization of a multiple sequence alignment
      • Finding homologous regions in two genomes
      • Finding homologs of a gene in a genome
      • Phylogenetic tree of a protein family
      • Hydropathy and conservation of ion channels
      • Dendrogram of a protein family
      • Homology search and multiple sequence alignment
      • Conservation of binding site
      • Fetching and aligning a protein from different species
      • Display sequence similarity in a heat map
      • Plot epitope mapping data onto protein sequence alignments
      • Mutual information as measure for coevolution of residues
      • Polymorphisms in a gene
    • Sequence read quality control and mapping
      • Quantifying gene expression from RNA-seq data
      • Comparative genome assembly
      • Quality control of sequencing data
      • Quality of sequence reads
    • Sequence profiles
      • Sequence logo of sequences with equal length
      • Identification of a binding site by sequence conservation
    • Features and annotations
      • Feature map of a synthetic operon
      • Plasmid map of a vector
      • Visualization of a custom plasmid
      • Visualization of a region in proximity to a feature
      • Domains of bacterial sigma factors
    • Miscellaneous
      • Dendrogram of a substitution matrix
      • Calculation of codon usage
      • Biotite color schemes
      • Biotite color schemes for protein sequences
      • Statistics of local alignments and the E-value
      • Identification of potential open reading frames
  • Structure examples
    • Protein backbone and secondary structure
      • Assembly of a straight peptide from sequence
      • Ramachandran plot of dynein motor domain
      • Determination of amino acid enantiomers
      • Arrangement of beta-sheets
      • Three ways to get the secondary structure of a protein
    • Nucleic acid base pairs and secondary structure
      • Plotting the base pairs of a tRNA-like-structure
      • Leontis-Westhof Nomenclature
      • Comparison of a tRNA-like-structure with a tRNA
      • Visualization of Watson-Crick base pairs
    • Small molecules
      • Enumeration of alkane isomers
      • Molecular visualization of a small molecule using Matplotlib
      • Partial charge distribution
    • Proximity and contacts
      • Construction of an adjacency matrix
      • Contact sites of protein-DNA interaction
      • Detection of disulfide bonds
      • Hydrogen bonds between protein domains
      • Identification of lipid bilayer leaflets
    • Molecular dynamics and docking
      • Docking a ligand to a receptor
      • Basic analysis of a MD simulation
      • BinaryCIF as trajectory format
      • LDDT for predicted structure evaluation
      • Visualization of normal modes from an elastic network model
      • Creation of an amino acid rotamer library
      • Analysis of solvation shells
      • Secondary structure during an MD simulation
      • Cavity solvation in different states of an ion channel
    • Structural alphabets
      • Multiple Structural alignment of orthologous proteins
      • Searching for structural homologs in a protein structure database
    • Miscellaneous
      • Biological assembly of a structure
      • Calculation of protein diameter
      • Identifying unresolved regions in protein structures
      • Visualization of glycosylated amino acids
      • Superimposition of homologous protein structures
      • Annual releases of PDB structures
  • Examples
  • Miscellaneous
  • Identifying...

Note

Go to the end to download the full example code.

Identifying unresolved regions in protein structures#

This script creates two bars, each indicating gaps in the structure of DNA-PKcs. The top bar indicates the missing residues in a recent crystal structure (PDB: 5LUQ), the bottom bar indicates missing residues in a recent cryo-EM structure (PDB: 5W1R).

  • Green: Space-resolved residues

  • Yellow: Residues with merely polyalanine annotation

  • Red: Unresolved residues

5luq, 5w1r
# Code source: Patrick Kunzmann
# License: BSD 3 clause

from tempfile import gettempdir
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.patches import Rectangle
import biotite.database.rcsb as rcsb
import biotite.structure.io as strucio


def plot_gaps(pdb_id, chain_id, ax):
    # Download and parse structure file
    path = rcsb.fetch(pdb_id, "bcif", gettempdir())
    atom_array = strucio.load_structure(path)
    # Consider only one chain
    atom_array = atom_array[atom_array.chain_id == chain_id]
    # Array for saving the 'green', 'yellow' and 'red' state
    states = np.zeros(atom_array.res_id[-1], dtype=int)
    for i in range(len(states)):
        # Get array for only one residue ID
        residue = atom_array[atom_array.res_id == i + 1]
        if len(residue) == 0:
            # not existing
            states[i] = 0
        elif residue.res_name[0] == "UNK":
            # exisiting but polyalanine
            states[i] = 1
        else:
            # existing
            states[i] = 2

    # Find the intervals for each state
    state_intervals = []
    curr_state = None
    curr_start = None
    for i in range(len(states)):
        if curr_start is None:
            curr_start = i
            curr_state = states[i]
        else:
            if states[i] != states[i - 1]:
                state_intervals.append((curr_start, i, curr_state))
                curr_start = i
                curr_state = states[i]
    state_intervals.append((curr_start, i, curr_state))

    # Draw the state intervals as colored rectangles
    for interval in state_intervals:
        start = interval[0]
        stop = interval[1]
        state = interval[2]
        if state == 0:
            color = "firebrick"
        elif state == 1:
            color = "gold"
        elif state == 2:
            color = "forestgreen"
        ax.add_patch(
            Rectangle(
                (start + 1 - 0.5, 0), stop - start, 1, edgecolor="None", facecolor=color
            )
        )
    # Some other visual stuff
    ax.spines["left"].set_visible(False)
    ax.spines["bottom"].set_visible(False)
    ax.spines["right"].set_visible(False)
    ax.spines["top"].set_visible(False)
    ax.yaxis.set_visible(False)
    ax.set_xlim(0.5, len(states) + 0.5)
    ax.set_ylim(0, 2)


fig = plt.figure(figsize=(8.0, 2.5))
ax = fig.add_subplot(211)
ax.set_title("5luq", loc="left")
plot_gaps("5luq", "A", ax)
ax = fig.add_subplot(212)
ax.set_title("5w1r", loc="left")
plot_gaps("5w1r", "A", ax)
ax.set_xlabel(r"$Residue \ number$")
fig.tight_layout()
plt.show()

Download Jupyter notebook: gap_bars.ipynb

Download Python source code: gap_bars.py

Download zipped: gap_bars.zip

Gallery generated by Sphinx-Gallery

Edit on GitHub
Show Source

© Copyright The Biotite contributors.

Created using Sphinx 8.2.3.

Built with the PyData Sphinx Theme 0.15.4.