Skip to content

Quickstart

This page gets you from zero to a generated, minimized, and analyzed DNA structure in under five minutes.

1. Generate a DNA Structure

import mdna

# From a sequence
dna = mdna.make(sequence='ATCGATCGGT')
dna.describe()

MDNA returns a Nucleic object — the central data structure that holds the sequence, reference frames, and (optionally) an atomic-resolution MDTraj trajectory.

2. Visualize

dna.draw()

This produces a 3D matplotlib plot showing the helical axis and backbone.

3. Minimize the Structure

Monte Carlo relaxation removes steric clashes and elastic strain:

dna.minimize()
dna.draw()

Note

minimize() updates the internal trajectory and frames in-place.

4. Analyze Rigid Base Parameters

params, names = dna.get_parameters()
print("Parameter names:", names)
print("Shape:", params.shape)  # (n_frames, n_bp, n_params)

Or retrieve a single parameter:

twist = dna.get_parameter('twist')

5. Export to PDB

dna.save_pdb('my_dna.pdb')

Or get the MDTraj trajectory directly:

traj = dna.get_traj()

What's Next?

Goal Page
Build custom shapes, circular DNA, extend & connect Building DNA
Mutate, methylate, flip bases Modifying DNA
Analyze trajectories and rigid base parameters Analyzing DNA
Understand how the classes fit together Architecture
Full function/class reference API Reference