1 """@namespace IMP.EMageFit.imp_general.alignments
2 Utility functions to handle alignments.
20 log = logging.getLogger(
"alignments")
24 rbs_to_align, index_to_align):
26 Align the rigid bodies rbs_to_align to the the reference frames of
27 reference_rbs. The rb with index_to_align is aligned to the reference rb
28 with reference_index. The function returns the reference frames to
29 apply to the rbs_to_align.
33 for m
in reference_rbs[reference_index].get_members()]
34 coords = [m.get_coordinates()
35 for m
in rbs_to_align[index_to_align].get_members()]
36 if(len(coords) != len(ref_coords)):
38 "Mismatch in the number of members. Reference %d Aligned %d " % (
39 len(ref_coords), len(coords)))
40 T = alg.get_transformation_aligning_first_to_second(coords, ref_coords)
42 for rb
in rbs_to_align:
44 t = rb.get_reference_frame().get_transformation_to()
45 new_t = alg.compose(T, t)
46 new_refs.append(alg.ReferenceFrame3D(new_t))
52 Align the centroids of 2 sets of rigid bodyes using PCA using their
53 reference frames. returns the best rmsd and the ref_frames to get it.
55 if(len(ref_frames) != len(ref_frames_reference)):
56 raise ValueError(
"The number of reference frames must be the same")
57 Ts1 = [r.get_transformation_to()
for r
in ref_frames]
58 vs1 = [T.get_translation()
for T
in Ts1]
59 Ts2 = [r.get_transformation_to()
for r
in ref_frames_reference]
60 vs2 = [T.get_translation()
for T
in Ts2]
63 pc1 = alg.get_principal_components(vs1)
64 pc2 = alg.get_principal_components(vs2)
65 pcTs = alg.get_alignments_from_first_to_second(pc1, pc2)
68 for j, pcT
in enumerate(pcTs):
69 new_Ts1 = [alg.compose(pcT, T)
for T
in Ts1]
70 new_vs1 = [T.get_translation()
for T
in new_Ts1]
71 r = atom.get_rmsd(new_vs1, vs2)
74 best_refs = [alg.ReferenceFrame3D(T)
for T
in new_Ts1]
75 return best_rmsd, best_refs
79 """ rbs = rigid bodies """
80 refs = [rb.get_reference_frame()
for rb
in rbs]
81 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. ...
Restraints using electron microscopy 2D images (class averages).
Utility functions to handle representation.
Utility functions to handle IO.
def get_reference_frames_aligning_rbs
rbs = rigid bodies
Basic functionality that is expected to be used by a wide variety of IMP users.
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 bodyes using PCA using their reference frames.
Output IMP model data in various file formats.
Functionality for loading, creating, manipulating and scoring atomic structures.
Divide-and-conquer inferential optimization in discrete space.