| 1 | # Chimera Python script to compute angles between dynactin axis and microtuble axes
|
|---|
| 2 | # projected to the 2d planes containing the microtubule axis and dynactin centroid
|
|---|
| 3 | # and the plane contining the microtubule axis that is perpendicular to that plane.
|
|---|
| 4 |
|
|---|
| 5 | cm = (0,0,0) # Microtubule axis point
|
|---|
| 6 | am = (0,0,1) # Microtubule axis vector
|
|---|
| 7 |
|
|---|
| 8 | cd = (7.5,10.8,-5.6) # Dynactin centroid in dynactin map coordinate system (Angstroms)
|
|---|
| 9 | ad = (.8,.7,.2) # Dynactin long axis vector in dynactin map coord system.
|
|---|
| 10 |
|
|---|
| 11 | # Convert dynactin coordinates to microtubule coordinates
|
|---|
| 12 | from chimera import openModels
|
|---|
| 13 | mmodel, dmodel = openModels.list() # Assuming microtubule model #0, dynactin model #1
|
|---|
| 14 | print "Using microtubule model", mmodel.name, "dynactin model", dmodel.name
|
|---|
| 15 |
|
|---|
| 16 | # Find transformation from dynactin model coordinates to camera coordinates
|
|---|
| 17 | # then camera coordinates to microtuble coordinates.
|
|---|
| 18 | import Matrix as M
|
|---|
| 19 | tf = M.multiply_matrices(M.xform_matrix(mmodel.openState.xform.inverse()),
|
|---|
| 20 | M.xform_matrix(dmodel.openState.xform))
|
|---|
| 21 | cdm = M.apply_matrix(tf, cd) # Dynactin centroid in microtubule map coordinate system
|
|---|
| 22 | adm = M.apply_matrix_without_translation(tf, ad) # Dynactin axis in microtubule map coordinate system
|
|---|
| 23 | adm = M.normalize_vector(adm) # Make sure axis is unit length vector
|
|---|
| 24 |
|
|---|
| 25 | # Make coordinate system for microtubule with z-axis along cylinder axis,
|
|---|
| 26 | # and yz plane containing dynactin center
|
|---|
| 27 | from numpy import subtract
|
|---|
| 28 | mx,my,mz = M.orthonormal_frame(zaxis = am, ydir = subtract(cdm, cm))
|
|---|
| 29 |
|
|---|
| 30 | # Now measure dynactin axis angle in microtubule yz plane and xz planes.
|
|---|
| 31 | from math import atan2, pi
|
|---|
| 32 | ayz = atan2(M.inner_product(my, adm), M.inner_product(mz, adm))
|
|---|
| 33 | axz = atan2(M.inner_product(mx, adm), M.inner_product(mz, adm))
|
|---|
| 34 |
|
|---|
| 35 | print('Dynactin axis orientation: %.1f degrees from microtubule axis, %.1f degrees transverse to microtuble axis'
|
|---|
| 36 | % (ayz * 180/pi, axz * 180/pi))
|
|---|