Geometry classes¶
Rigid Nucleobase class¶
mdna.geometry.ReferenceBase
¶
summary
Source code in mdna/geometry.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 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 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
|
__init__(traj)
¶
summary
Parameters:
Name | Type | Description | Default |
---|---|---|---|
traj |
_type_
|
description |
required |
Source code in mdna/geometry.py
calculate_base_frame()
¶
summary
Returns:
Name | Type | Description |
---|---|---|
_type_ |
description |
Source code in mdna/geometry.py
get_base_type()
¶
summary
Raises:
Type | Description |
---|---|
ValueError
|
description |
Returns:
Name | Type | Description |
---|---|---|
_type_ |
description |
Source code in mdna/geometry.py
get_coordinates()
¶
summary
Returns:
Name | Type | Description |
---|---|---|
_type_ |
description |
Source code in mdna/geometry.py
plot_baseframe(atoms=True, frame=True, ax=None, length=1)
¶
summary
Parameters:
Name | Type | Description | Default |
---|---|---|---|
atoms |
bool
|
description. Defaults to True. |
True
|
frame |
bool
|
description. Defaults to True. |
True
|
ax |
_type_
|
description. Defaults to None. |
None
|
length |
int
|
description. Defaults to 1. |
1
|
Source code in mdna/geometry.py
Rigid Base Parameter class¶
mdna.geometry.NucleicFrames
¶
Class to compute the rigid base parameters of a DNA structure.
loc = '/Users/thor/surfdrive/Scripts/notebooks/HNS-sequence/WorkingDir/nolinker/data/md/0_highaff/FI/drytrajs/' traj = md.load(loc+'dry_10.xtc',top=loc+'dry_10.pdb')
dna = NucleicFrames(traj) params, names = dna.get_paramters() params.shape, names
Confidence intervals¶
from scipy.stats import t
fig, ax = plt.subplots(2,6,figsize=(12,4)) fig.tight_layout() ax = ax.flatten() M = np.mean(params, axis=0) S = np.std(params, axis=0) n = params.shape[0] ci = t.ppf(0.975, df=n-1) * S / np.sqrt(n) x = np.arange(0, params.shape[1]) for , i in enumerate(M.T): if _ >= 6: c1, c2 = 'red','coral' else: c1, c2 = 'blue','cornflowerblue' ax[].plot(i[::-1], '-o',color=c1) ax[].fill_between(x, (i-ci[])[::-1], (i+ci[])[::-1], color=c2, alpha=0.2) ax[].set_title(names[_])
Source code in mdna/geometry.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 |
|
__init__(traj, chainids=[0, 1])
¶
Initialize the NucleicFrames object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
traj |
object
|
MDtraj trajectory object. |
required |
chainids |
list
|
Chainids of sense- and anti-sense strands. Defaults to [0,1]. |
[0, 1]
|
Source code in mdna/geometry.py
analyse_frames()
¶
Analyze the trajectory and compute parameters.
Source code in mdna/geometry.py
calculate_parameters(frames_A, frames_B, is_step=False)
¶
Calculate the parameters between each base pair and mean reference frames.
Assumes frames are of shape (n_frames, n_residues, 4, 3) where the last two dimensions are the base triads. The base triads consist of an origin (first index) and three vectors (latter 3 indices) representing the base frame. With the order of the vectors being: b_R, b_L, b_D, b_N.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
frames_A |
ndarray
|
Frames of shape (n_frames, n_residues, 4, 3) representing the base triads for chain A. |
required |
frames_B |
ndarray
|
Frames of shape (n_frames, n_residues, 4, 3) representing the base triads for chain B. |
required |
is_step |
bool
|
Flag indicating if the input is a single step or a trajectory. Defaults to False. |
False
|
Notes
Note the vectors are stored rowwise in the base triads, and not the usual column representation of the rotation matrices.
Returns:
Name | Type | Description |
---|---|---|
params |
ndarray
|
The parameters of shape (n_frames, n_residues, 6) representing the relative translation and rotation between each base pair. |
mean_reference_frames |
ndarray
|
The mean reference frames of shape (n_bp, n_frames, 4, 3) representing the mean reference frame of each base pair. |
Source code in mdna/geometry.py
compute_parameters(rotation_A, rotation_B, origin_A, origin_B)
¶
Calculate the parameters between each base pair and mean reference frames.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rotation_A |
ndarray
|
Rotation matrices of shape (n, 3, 3) for the first triad. |
required |
rotation_B |
ndarray
|
Rotation matrices of shape (n, 3, 3) for the second triad. |
required |
origin_A |
ndarray
|
Origins of shape (n, 3) for the first triad. |
required |
origin_B |
ndarray
|
Origins of shape (n, 3) for the second triad. |
required |
Returns:
Name | Type | Description |
---|---|---|
rigid_parameters |
ndarray
|
The parameters of shape (n, 12) representing the relative translation and rotation between each base pair. |
trans_mid |
ndarray
|
The mean translational vector of shape (n, 3) between the triads. |
rotation_mid |
ndarray
|
The mean rotation matrix of shape (n, 3, 3) between the triads. |
Source code in mdna/geometry.py
get_base_reference_frames()
¶
Get reference frames for each residue.
Source code in mdna/geometry.py
get_base_vectors(res)
¶
get_parameter(name='twist')
¶
Get the parameter of the DNA structure, choose frome the following: - shift, slide, rise, tilt, roll, twist, shear, stretch, stagger, buckle, propeller, opening
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
parameter name |
'twist'
|
Returns:
Type | Description |
---|---|
parameter(ndarray) : parameter in shape (n_frames, n_base_pairs) |
Source code in mdna/geometry.py
get_parameters(step=False, base=False)
¶
Return the computed parameters of shape (n_frames, n_base_pairs, n_parameters)
Source code in mdna/geometry.py
get_residues(chain_index, reverse=False)
¶
Get residues from specified chain.
Source code in mdna/geometry.py
load_reference_bases()
¶
Load reference bases from local files.
Source code in mdna/geometry.py
plot_parameters(fig=None, ax=None, mean=True, std=True, figsize=[10, 3.5], save=False, step=True, base=True, base_color='cornflowerblue', step_color='coral')
¶
Plot the rigid base parameters of the DNA structure Args: fig: figure ax: axis mean: plot mean std: plot standard deviation figsize: figure size save: save figure Returns: figure, axis
Source code in mdna/geometry.py
reshape_input(input_A, input_B, is_step=False)
¶
Reshape the input to the correct format for the calculations.
Args: input_A (ndarray): Input array for the first triad. input_B (ndarray): Input array for the second triad. is_step (bool, optional): Flag indicating if the input is a single step or a trajectory. Defaults to False.
Returns: rotation_A (ndarray): Rotation matrices of shape (n, 3, 3) for the first triad. rotation_B (ndarray): Rotation matrices of shape (n, 3, 3) for the second triad. origin_A (ndarray): Origins of shape (n, 3) for the first triad. origin_B (ndarray): Origins of shape (n, 3) for the second triad. original_shape (tuple): The original shape of the input.