text: user818: If we have a PDB structrure, how can we find residues physically interacting with each other in space? I know that we must find the distance between residues and if the distance is less than 5-6 Angstrom, we say that residues are physically interacting. But how can we find the distance between all residues and how can we finally determine the distances between all residues? Is there a software or webserver for that?
  
  user48: As part of a project me and some teammates did a script that outputs visual maps of distances between residues. It uses Biopython. 
  The module contact_map.py does what you are looking for. As an example, if you want to find the residues whose CA are below 5 you can run the following command:
  python3 contact_map.py pdb1cd8.ent -a CA -CA 5 
  
  This will produce three files:
  distance_map_pdb1cd8_CA.png # Heatmap of the distance between the residues
  contact_map_pdb1cd8_CA.png # Black/White heatmap: If it is at that min distance
  contact_map.log  # The actions taken
  
  If you don't have downloaded already the pdb structue you can use the main module:
  python3 cozmic.py real 1cd8 -a CA -CA 5 
  
  
  user252: Could you use CCP4's NCONT program? There's a GUI and a command line interface, whatever suits. You can specify which chains you want to target and interact with and set a cut off for distance. The bonus here is once you're in you have a nice suite of other structural tools to use.
  If you're just doing it once, the GUI is friendly enough to work things out, if you're doing a batch then you can run it across several files via the command line.
  Download
  
  user191: If you need to process multiple files, you could use Biopython to parse a PDB structure.
  from Bio.PDB import PDBParser
  
  # create parser
  parser = PDBParser()
  
  # read structure from file
  structure = parser.get_structure('PHA-L', '1fat.pdb')
  
  model = structure[0]
  chain = model['A']
  
  # this example uses only the first residue of a single chain.
  # it is easy to extend this to multiple chains and residues.
  for residue1 in chain:
      for residue2 in chain:
          if residue1 != residue2:
              # compute distance between CA atoms
              try:
                  distance = residue1['CA'] - residue2['CA']
              except KeyError:
                  ## no CA atom, e.g. for H_NAG
                  continue
              if distance < 6:
                  print(residue1, residue2, distance)
          # stop after first residue
          break
  
  If you need to look at one structure, using a viewer perhaps would be easier. You could try PyMOL: (how to measure distance). There are other PDB viewers, some of which can work even through a browser.
  
original_text: 818: <p>If we have a PDB structrure, how can we find residues physically interacting with each other in space? I know that we must find the distance between residues and if the distance is less than 5-6 Angstrom, we say that residues are physically interacting. But how can we find the distance between all residues and how can we finally determine the distances between all residues? Is there a software or webserver for that?</p>
   48: <p>As part of a project me and some teammates did a <a href="https://github.com/llrs/PYT-SBI" rel="nofollow noreferrer">script</a> that outputs visual maps of distances between residues. It uses Biopython. </p>
  
  <p>The module contact_map.py does what you are looking for. As an example, if you want to find the residues whose CA are below 5 you can run the following command:</p>
  
  <pre><code>python3 contact_map.py pdb1cd8.ent -a CA -CA 5 
  </code></pre>
  
  <p>This will produce three files:</p>
  
  <pre><code>distance_map_pdb1cd8_CA.png # Heatmap of the distance between the residues
  contact_map_pdb1cd8_CA.png # Black/White heatmap: If it is at that min distance
  contact_map.log  # The actions taken
  </code></pre>
  
  <p>If you don't have downloaded already the pdb structue you can use the main module:</p>
  
  <pre><code>python3 cozmic.py real 1cd8 -a CA -CA 5 
  </code></pre>
   252: <p>Could you use CCP4's NCONT program? There's a GUI and a command line interface, whatever suits. You can specify which chains you want to target and interact with and set a cut off for distance. The bonus here is once you're in you have a nice suite of other structural tools to use.</p>
  
  <p>If you're just doing it once, the GUI is friendly enough to work things out, if you're doing a batch then you can run it across several files via the command line.</p>
  
  <p><a href="http://www.ccp4.ac.uk/download/" rel="nofollow noreferrer">Download</a></p>
   191: <p>If you need to process multiple files, you could use <a href="http://biopython.org/wiki/The_Biopython_Structural_Bioinformatics_FAQ" rel="noreferrer">Biopython</a> to parse a PDB structure.</p>
  
  
  
  <pre class="lang-python prettyprint-override"><code>from Bio.PDB import PDBParser
  
  # create parser
  parser = PDBParser()
  
  # read structure from file
  structure = parser.get_structure('PHA-L', '1fat.pdb')
  
  model = structure[0]
  chain = model['A']
  
  # this example uses only the first residue of a single chain.
  # it is easy to extend this to multiple chains and residues.
  for residue1 in chain:
      for residue2 in chain:
          if residue1 != residue2:
              # compute distance between CA atoms
              try:
                  distance = residue1['CA'] - residue2['CA']
              except KeyError:
                  ## no CA atom, e.g. for H_NAG
                  continue
              if distance &lt; 6:
                  print(residue1, residue2, distance)
          # stop after first residue
          break
  </code></pre>
  
  <p>If you need to look at one structure, using a viewer perhaps would be easier. You could try <a href="https://www.pymol.org/" rel="noreferrer">PyMOL</a>: (<a href="https://pymolwiki.org/index.php/Distance" rel="noreferrer">how to measure distance</a>). There are other PDB viewers, some of which can work even through a browser.</p>
  