Turtle3D¶
turtlend.turtle3D
¶
Implementation of a 3D 'Turtle' in Python.
This is the turtle3D implementation from my original C source code, ported to Python for proteusPy, and then brought into Waverider. T
The source: proteusPy, https://github.com/suchanek/proteusPy, is my Python package for the manipulation and analysis of macromolecules. Based on the C implementation originally authored by Eric G. Suchanek PhD, 1990. This little guy has seen quite a life and has built thousands of molecules! His big brother turtleNd does the realwork in Waverider though.
License: BSD-3-Clause
Turtle3D(name='3D_Turtle')
¶
3D Turtle.
Source code in src/turtlend/turtle3D.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
Heading
property
writable
¶
Get the Turtle's Heading
Returns:
| Type | Description |
|---|---|
Vector
|
Heading |
Left
property
writable
¶
Get the Turtle's Left direction vector
Returns:
| Type | Description |
|---|---|
Vector
|
Left |
Name
property
writable
¶
Return the Turtle's Name.
Position
property
writable
¶
The Turtle's Position
Returns:
| Type | Description |
|---|---|
Vector
|
Position |
Up
property
writable
¶
The Turtle's Up direction vector
Returns:
| Type | Description |
|---|---|
Vector
|
Up |
__repr__()
¶
Return Turtle 3D coordinates.
Source code in src/turtlend/turtle3D.py
627 628 629 | |
bbone_to_schain()
¶
Function requires turtle to be in orientation #2 (at alpha carbon, headed towards carbonyl, with nitrogen on left) and converts to orientation #1 (at alpha c, headed to beta carbon, with nitrogen on left.
Arguments: turtle: Turtle3D object in orientation #2
Returns: modified Turtle3D
Source code in src/turtlend/turtle3D.py
631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 | |
copy_coords(source)
¶
Copy the Position, Heading, Left and Up coordinate system from the input source into self. Argument: source: Turtle3D Returns: None
Source code in src/turtlend/turtle3D.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
move(distance)
¶
Move the Turtle distance (Å), in direction of Heading
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
distance
|
float
|
Amount to move (Å) |
required |
Source code in src/turtlend/turtle3D.py
332 333 334 335 336 337 338 339 | |
new(name, pos, head=Vector(1.0, 0.0, 0.0), left=Vector(0.0, 1.0, 0.0), up=Vector(0.0, 0.0, 1.0), recording=False)
¶
Initialize a Turtle with a name, position, optionally heading and left.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Turtle's Name |
required |
pos
|
Vector3D
|
Turtle's Position |
required |
head
|
Vector3D
|
Turtle's Heading vector, defaults to Vector(1,0,0) |
Vector3D(1.0, 0.0, 0.0)
|
left
|
Vector3D
|
Turtle's Left vector, defaults to Vector(0,1,0) |
Vector3D(0.0, 1.0, 0.0)
|
up
|
Vector3D
|
Turtle's Up vector, defaults to Vector(0,0,1) |
Vector3D(0.0, 0.0, 1.0)
|
recording
|
description, defaults to False |
False
|
Source code in src/turtlend/turtle3D.py
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 | |
orient(position, heading, left)
¶
Orients the turtle with Position at p1, Heading at p2 and Left at p3
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position
|
ndarray
|
Position |
required |
heading
|
ndarray
|
Heading direction vector |
required |
left
|
ndarray
|
Left direction vector |
required |
Source code in src/turtlend/turtle3D.py
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 | |
orient_at_residue(chain, resnumb, orientation)
¶
Orient the turtle at the specified residue from the input Chain in either orientation 1 or 2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chain
|
str
|
list of Residues in the model, eg: chain = model['A'] |
required |
resnumb
|
int
|
residue number |
required |
orientation
|
int
|
1 - at Ca heading towards Cb with N at the left or 2 - at Ca heading towards C with N at the left |
required |
Source code in src/turtlend/turtle3D.py
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 | |
orient_from_backbone(n, ca, cb, c, orientation)
¶
Orient the turtle at the specified residue from the input Chain in either orientation 1 or 2.
Arguments: turtle: input Turtle3D object n: position of n atom ca: position of ca atom c: position of c atom orientation: 1 - at Ca heading towards Cb with N at the left 2 - at Ca heading towards C with N at the left Returns: None. Turtle internal state is modified
Source code in src/turtlend/turtle3D.py
533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 | |
pitch(angle)
¶
pitch the Turtle about the left vector angle degrees
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
angle
|
float
|
Pitch angle, degrees -180 -> 180 |
required |
Source code in src/turtlend/turtle3D.py
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 | |
reset()
¶
Reset the Turtle to be at the Origin, with correct Heading, Left and Up vectors. Arguments: None Returns: None
Source code in src/turtlend/turtle3D.py
112 113 114 115 116 117 118 | |
roll(angle)
¶
Roll the Turtle about the heading vector angle degrees
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
angle
|
float
|
roll angle, degrees -180 -> 180 |
required |
Source code in src/turtlend/turtle3D.py
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 | |
schain_to_bbone()
¶
Function requires turtle to be in orientation #1 (at alpha c, headed to beta carbon, with nitrogen on left) and converts to orientation #2 (at alpha carbon, headed towards carbonyl, with nitrogen on left).
Arguments: None Returns: modified Turtle3D
Source code in src/turtlend/turtle3D.py
651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | |
to_global(local)
¶
Returns the global coordinates for input local vector (3d)
Source code in src/turtlend/turtle3D.py
594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 | |
to_globalVec(local)
¶
Returns the global coordinates for input local vector (3d)
Source code in src/turtlend/turtle3D.py
620 621 622 623 624 625 | |
to_local(global_vec)
¶
Returns the Turtle-centered local coordinates for input Global vector (3d)
Source code in src/turtlend/turtle3D.py
573 574 575 576 577 578 579 580 581 582 583 584 | |
to_localVec(global_vec)
¶
Returns the Turtle-centered local coordinates for input Global vector (3d)
Source code in src/turtlend/turtle3D.py
586 587 588 589 590 591 592 | |
turn(angle)
¶
Turn the Turtle about the up vector angle degrees.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
angle
|
float
|
Turn angle, degrees |
required |
Source code in src/turtlend/turtle3D.py
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 | |
unit(v)
¶
Return a unit vector for the input vector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
ndarray
|
Input Vector |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Unit Vector |
Source code in src/turtlend/turtle3D.py
454 455 456 457 458 459 460 461 462 463 464 | |
yaw(angle)
¶
Yaw the Turtle about the up vector (180 - angle) degrees. This is used when building molecules
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
angle
|
float
|
Yaw angle, degrees -180 -> 180 |
required |
Source code in src/turtlend/turtle3D.py
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 | |