Reference
This section of the documentation provides detailed, information-oriented references for the technical implementation of the mdna
project code. It is intended as a comprehensive guide for developers and users who wish to understand the inner workings of the MDNA tool, its modules, and functions.
Nucleic class¶
The mdna.nucleic
module is the core of the MDNA toolkit, encompassing a variety of classes and functions essential for DNA structure generation, manipulation, and analysis. Below, each key component of the module is outlined with explanations of its purpose and usage. The Nucleic
class serves as the primary interface for interacting with DNA structures in the MDNA toolkit. It encapsulates both the structural properties of DNA and the trajectory information needed for molecular dynamics simulations. Key methods include:
mdna.nucleic
¶
Connector
¶
Source code in mdna/nucleic.py
955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 |
|
connect(index=0, control_points=None)
¶
Connect two nucleic acids by creating a new nucleic acid with a connecting DNA strand.
Source code in mdna/nucleic.py
Extender
¶
Extend the DNA sequence in the specified direction using the five_end or three_end as reference.
Source code in mdna/nucleic.py
__init__(nucleic, n_bp, sequence=None, fixed_endpoints=False, frame=-1, forward=True, shape=None, margin=1)
¶
Initialize the DNA sequence extender
Source code in mdna/nucleic.py
Nucleic
¶
Contains mdna DNA structure with reference frames and trajectory
Source code in mdna/nucleic.py
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 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 532 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 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 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 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 |
|
__init__(sequence=None, n_bp=None, traj=None, frames=None, chainids=[0, 1], circular=None)
¶
Initializes the DNA structure.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sequence |
str
|
The DNA sequence, e.g. 'CGCGAATTCGCG'. |
None
|
n_bp |
int
|
The number of base pairs. Default is None. |
None
|
traj |
object
|
The MDTraj trajectory. Default is None. |
None
|
frames |
ndarray
|
The reference frames of the DNA structure. Default is None. |
None
|
chainids |
list
|
The chain IDs. Default is [0,1]. |
[0, 1]
|
circular |
bool
|
A flag that indicates if the structure is circular/closed. Default is None. |
None
|
Raises:
Type | Description |
---|---|
ValueError
|
If both traj and frames are provided. |
ValueError
|
If frames have an invalid shape. |
ValueError
|
If the number of base pairs in the sequence and frames do not match. |
ValueError
|
If neither traj nor frames are provided. |
Notes
- If traj is provided, sequence and n_bp will be extracted from the trajectory.
- If frames is provided, n_bp will be determined from the shape of frames.
- If sequence is provided, it will be checked against the number of base pairs.
Attributes:
Name | Type | Description |
---|---|---|
sequence |
str
|
The DNA sequence. |
n_bp |
int
|
The number of base pairs. |
traj |
object
|
The MDTraj trajectory. |
frames |
ndarray
|
The reference frames of the DNA structure. |
chainids |
list
|
The chain IDs. |
circular |
bool
|
A flag that indicates if the structure is circular/closed. |
rigid |
None
|
A container for rigid base parameters class output. |
minimizer |
None
|
A container for minimizer class output. |
Source code in mdna/nucleic.py
describe()
¶
Print the DNA structure information
Source code in mdna/nucleic.py
draw(ax=None, fig=None, save=False, frame=-1, markersize=2, lw=1, helical_axis=True, backbone=True, lead=False, anti=False, triads=False, length=0.23, color_lead='k', color_anti='darkgrey', color_axis='k')
¶
Draws a 3D representation of the DNA structure with optional helical axis, backbone, lead, anti, and triads.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ax |
object
|
Matplotlib axis. Default is None. |
None
|
fig |
object
|
Figure axis. Default is None. |
None
|
save |
bool
|
Save image as png. Default is False. |
False
|
frame |
int
|
Index of trajectory to visualize. Default is -1. |
-1
|
markersize |
int
|
Width of backbone plot. Default is 2. |
2
|
lw |
int
|
Line width of plots. Default is 1. |
1
|
helical_axis |
bool
|
Plot central axis passing through frame origins. Default is True. |
True
|
backbone |
bool
|
Plot backbone as 'o-' line plot through phosphor atoms. Default is True. |
True
|
lead |
bool
|
Plot leading strand. Default is False. |
False
|
anti |
bool
|
Plot anti-sense opposing leading strand. Default is False. |
False
|
triads |
bool
|
Plot triads in order of b_L (blue), b_N (green), b_T (red). Default is False. |
False
|
length |
float
|
Length of triad vectors. Default is 0.23. |
0.23
|
color_lead |
str
|
Color of the leading strand. Default is 'k'. |
'k'
|
color_anti |
str
|
Color of the anti strand. Default is 'darkgrey'. |
'darkgrey'
|
color_axis |
str
|
Color of the helical axis. Default is 'k'. |
'k'
|
Notes
- The function draws a 3D representation of the DNA structure using matplotlib.
- The function requires either the trajectory or reference frames to be loaded before calling.
Example
Make a DNA structure and draw the 3D representation
Source code in mdna/nucleic.py
extend(n_bp=None, sequence=None, fixed_endpoints=False, forward=True, frame=-1, shape=None, margin=1, minimize=True, plot=False, exvol_rad=2.0, temperature=300)
¶
Extend the DNA structure in the specified direction. The method updates the attributes of the DNA object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n_bp |
int
|
Number of base pairs to extend the DNA structure. Defaults to None. |
None
|
sequence |
str or List
|
DNA sequence to extend the DNA structure. If not provided, the sequence will be generated randomly. Defaults to None. |
None
|
fixed_endpoints |
bool
|
Whether to fix the endpoints of the DNA structure during extension. Defaults to False. |
False
|
forward |
bool
|
Whether to extend the DNA structure in the forward direction. If False, the DNA structure will be extended in the backward direction. Defaults to True. |
True
|
frame |
int
|
The time frame to extend. Defaults to -1. |
-1
|
shape |
ndarray
|
Control points of the shape to be used for extension. The shape should be a numpy array of shape (n, 3), where n is greater than 3. Defaults to None. |
None
|
margin |
int
|
Number of base pairs to fix at the end/start of the DNA structure during extension. Defaults to 1. |
1
|
minimize |
bool
|
Whether to minimize the new DNA structure after extension. Defaults to True. |
True
|
plot |
bool
|
Whether to plot the Energy during minmization. Defaults to False. |
False
|
exvol_rad |
float
|
Excluded volume radius. Defaults to 2.0. |
2.0
|
temperature |
int
|
Temperature for equilibration. Defaults |
300
|
Raises:
Type | Description |
---|---|
ValueError
|
If the DNA structure is circular and cannot be extended. |
ValueError
|
If neither a fixed endpoint nor a length is specified for extension. |
ValueError
|
If the input sequence is invalid or the number of base pairs is invalid. |
Notes
- If the DNA structure is circular, it cannot be extended.
Example
Extend DNA structure
Source code in mdna/nucleic.py
flip(fliplist=[], deg=180, frame=-1)
¶
Flips the nucleobases of the DNA structure.
The method updates the traj
attribute of the DNA object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fliplist |
list
|
A list of base pairs to flip. Defaults to an empty list. |
[]
|
deg |
int
|
The degrees to flip. Defaults to 180. |
180
|
frame |
int
|
The frame to flip. Defaults to -1. |
-1
|
Raises:
Type | Description |
---|---|
ValueError
|
If no fliplist is provided. |
Notes
- Rotating the nucleobase by 180 degrees corresponds to the Hoogsteen base pair configuration.
Source code in mdna/nucleic.py
get_MC_traj()
¶
Get the MC sampling energy minimization trajectory of the new spline.
get_base_frames()
¶
Get the base reference frames of the DNA structure
Returns:
Name | Type | Description |
---|---|---|
dict |
A dictionary containing the base reference frames of the DNA structure. The keys are residue topologies of the MDTraj object (traj.top.residues) and the values are the reference frames in shape (n_frames, 4, 3), where the rows represent the origin, b_D, b_L, and b_N vectors. |
Source code in mdna/nucleic.py
get_frames()
¶
Get the reference frames of the DNA structure belonging to the base steps: Returns: array of reference frames of shape (n_frames, n_bp, 4, 3) where n_frames is the number of frames, n_bp is the number of base pairs, and 4 corresponds to the origin and the 3 vectors of the reference frame
Returns:
Name | Type | Description |
---|---|---|
frames |
ndarray
|
reference frames of the DNA structure |
Source code in mdna/nucleic.py
get_linking_number(frame=-1)
¶
Get the linking number of the DNA structure based on Gauss's linking number theorem.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
frame |
int
|
Time frame of trajectory, by default -1 |
-1
|
Returns:
Name | Type | Description |
---|---|---|
linking_number |
ndarray
|
Numpy array containing the linking number, writhe, and twist corresponding to the time frame |
Source code in mdna/nucleic.py
get_parameter(parameter_name)
¶
Get a specific parameter from the rigid base parameters class object of the DNA structure
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parameter_name |
str
|
The name of the parameter to retrieve. |
required |
Notes
The following parameters can be retrieved: - shift, slide, rise, tilt, roll, twist, shear, stretch, stagger, buckle, propeller, opening
Returns:
Type | Description |
---|---|
np.ndarray: The parameter values of the DNA structure. |
Source code in mdna/nucleic.py
get_parameters(step=False, base=False)
¶
By default retuns all the parameters of the DNA structure. Use arguments to get a specific parameter group of the DNA structure.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
step |
bool
|
Returns only the step parameters of consequative bases. Defaults to False. |
False
|
base |
bool
|
Returns onlt the base pair parameters of opposing bases. Defaults to False. |
False
|
Returns:
Type | Description |
---|---|
(parameters, names) (tuple) : Returns the names of the computed parameters of shape (n_frames, n_base_pairs, n_parameters) |
Source code in mdna/nucleic.py
get_rigid_object()
¶
Get the rigid base class object of the DNA structure
Returns:
Name | Type | Description |
---|---|---|
NucleicFrames |
object
|
Object representing the rigid base parameters of the DNA structure. |
Source code in mdna/nucleic.py
get_traj()
¶
Get the trajectory of the current state of the DNA structure Returns: MDtraj object
Source code in mdna/nucleic.py
invert()
¶
Inverse the direction of the DNA structure so from 5' to 3' to 3' to 5 The method updates attributes of the DNA object.
methylate(methylations=[], CpG=False, leading_strand=0, frame=-1)
¶
Methylate the nucleobases of the DNA structure.
The method updates the traj
attribute of the DNA object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
methylations |
list
|
List of base pairs to methylate. Defaults to []. |
[]
|
CpG |
bool
|
Whether to methylate CpG sites. Defaults to False. |
False
|
leading_strand |
int
|
The leading strand to methylate. Defaults to 0. |
0
|
frame |
int
|
The frame to methylate. Defaults to -1. |
-1
|
Raises:
Type | Description |
---|---|
ValueError
|
If the DNA structure is not loaded. |
ValueError
|
If the methylations list is empty. |
Notes
Using the CpG
flag will methylate the CpG sites in the DNA structure. This flag supercedes the methylations list.
Source code in mdna/nucleic.py
minimize(frame=-1, exvol_rad=2.0, temperature=300, simple=False, equilibrate_writhe=False, endpoints_fixed=False, fixed=[], dump_every=5, plot=False)
¶
Minimize the DNA structure. This method updates the of the DNA structure.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
frame |
int
|
The trajectory frame to minimize. Defaults to -1. |
-1
|
simple |
bool
|
Whether to use simple equilibration. Defaults to False. |
False
|
equilibrate_writhe |
bool
|
Whether to equilibrate writhe. Defaults to False. Only works for simple equilibration. |
False
|
endpoints_fixed |
bool
|
Whether the endpoints are fixed. Defaults to False. |
False
|
fixed |
list
|
List of fixed base pairs. Defaults to an empty list. |
[]
|
exvol_rad |
float
|
Excluded volume radius. Defaults to 2.0. |
2.0
|
temperature |
int
|
Temperature for equilibration. Defaults to 300. |
300
|
dump_every |
int
|
Frequency of dumping frames. Defaults to 5. |
5
|
plot |
bool
|
Whether to plot the energy. Defaults to False. |
False
|
Additional keyword arguments can be provided and will be passed to the minimizer.
Notes:
For the simple equilibation, we rely on checking whether the considered quantity starts to fluctuate around a fixed value.
This options is compatible with With the argument equilibrate_writhe, which you can specify that writhe should also be considered for equilibration.
The other option is to use the full equilibration, which is based on the actual energy of the system.
We assume the energy to converge exponentially to the equilibrated value.
This works fairly well for most examples I checked but is not entirely robust.
Considering autocorrelation has some issues when there are relaxations at different timescales.
Also, I wasn't able to use something consistent to equilibrate writhe, since that involves a barrier crossing.
It is really non-trivial to set a criterion for whether or not a globally stable value is reached.
Example
Load a DNA structure and minimize it
Source code in mdna/nucleic.py
mutate(mutations=None, complementary=True, frame=-1, verbose=False)
¶
Mutate the DNA trajectory, updating the topology and coordinates of the DNA structure.
The method updates the traj
attribute and the sequence
attribute of the DNA object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mutations |
dict
|
A dictionary containing the mutation information. The keys represent the indices of the base pairs to be mutated, and the values represent the new nucleobases. For example, |
None
|
complementary |
bool
|
Whether to mutate the complementary strand. Defaults to True. |
True
|
frame |
int
|
The frame to mutate. Defaults to -1. |
-1
|
verbose |
bool
|
Whether to print the mutated sequence. Defaults to False. |
False
|
Raises:
Type | Description |
---|---|
ValueError
|
If no mutation dictionary is provided. |
Notes
- Valid nucleobases for mutations include:
- Canonical bases: A, T, G, C, U
- Hachimoji: B [A_ana], S [T_ana], P [C_ana], Z [G_ana] (DOI: 10.1126/science.aat0971)
- Fluorescent: 2-aminopurine 2AP (E), triC (D) (DOI: 10.1002/anie.201001312), tricyclic cytosine base analogue (1tuq)
- Hydrophobic pairs: d5SICS (L), dNaM (M)
Example
Create a DNA object
Source code in mdna/nucleic.py
save_pdb(filename=None, frame=-1)
¶
Save the DNA structure as a pdb file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename |
str
|
Filename to save the pdb file. Defaults to None. |
None
|
frame |
int
|
If the trajectory has multiple frames, specify the frame to save. Defaults to -1. |
-1
|
Source code in mdna/nucleic.py
compute_curvature(traj, chainids=[0, 1])
¶
compute_groove_width(traj, chainids=[0, 1])
¶
compute_linking_number(traj, chainids=[0, 1])
¶
compute_rigid_parameters(traj, chainids=[0, 1])
¶
Compute the rigid base parameters of the DNA structure.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
traj |
object
|
MDtraj trajectory containing the DNA structure. |
required |
chainids |
list
|
List of chain IDs of the DNA structure. Default is [0, 1]. |
[0, 1]
|
Returns:
Name | Type | Description |
---|---|---|
NucleicFrames |
object
|
Object representing the rigid base parameters of the DNA structure. |
Raises:
Type | Description |
---|---|
ValueError
|
If the traj argument is not provided. |
Notes
- The returned NucleicFrames object contains information about the rigid base parameters of the DNA structure, such as the positions and orientations of the base steps.
Example
Compute the rigid base parameters of a DNA structure ```python traj = md.load('dna.pdb') rigid_params = mdna.compute_rigid_parameters(traj, chainids=[0, 1]) ````
Source code in mdna/nucleic.py
connect(Nucleic0, Nucleic1, sequence=None, n_bp=None, leader=0, frame=-1, margin=1, minimize=True, exvol_rad=0.0, temperature=300, control_points=None, index=0)
¶
Connect two DNA structures by creating a new DNA structure with a connecting DNA strand.
The 3' end of the first DNA structure is connected to the 5' end of the second DNA structure. To connect the two strands, a straight line is interpolated between the two ends, and the optimal number of base pairs is distributed to achieve a neutral twist.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
Nucleic0 |
Nucleic
|
First DNA structure to connect. |
required |
Nucleic1 |
Nucleic
|
Second DNA structure to connect. |
required |
sequence |
str or List
|
DNA sequence of the connecting DNA strand. Default is None. |
None
|
n_bp |
int
|
Number of base pairs of the connecting DNA strand. Default is None. |
None
|
leader |
int
|
The leader of the DNA structure to connect. Default is 0. |
0
|
frame |
int
|
The time frame to connect. Default is -1. |
-1
|
margin |
int
|
Number of base pairs to fix at the end. Default is 1. |
1
|
minimize |
bool
|
Whether to minimize the new DNA structure. Default is True. |
True
|
exvol_rad |
float
|
Radius for excluded volume interactions during minimization. Default is 0.0. |
0.0
|
temperature |
int
|
Temperature for minimization. Default is 300. |
300
|
Returns:
Name | Type | Description |
---|---|---|
Nucleic |
object
|
DNA structure with the two DNA structures connected. |
Raises:
Type | Description |
---|---|
ValueError
|
If either of the DNA structures is circular. |
Notes
- The minimization does not use excluded volume interactions by default.This is because the excluded volume interactions require the EV beads to have no overlap. However, in the initial configuration, the EV beads are likely to have overlap. If desired, the resulting Nucleic object can be further minimized with the excluded volume interactions.
Source code in mdna/nucleic.py
load(traj=None, frames=None, sequence=None, chainids=[0, 1], circular=None, filename=None, top=None, stride=None)
¶
Load DNA representation from either base step mean reference frames/spline frames or an MDtraj trajectory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
traj |
object
|
MDtraj trajectory containing the DNA structure. If provided, the frames and sequence arguments are ignored. (default: None) |
None
|
frames |
array
|
Base step mean reference frames of shape (n_bp, n_timesteps, 4, 3) or (n_bp, 4, 3). If provided, the traj and sequence arguments are ignored. (default: None) |
None
|
sequence |
str
|
DNA sequence. If provided, the traj and frames arguments are ignored. (default: None) |
None
|
chainids |
list
|
Chain IDs of the DNA structure. (default: [0,1]) |
[0, 1]
|
circular |
bool
|
Flag indicating if the DNA structure is circular/closed. If not provided, it will be determined based on the input data. (default: None) |
None
|
filename |
str
|
The filename or filenames of the trajectory. If provided, the traj and frames arguments are ignored. (default: None) |
None
|
top |
str
|
The topology file of the trajectory. (default: None) |
None
|
stride |
int
|
The stride of the trajectory. (default: None) |
None
|
Returns:
Name | Type | Description |
---|---|---|
Nucleic |
object
|
DNA structure object. |
Notes
- The
traj
argument is prioritized over frames and sequence. - If the
filename_or_filenames
argument is provided, the other arguments are ignored, except for thetop
andstride
arguments andchainids
.
Example
Load a DNA structure from a trajectory
Source code in mdna/nucleic.py
make(sequence=None, control_points=None, circular=False, closed=False, n_bp=None, dLk=None)
¶
Generate a DNA structure from a given DNA sequence and control points.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sequence |
str
|
DNA sequence code. If not provided, the default sequence 'CGCGAATTCGCG' will be used. (default: None) |
None
|
control_points |
ndarray
|
Control points of the DNA structure. Should be a numpy array of shape (n, 3) where n is the number of control points. If not provided, a straight line will be used as the default control points. (default: None) |
None
|
circular |
bool
|
Flag indicating if the DNA structure is circular/closed. If True, the DNA structure will be closed. If False, the DNA structure will be open. (default: False) |
False
|
closed |
bool
|
Flag indicating if the DNA structure is closed. If True, the DNA structure will be closed. If False, the DNA structure will be open. This argument is deprecated and will be removed in a future version. Please use the 'circular' argument instead. (default: False) |
False
|
n_bp |
int
|
Number of base pairs to scale the shape with. If not provided, the number of base pairs will be determined based on the length of the control points or the sequence. (default: None) |
None
|
dLk |
int
|
Change in twist in terms of Linking number of the DNA structure. If not provided, a neutral twist based on bp_per_turn = 10.5 will be used. (default: None) |
None
|
Returns:
Name | Type | Description |
---|---|---|
Nucleic |
object
|
DNA structure object. |
Example
Generate a DNA structure from a sequence
Source code in mdna/nucleic.py
sequence_to_md(sequence=None, time=10, time_unit='picoseconds', temperature=310, solvated=False, filename='my_dna', save=True, output='GROMACS', shape=None, n_bp=None, circular=False, dLk=None, save_location='./')
¶
Simulate DNA sequence using OpenMM.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sequence |
str
|
DNA sequence code. |
None
|
time |
int
|
Simulation time. |
10
|
time_unit |
str
|
Time unit (picoseconds or nanoseconds). |
'picoseconds'
|
temperature |
int
|
Temperature in Kelvin. |
310
|
solvated |
bool
|
Solvate DNA with water and ions. |
False
|
filename |
str
|
Filename for pdb output. |
'my_dna'
|
save |
bool
|
Save the trajectory. |
True
|
output |
str
|
Output format for the trajectory (GROMACS or HDF5). |
'GROMACS'
|
shape |
str
|
Shape of the DNA structure (linear or circular). |
None
|
n_bp |
int
|
Number of base pairs in the DNA structure. |
None
|
circular |
bool
|
Flag indicating if the DNA structure is circular. |
False
|
dLk |
int
|
Change in linking number of the DNA structure. |
None
|
save_location |
str
|
Location to save the trajectory. |
'./'
|
Returns:
Name | Type | Description |
---|---|---|
MDTraj |
object
|
MDtraj trajectory object of DNA structure. |
Notes
- This function uses the OpenMM library to simulate the behavior of a DNA sequence.
- The simulation can be performed for a specified time period at a given temperature.
- The DNA structure can be solvated with water and ions.
- The trajectory of the simulation can be saved in either GROMACS or HDF5 format.
Example
Simulate a linear DNA structure for 100 picoseconds at 300 K
Source code in mdna/nucleic.py
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 |
|
sequence_to_pdb(sequence='CGCGAATTCGCG', filename='my_dna', save=True, output='GROMACS', shape=None, n_bp=None, circular=False, dLk=None, save_location='./')
¶
Generate a DNA structure from a DNA sequence code.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sequence |
str
|
The DNA sequence code. Default is 'CGCGAATTCGCG'. |
'CGCGAATTCGCG'
|
filename |
str
|
The filename for the pdb output. Default is 'my_dna'. |
'my_dna'
|
save |
bool
|
Whether to save the pdb file. Default is True. |
True
|
output |
str
|
The type of pdb DNA format. Default is 'GROMACS'. |
'GROMACS'
|
shape |
ndarray
|
Control points of shape (n,3) with n > 3 that is used for spline interpolation to determine DNA shape. Default is None, which is a straight line. |
None
|
n_bp |
int
|
Number of base pairs to scale shape with. Default is None, then the sequence is used to determine n_bp. |
None
|
circular |
bool
|
Indicates if the structure is circular/closed. Default is False. |
False
|
dLk |
int
|
Change in twist in terms of Linking number of DNA structure to output. Default is None, which corresponds to a neutral twist based on bp_per_turn = 10.5. |
None
|
save_location |
str
|
Location to save the trajectory. Default is './'. |
'./'
|
Returns:
Type | Description |
---|---|
Trajectory
|
md.Trajectory: An MDtraj trajectory object of the DNA structure (containing only a single frame). |
Raises:
Type | Description |
---|---|
ValueError
|
If the sequence is not provided. |
Notes
- The pdb file is saved in the current directory with the specified filename.
Example
Generate a DNA structure from a sequence