Reference¶
Build¶
Make¶
mdna.nucleic.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
Extend¶
mdna.nucleic.Nucleic.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
Connect¶
mdna.nucleic.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
Modify¶
mdna.nucleic.Nucleic.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
mdna.nucleic.Nucleic.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
mdna.nucleic.Nucleic.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
Analyse Modules¶
Rigid Base Parameters¶
mdna.nucleic.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]) ````