Modification Tutorial¶
Welcome to the DNA modification tutorial using the MDNA module. This notebook will demonstrate how to modify DNA structures using mutation, methylation, and flipping techniques. You'll learn to:
- Mutate specific bases in a DNA sequence.
- Apply methylation to DNA bases and explore its effects.
- Perform Hoogsteen base flipping to study alternative DNA structures.
- Save and visualize the modified DNA structures.
In [ ]:
Copied!
import numpy as np
import mdtraj as md
import matplotlib.pyplot as plt
import nglview as nv
import mdna as mdna
import numpy as np
import mdtraj as md
import matplotlib.pyplot as plt
import nglview as nv
import mdna as mdna
/Users/thor/surfdrive/Projects/PMCpy/pmcpy/Evals/PyLk/pylk/writhemap.py:16: UserWarning: Cython version of writhemap (PyLk) not compiled. Defaulting to numba implementation. Consider compiling the cython version. warnings.warn( /Users/thor/surfdrive/Projects/PMCpy/pmcpy/Evals/PyLk/pylk/eval_link.py:10: UserWarning: Cython version of linkingnumber (PyLk) not compiled. Defaulting to numba implementation. Consider compiling the cython version. warnings.warn(
Initial DNA Structure Generation¶
We begin by generating a DNA structure with a specific sequence to prepare it for modifications.
In [2]:
Copied!
# Here we make a DNA with the following sequence
dna = mdna.make(sequence='AGCGATATAGA')
# Here we make a DNA with the following sequence
dna = mdna.make(sequence='AGCGATATAGA')
Start rescaling spline based on requested number of base pairs. This requires recomputation of the control points to match the desired number of base pairs. Spline scaled to match the target number of base pairs: 11
Saving the Original DNA Structure¶
It's often useful to save the original DNA structure before modifications for comparison purposes.
In [ ]:
Copied!
# Let's save the original structure
traj = dna.get_traj()
traj.save_pdb('./pdbs/dna_original.pdb')
# Let's save the original structure
traj = dna.get_traj()
traj.save_pdb('./pdbs/dna_original.pdb')
DNA Mutation¶
Modify specific bases within the DNA sequence to see how mutations affect the structure and properties.
In [9]:
Copied!
# Let's mutate the first base to a G and the last base to a C
dna.mutate(mutations={0: 'G', dna.n_bp-1: 'C'})
# Get information about the DNA and see the mutated sequence
dna.describe()
# Let's mutate the first base to a G and the last base to a C
dna.mutate(mutations={0: 'G', dna.n_bp-1: 'C'})
# Get information about the DNA and see the mutated sequence
dna.describe()
DNA structure with 11 base pairs Sequence: GGCGATATAGC Trajectory: <mdtraj.Trajectory with 1 frames, 445 atoms, 22 residues, without unitcells> Frames: (11, 1, 4, 3)
DNA Methylation¶
Apply methylation to specific bases or patterns within the DNA sequence.
In [10]:
Copied!
# Use methylation list, here we methylate the 5th position, which is T, so methylation won't work but is caught by the function
dna.methylate(methylations=[5])
# Or use the methylation function to methylate all CpG sites
dna.methylate(CpG=True)
# Use methylation list, here we methylate the 5th position, which is T, so methylation won't work but is caught by the function
dna.methylate(methylations=[5])
# Or use the methylation function to methylate all CpG sites
dna.methylate(CpG=True)
Residue DT6 with methylations index 5 could not be methylated. Methylate all C in CpG context, superseeds methylations list. Methtylating: [2]
Hoogsteen Base Flipping¶
Perform Hoogsteen flips on specific bases to explore alternative DNA configurations.
In [11]:
Copied!
# Hoogsteen flip can be done at any base pair, here we flip the 5th base pair
dna.flip(fliplist=[5], deg=180)
# Hoogsteen flip can be done at any base pair, here we flip the 5th base pair
dna.flip(fliplist=[5], deg=180)
Flipped residues [5] by 3.141592653589793 radians
Saving and Viewing Modified DNA Structures¶
After modification, save the new DNA structure and compare it to the original.
In [12]:
Copied!
# Get trajectory or save as pdb
traj_mod = dna.get_traj()
traj_mod.save_pdb('./pdbs/dna_modified.pdb')
# Get trajectory or save as pdb
traj_mod = dna.get_traj()
traj_mod.save_pdb('./pdbs/dna_modified.pdb')
In [ ]:
Copied!