Package schrodinger :: Package structutils :: Module sitealign :: Class BindingSiteAligner
[hide private]
[frames] | no frames]

Class BindingSiteAligner

Align structures by matching binding site atoms.

Instance Methods [hide private]
 
__init__(self, ref_st, mobile_sts, binding_site_asl, ignore_dist=5.0)
 
setBindingSiteAtoms(self, asl=None)
Sets the binding site atoms to the asl provided.
 
setSiteMatches(self)
Set the self.site_matches variable.
list of structures
alignSites(self, inplace=False, color_by_rmsd=False)
Align all structures from self.site_matches.
list of SiteMatchLookup
calculateMatrix(self)
Generates an in-place RMSD matrix between all mobile structures in self.site_matches.
 
writeStructures(self, filename)
Write reference and mobile structures to a file.
 
getAlignedMobileStructures(self)
Returns a generator that iterates over the aligned mobile structures
 
_writeCSVData(self, filename, csv_data)
Private method to write out csv data
 
writeAlignData(self, filename)
Write out all RMSD data for mobile structures aligned to the reference structure.
 
writeMatrixData(self, filename)
Write out all RMSD data for mobile structures aligned to other mobile structures.
Instance Variables [hide private]
  site_matches
List of each match found between the reference structure and each mobile structure.
  matrix_matches
List of each match found between mobile structures.
Method Details [hide private]

__init__(self, ref_st, mobile_sts, binding_site_asl, ignore_dist=5.0)
(Constructor)

 
Parameters:
  • ref_st (schrodinger.structure.Structure) - The reference structure
  • mobile_sts (list of structures) - List of structures to align to the reference
  • binding_site_asl (str) - The asl used to define the binding site atoms
  • ignore_dist (float) - Minimum dist needed for atoms to match each other in reference struct and mobile structs

setBindingSiteAtoms(self, asl=None)

 

Sets the binding site atoms to the asl provided.

Parameters:
  • asl (str) - The asl used to define the binding site atoms. If None self.asl will be used (from asl passed in in init).
Raises:
  • RuntimeError - If the asl does not return at least 3 atom indices

setSiteMatches(self)

 

Set the self.site_matches variable. This stores all the lookups that will be used to calculate the RMSDs. There will be no SiteMatchLookup created for mobiles sites that do not have at least 3 atoms matching the reference binding site atoms .

alignSites(self, inplace=False, color_by_rmsd=False)

 

Align all structures from self.site_matches. This will return the aligned mobile structures.

All mobile structures have a r_sitealign_inlpace_rmsd property added to them indicating the RMSD in-place of the reference and the mobile structure.

If inplace=False another property, r_sitealign_superimposed_rmsd is added to the mobile structure indicating the RMSD of the reference and mobile structure after they have been superimposed.

Parameters:
  • inplace (bool) - Whether to run RMSD calculations in-place or not
  • color_by_rmsd (bool) - Color the mobile atoms by RMSD. Can only be used if inplace is False
Returns: list of structures
The mobile structures (aligned if inplace=False)

calculateMatrix(self)

 

Generates an in-place RMSD matrix between all mobile structures in self.site_matches.

This method will go through all combinations of mobile structures in self.site_matches, in subsequences of two. It will then test for 3 common C-alpha atoms between the two mobile structures that have matches with the reference structure. Example: self.site_matches has 3 matches, A, B and C. The matrix calculation will loop over:

  1. A and B, then
  2. A and C, then
  3. B and C

Pairs of mobile structures that do not share 3 atoms with each other and with the reference will be skipped.

The in-place RMSD can be accessed in two ways. One way is to write the data out to a CSV-formatted file. This file contains a header and then each row will summarize teh RMSD calculated. This file can be written using the self.writeMatrixData() method. The second way to access the RMSD information is to get it from the returned lookups:

   matrix_matches = aligner.calculateMatrix()
   for match in matrix_matches:
       mobile_st1   = match.ref_st
       mobile_st2   = match.mobile_st
       inplace_rmsd = match.inplace_rmsd
Returns: list of SiteMatchLookup
Lookups for each pair of mobile atoms sharing at least 3 atoms with each other and the reference
Raises:
  • RuntimeError - If less than 2 mobile structures were aligned to reference

writeStructures(self, filename)

 

Write reference and mobile structures to a file. This will write the structures to a file based on their current state. If this is called right after initializing the class the structures will be unaltered. If this is called after sites are superimposed the structures written will be superimposed.

Parameters:
  • filename (str) - File name to write structures to

writeAlignData(self, filename)

 

Write out all RMSD data for mobile structures aligned to the reference structure.

Parameters:
  • filename (str) - File name to write csv data to

writeMatrixData(self, filename)

 

Write out all RMSD data for mobile structures aligned to other mobile structures.

Parameters:
  • filename (str) - File name to write csv data to

Instance Variable Details [hide private]

site_matches

List of each match found between the reference structure and each mobile structure. These contain the reference structure and a mobile structure sharing at least 3 C-alpha binding site atoms.

matrix_matches

List of each match found between mobile structures. These contain the pair of mobile structures that share at least 3 C-alpha binding site atoms with each other and with self.reference.