Getting Started
This guide will help you get started with using mrDNA for DNA molecular modeling.
Basic Usage
Here's a simple example that creates a DNA structure:
# Import necessary modules
from mrdna.segmentmodel import SegmentModel
from mrdna.model.dna_sequence import DNASequence
# Create a segment model
model = SegmentModel()
# Add a DNA segment with a specific sequence
sequence = "GATTACA"
model.add_segment(sequence)
# Save the model to a PDB file
model.to_pdb("example.pdb")
Working with Existing Structures
mrDNA can also read structures from various file formats:
# Import the appropriate reader
from mrdna.readers import read_cadnano
# Load a structure from a cadnano file
model = read_cadnano("my_structure.json")
# Analyze the structure
num_nucleotides = model.count_nucleotides()
print(f"Structure contains {num_nucleotides} nucleotides")
Running a Simulation
To run a simulation with mrDNA:
from mrdna.simulate import multiresolution_simulation
# Set up simulation parameters
output_name = "my_simulation"
gpu = 0 # GPU device to use
# Run the simulation
result_directory = multiresolution_simulation(
model,
output_name=output_name,
gpu=gpu,
coarse_steps=1e7, # Number of coarse-grained steps
fine_steps=1e7, # Number of fine-grained steps
)
Next Steps
Explore the API reference documentation for more detailed information on each module and function.