Homologous Proteins

This example shows how to perform PCA of a structural dataset obtained by BLAST searching the PDB. The protein of interest is cytochrome c (cyt c). This dataset will contain structures sharing 44% or more sequence identity with human cyt c, i.e. its paralogs and/or orthologs.

A PCA instance that stores the covariance matrix and principal modes that describe the dominant changes in the dataset will be obtained. PCA instance and principal modes (Mode) can be used as input to functions in dynamics module for further analysis.

Input is amino acid sequence of the protein, a reference PDB identifier, and some parameters.

Setup

Import ProDy and matplotlib into the current namespace.

In [1]: from prody import *

In [2]: from pylab import *

In [3]: ion()

Name of the protein (a name without a white space is preferred)

In [4]: name = 'cyt_c'

In [5]: ref_pdb = '1hrc'

In order to perform a BLAST search of the PDB, we will need the amino acid sequence of our reference protein. We could get the FASTA format from the PDB, or we could get the sequence from the PDB file itself. A more attractive method (to us) is to get the sequence using ProDy.

In [6]: ref_prot = parsePDB(ref_pdb)

In [7]: ref_hv = ref_prot.getHierView()['A']

In [8]: sequence = ref_hv.getSequence()

This is the same as simply using

In [9]: sequence = '''GDVEKGKKIFVQKCAQCHTVEKGGKHKTGPNLHGLFGRKTGQAPGFTYTDANKNKGITWKEE
   ...: TLMEYLENPKKYIPGTKMIFAGIKKKTEREDLIAYLKKATNE'''
   ...: 

Optionally, a list of PDB files to be excluded from analysis can be provided. In this case dimeric Cyt c structures are excluded from the analysis. To use all PDB hits, provide an empty list.

In [10]: exclude = ['3nbt', '3nbs']

Parameters

# Minimum sequence identity of hits
In [11]: seqid = 44

# Reference chain identifier
In [12]: ref_chid = 'A'

# Selection string ("all" can be used if all of the chain is to be analyzed)
In [13]: selstr = 'resnum 1 to 103'

Blast and download

A list of PDB structures can be obtained using blastPDB() as follows:

In [14]: blast_record = blastPDB(sequence)

It is a good practice to save this record on disk, as NCBI may not respond to repeated searches for the same sequence. We can do this using the Python standard library pickle as follows:

In [15]: import pickle

The record is saved using the dump() function:

In [16]: pickle.dump(blast_record, open('cytc_blast_record.pkl', 'w'))

Then, it can be loaded using the load() function:

In [17]: blast_record = pickle.load(open('cytc_blast_record.pkl'))

We then read information from the record to extract a list of PDB IDs and chain IDs.

In [18]: pdb_hits = []

In [19]: for key, item in blast_record.getHits(seqid).iteritems():
   ....:     pdb_hits.append((key, item['chain_id']))
   ....: 

Let’s parse the PDB files and see how many there are:

In [20]: pdbs = parsePDB(*[pdb for pdb, ch in pdb_hits], subset='ca', compressed=False)
In [21]: len(pdbs)
Out[21]: 142

Set reference

We first parse the reference structure. Note that we parse only Cα atoms from chain A. The analysis will be performed for a single chain (monomeric) protein. For analysis of a dimeric protein see Multimeric Structures

In [22]: reference_structure = parsePDB(ref_pdb, subset='ca', chain=ref_chid)

# Get the reference chain from this structure
In [23]: reference_hierview = reference_structure.getHierView()

In [24]: reference_chain = reference_hierview[ref_chid]

Prepare ensemble

X-ray structural ensembles are heterogenenous, i.e. different structures have different sets of unresolved residues. Hence, it is not straightforward to analyzed them as it would be for NMR models (see NMR Models).

ProDy has special functions and classes for facilitating efficient analysis of the PDB X-ray data. In this example we use mapOntoChain() function which returns an AtomMap instance. See How AtomMap works for more details.

The resulting AtomMap instances are used to prepare a PDBEnsemble by mapping each structure against the reference chain and adding a coordinates set corresponding to the mapped atoms. The overall procedure is shown in detail below so you can understand the process and think about case specific changes such as those in the Multimeric Structures tutorial. This process can also be automated using buildPDBEnsemble() as shown in the Heterogeneous X-ray Structures tutorial.

# Start a log file
In [25]: startLogfile('pca_blast')

# Instantiate a PDB ensemble
In [26]: ensemble = PDBEnsemble(name)

# Set ensemble atoms
In [27]: ensemble.setAtoms(reference_chain)

# Set reference coordinates
In [28]: ensemble.setCoords(reference_chain.getCoords())
In [29]: for structure in pdbs:
   ....:     if structure.getTitle()[:4] in exclude:
   ....:         continue
   ....:     if structure is None:
   ....:         plog('Failed to parse ' + pdb_file)
   ....:         continue
   ....:     mappings = mapOntoChain(structure, reference_chain, seqid=seqid)
   ....:     if len(mappings) == 0:
   ....:         plog('Failed to map', structure.getTitle()[:4])
   ....:         continue
   ....:     atommap = mappings[0][0]
   ....:     ensemble.addCoordset(atommap, weights=atommap.getFlags('mapped'))
   ....: 

In [30]: ensemble.iterpose()

In [31]: saveEnsemble(ensemble)
Out[31]: 'cyt_c.ens.npz'

Let’s check how many conformations are extracted from PDB files:

In [32]: len(ensemble)
Out[32]: 569

Note that the number of conformations is larger than the number of PDB structures we retrieved. This is because some of the PDB files contained NMR structures with multiple models. Each model in NMR structures are added to the ensemble as individual conformations.

Write aligned conformations into a PDB file as follows:

In [33]: writePDB(name+'.pdb', ensemble)
Out[33]: 'cyt_c.pdb'

This file can be used to visualize the aligned conformations in a modeling software.

Align PDB files

alignPDBEnsemble() function can be used to align PDB structures used in the analysis and write new PDB files, e.g. alignPDBEnsemble(ensemble). The resulting files will contain intact structures and can be used for visualization purposes. In this case, we will align only select PDB files:

In [34]: conf1_aligned = alignPDBEnsemble(ensemble[0])

In [35]: conf2_aligned = alignPDBEnsemble(ensemble[1])

Let’s take a quick look at the aligned structures:

In [36]: showProtein(parsePDB(conf1_aligned), parsePDB(conf2_aligned));

In [37]: legend();
../../_images/ensemble_analysis_blast_aligned.png

Perform PCA

Once the ensemble is ready, performing PCA is 3 easy steps:

# Instantiate a PCA
In [38]: pca = PCA(name)

# Build covariance matrix
In [39]: pca.buildCovariance(ensemble)

# Calculate modes
In [40]: pca.calcModes()

The calculated data can be saved as a compressed file using saveModel() function:

In [41]: saveModel(pca)
Out[41]: 'cyt_c.pca.npz'

Plot results

Let’s plot RMSDs of all conformations from the average conformation:

In [42]: rmsd = calcRMSD(ensemble)

In [43]: plot(rmsd);

In [44]: xlabel('Conformation index');

In [45]: ylabel('RMSD (A)');
../../_images/ensemble_analysis_blast_rmsd.png

Let’s show a projection of the ensemble onto PC1 and PC2:

In [46]: showProjection(ensemble, pca[:2]);
../../_images/ensemble_analysis_blast_projection.png