1 """@namespace IMP.EMageFit.imp_general.alignments
2 Utility functions to handle alignments.
10 log = logging.getLogger(
"alignments")
14 rbs_to_align, index_to_align):
16 Align the rigid bodies rbs_to_align to the reference frames of
17 reference_rbs. The rb with index_to_align is aligned to the reference
18 rb with reference_index. The function returns the reference frames to
19 apply to the rbs_to_align.
23 for m
in reference_rbs[reference_index].get_members()]
24 coords = [m.get_coordinates()
25 for m
in rbs_to_align[index_to_align].get_members()]
26 if len(coords) != len(ref_coords):
28 "Mismatch in the number of members. Reference %d Aligned %d " % (
29 len(ref_coords), len(coords)))
33 for rb
in rbs_to_align:
34 t = rb.get_reference_frame().get_transformation_to()
42 Align the centroids of 2 sets of rigid bodies using PCA using their
43 reference frames. returns the best rmsd and the ref_frames to get it.
45 if len(ref_frames) != len(ref_frames_reference):
46 raise ValueError(
"The number of reference frames must be the same")
47 Ts1 = [r.get_transformation_to()
for r
in ref_frames]
48 vs1 = [T.get_translation()
for T
in Ts1]
49 Ts2 = [r.get_transformation_to()
for r
in ref_frames_reference]
50 vs2 = [T.get_translation()
for T
in Ts2]
58 for j, pcT
in enumerate(pcTs):
60 new_vs1 = [T.get_translation()
for T
in new_Ts1]
65 return best_rmsd, best_refs
69 """ rbs = rigid bodies """
70 refs = [rb.get_reference_frame()
for rb
in rbs]
71 ref_refs = [rb.get_reference_frame()
for rb
in reference_rbs]
def get_reference_frames_from_chain_alignment
Align the rigid bodies rbs_to_align to the reference frames of reference_rbs.
double get_rmsd(const Selection &s0, const Selection &s1)
def get_reference_frames_aligning_rbs
rbs = rigid bodies
Transformation3Ds get_alignments_from_first_to_second(const PrincipalComponentAnalysisD< 3 > &pca1, const PrincipalComponentAnalysisD< 3 > &pca2)
Get all alignments of the first principal component system to the second one.
PrincipalComponentAnalysisD< D > get_principal_components(const Vector< VectorD< D > > &ps)
Perform principal components analysis on a set of vectors.
Transformation3D compose(const Transformation3D &a, const Transformation3D &b)
Compose two transformations.
General purpose algebraic and geometric methods that are expected to be used by a wide variety of IMP...
def align_centroids_using_pca
Align the centroids of 2 sets of rigid bodies using PCA using their reference frames.
Transformation3D get_transformation_aligning_first_to_second(Vector3Ds a, Vector3Ds b)
Functionality for loading, creating, manipulating and scoring atomic structures.