~ubuntu-branches/ubuntu/natty/python-cogent/natty

« back to all changes in this revision

Viewing changes to doc/cookbook/structural_contacts.rst

  • Committer: Bazaar Package Importer
  • Author(s): Steffen Moeller
  • Date: 2010-12-04 22:30:35 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101204223035-j11kinhcrrdgg2p2
Tags: 1.5-1
* Bumped standard to 3.9.1, no changes required.
* New upstream version.
  - major additions to Cookbook
  - added AlleleFreqs attribute to ensembl Variation objects.
  - added getGeneByStableId method to genome objects.
  - added Introns attribute to Transcript objects and an Intron class.
  - added Mann-Whitney test and a Monte-Carlo version
  - exploratory and confirmatory period estimation techniques (suitable for
    symbolic and continuous data)
  - Information theoretic measures (AIC and BIC) added
  - drawing of trees with collapsed nodes
  - progress display indicator support for terminal and GUI apps
  - added parser for illumina HiSeq2000 and GAiix sequence files as 
    cogent.parse.illumina_sequence.MinimalIlluminaSequenceParser.
  - added parser to FASTQ files, one of the output options for illumina's
    workflow, also added cookbook demo.
  - added functionality for parsing of SFF files without the Roche tools in
    cogent.parse.binary_sff
  - thousand fold performance improvement to nmds
  - >10-fold performance improvements to some Table operations

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Intramolecular contacts
 
2
-----------------------
 
3
 
 
4
This section of the documentation explains how to use several PyCogent modules to find contacts between macromolecular entities e.g. residues or chains both within and outside the context of a crystal. It assumes that the following boilerplate code is entered into the interpreter. This includes the necessary imports and sets up a working set of ``Entity`` instances.
 
5
 
 
6
.. doctest::
 
7
 
 
8
    >>> from cogent.struct import contact
 
9
    >>> from cogent.parse.pdb import PDBParser
 
10
    >>> from cogent.struct import selection, manipulation, annotation
 
11
    >>> pdb_fh = open('data/1HQF.pdb')
 
12
    >>> pdb_structure = PDBParser(pdb_fh)
 
13
    >>> model = pdb_structure[(0,)]
 
14
    >>> chainA = model[('A',)]
 
15
    >>> chainB = model[('B',)]
 
16
    >>> chainC = model[('C',)]
 
17
 
 
18
Find contacts within a asymmetric unit
 
19
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
20
 
 
21
To find contacts and save the result in the xtra dictionary of an ``Entity`` instance we have to use the ``contact.contacts_xtra`` function. This function calls is a wrapper around a low level function to find the contacts and annotates the input with the result of this call, but also returns a dictionary of the annotations.
 
22
 
 
23
In this simple case we do not look for contacts in the crystal lattice, but for contacts between chains in the asymmetric unit, which corresponds to the default parameters of the ``contacts_xtra`` function. We seek for all contacts between all atoms in the asymmetric unit, which are at most 5.0A apart and belong to different chains.
 
24
 
 
25
.. doctest::
 
26
 
 
27
    >>> conts = contact.contacts_xtra(model, xtra_key='CNT', search_limit=5.0)
 
28
 
 
29
Let's explore what the output is all about. The keys in the dictionary are all the atoms, which have are involved in some contact(s). The length of the dictionary is not the total number of contacts.
 
30
 
 
31
.. doctest::
 
32
 
 
33
    >>> atom_id = ('1HQF', 0, 'B', ('VAL', 182, ' '), ('C', ' '))
 
34
    >>> atom_id_conts = conts[atom_id]
 
35
 
 
36
The value for this is a dictionary, where the contacts are store in the given ``xtra_key``.
 
37
 
 
38
.. doctest::
 
39
 
 
40
    >>> atom_id_conts
 
41
    {'CNT': {('1HQF', 0, 'A', ('GLY', 310, ' '), ('CA', ' ')): (4.5734119648245102, 0, 0)}}
 
42
 
 
43
The value is a dictionary of contacts with keys being ids of the involved atoms and values tuples defining the distance in A, symmetry operation id, and unit cell id. For contacts within the asymmetric unit there is no symmetry operation and no unit cell translation so both are ``0``.