The Align package provides functionality for aligning and mergin molecules. Molecules are aligned using a Maximum Common Substructure (MCS) search, which is used to find mappings between atom indices in the two molecules. Functionality is provided for sorting the mappings according to a scoring function, such as the root mean squared displacement of the alignment that is generated by the mapping.
import BioSimSpace as BSS # Here we assume that we have already created two BioSimSpace molecules, # mol0 and mol1. # Find the best MCS mapping from mol0 to mol1. mapping = BSS.Align.matchAtoms(mol0, mol1) # Return a maximum of 10 matches, scored by RMSD and sorted from best to worst. mappings = BSS.Align.matchAtoms(mol0, mol1, matches=10) # Align mol0 to mol1 based on the best mapping. The molecule is aligned based # on a root mean squared displacement fit to find the optimal translation vector # (as opposed to merely taking the difference of centroids). mol0 = BSS.Align.rmsdAlign(mol0, mol1, mapping) # Merge the properties of the two molecules based on the atom mapping. # The resulting "merged-molecule" can be used in free energy perturbation # simulations. merged = BSS.Align.merge(mol0, mol1, mappings)
||Find mappings between atom indices in molecule0 to those in molecule1.|
||Align atoms in molecule0 to those in molecule1 using the mapping between matched atom indices.|
||Create a merged molecule from ‘molecule0’ and ‘molecule1’ based on the atom index ‘mapping’.|