1 """@namespace IMP.EMageFit.imp_general.alignments
2 Utility functions to handle alignments.
11 log = logging.getLogger(
"alignments")
15 rbs_to_align, index_to_align):
17 Align the rigid bodies rbs_to_align to the the reference frames of
18 reference_rbs. The rb with index_to_align is aligned to the reference rb
19 with reference_index. The function returns the reference frames to
20 apply to the rbs_to_align.
24 for m
in reference_rbs[reference_index].get_members()]
25 coords = [m.get_coordinates()
26 for m
in rbs_to_align[index_to_align].get_members()]
27 if(len(coords) != len(ref_coords)):
29 "Mismatch in the number of members. Reference %d Aligned %d " % (
30 len(ref_coords), len(coords)))
34 for rb
in rbs_to_align:
36 t = rb.get_reference_frame().get_transformation_to()
44 Align the centroids of 2 sets of rigid bodies using PCA using their
45 reference frames. returns the best rmsd and the ref_frames to get it.
47 if(len(ref_frames) != len(ref_frames_reference)):
48 raise ValueError(
"The number of reference frames must be the same")
49 Ts1 = [r.get_transformation_to()
for r
in ref_frames]
50 vs1 = [T.get_translation()
for T
in Ts1]
51 Ts2 = [r.get_transformation_to()
for r
in ref_frames_reference]
52 vs2 = [T.get_translation()
for T
in Ts2]
60 for j, pcT
in enumerate(pcTs):
62 new_vs1 = [T.get_translation()
for T
in new_Ts1]
67 return best_rmsd, best_refs
71 """ rbs = rigid bodies """
72 refs = [rb.get_reference_frame()
for rb
in rbs]
73 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 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)
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.