Skip to content

segmentmodel_from_cadnano

Module documentation for segmentmodel_from_cadnano.

API Reference

get_helix_angle(part, helix_id, indices, index_offset=0, fwd=True)

Get "start_orientation" for helix

Source code in mrdna/readers/segmentmodel_from_cadnano.py
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
def get_helix_angle(part, helix_id, indices, index_offset=0, fwd=True):
    """ Get "start_orientation" for helix """

    """ FROM CADNANO2.5
    + angle is CCW
    - angle is CW
    Right handed DNA rotates clockwise from 5' to 3'
    we use the convention the 5' end starts at 0 degrees
    and it's pair is minor_groove_angle degrees away
    direction, hence the minus signs.  eulerZ
    """

    hp, bpr, tpr, eulerZ, mgroove = part.vh_properties.loc[helix_id,
                                                                    ['helical_pitch',
                                                                     'bases_per_repeat',
                                                                     'turns_per_repeat',
                                                                     'eulerZ',
                                                                     'minor_groove_angle']]
    twist_per_base = tpr*360./bpr
        # angle = eulerZ - twist_per_base*indices + 0.5*mgroove + 180
    angle = eulerZ - twist_per_base*indices - 0.5*mgroove
    angle=angle*(np.pi/180)
    cos,sin = (np.cos(angle), np.sin(angle))
    R = np.zeros( (len(angle),3,3) )
    R[:,0,0] = cos
    R[:,1,1] = cos
    R[:,0,1] =  2*(fwd-0.5)*sin
    R[:,1,0] = -2*(fwd-0.5)*sin
    R[:,2,2] = -2*(fwd-0.5)
    return R