Back to index

python-biopython  1.60
Public Member Functions | Public Attributes | Private Member Functions
Bio.PDB.StructureAlignment.StructureAlignment Class Reference

List of all members.

Public Member Functions

def __init__
def get_maps
def get_iterator

Public Attributes

 map12
 map21
 duos

Private Member Functions

def _test_equivalence

Detailed Description

This class aligns two structures based on an alignment of their
sequences.

Definition at line 16 of file StructureAlignment.py.


Constructor & Destructor Documentation

def Bio.PDB.StructureAlignment.StructureAlignment.__init__ (   self,
  fasta_align,
  m1,
  m2,
  si = 0,
  sj = 1 
)
fasta_align --- Alignment object 
m1, m2 --- two models
si, sj --- the sequences in the Alignment object that
correspond to the structures

Definition at line 21 of file StructureAlignment.py.

00021 
00022     def __init__(self, fasta_align, m1, m2, si=0, sj=1):
00023         """
00024         fasta_align --- Alignment object 
00025         m1, m2 --- two models
00026         si, sj --- the sequences in the Alignment object that
00027                 correspond to the structures
00028         """
00029         l=fasta_align.get_alignment_length()
00030         s1=fasta_align.get_seq_by_num(si)
00031         s2=fasta_align.get_seq_by_num(sj)
00032         # Get the residues in the models
00033         rl1=Selection.unfold_entities(m1, 'R')
00034         rl2=Selection.unfold_entities(m2, 'R')
00035         # Residue positions
00036         p1=0
00037         p2=0
00038         # Map equivalent residues to each other
00039         map12={}
00040         map21={}
00041         # List of residue pairs (None if -)
00042         duos=[]
00043         for i in range(0, l):
00044             column=fasta_align.get_column(i)
00045             aa1=column[si]
00046             aa2=column[sj]
00047             if aa1!="-":
00048                 # Position in seq1 is not -
00049                 while 1:
00050                     # Loop until an aa is found
00051                     r1=rl1[p1]
00052                     p1=p1+1
00053                     if is_aa(r1):
00054                         break
00055                 self._test_equivalence(r1, aa1)
00056             else:
00057                 r1=None
00058             if aa2!="-":
00059                 # Position in seq2 is not -
00060                 while 1:
00061                     # Loop until an aa is found
00062                     r2=rl2[p2]
00063                     p2=p2+1
00064                     if is_aa(r2):
00065                         break
00066                 self._test_equivalence(r2, aa2)
00067             else:
00068                 r2=None
00069             if r1:
00070                 # Map residue in seq1 to its equivalent in seq2
00071                 map12[r1]=r2
00072             if r2:
00073                 # Map residue in seq2 to its equivalent in seq1
00074                 map21[r2]=r1
00075             # Append aligned pair (r is None if gap)
00076             duos.append((r1, r2))
00077         self.map12=map12
00078         self.map21=map21
00079         self.duos=duos

Here is the call graph for this function:


Member Function Documentation

def Bio.PDB.StructureAlignment.StructureAlignment._test_equivalence (   self,
  r1,
  aa1 
) [private]

Definition at line 80 of file StructureAlignment.py.

00080 
00081     def _test_equivalence(self, r1, aa1):
00082         "Test if aa in sequence fits aa in structure."
00083         resname=r1.get_resname()
00084         resname=to_one_letter_code[resname]
00085         assert(aa1==resname)

Here is the caller graph for this function:

Iterator over all residue pairs.

Definition at line 93 of file StructureAlignment.py.

00093 
00094     def get_iterator(self):
00095         """
00096         Iterator over all residue pairs.
00097         """
00098         for i in range(0, len(self.duos)):
00099             yield self.duos[i]
00100 

Return two dictionaries that map a residue in one structure to 
the equivealent residue in the other structure.

Definition at line 86 of file StructureAlignment.py.

00086 
00087     def get_maps(self):
00088         """
00089         Return two dictionaries that map a residue in one structure to 
00090         the equivealent residue in the other structure.
00091         """
00092         return self.map12, self.map21


Member Data Documentation

Definition at line 78 of file StructureAlignment.py.

Definition at line 76 of file StructureAlignment.py.

Definition at line 77 of file StructureAlignment.py.


The documentation for this class was generated from the following file: