FRETraj and Jupyter

FRETraj and Jupyter#

This notebook demonstrates how to interface FRETraj with Jupyter. We will compute ACVs for the same DNA hairpin as in the previous PyMOL example and predict a mean FRET efficiency between donor and acceptor.

import mdtraj as md
import fretraj as ft
import os
example_dir = '../../src/fretraj/examples/'
The burst submodule could not be imported

Let’s first load a PDB file of a DNA.

struct = md.load(os.path.join(example_dir+'DNA_hairpin.pdb'))

Next, we load a parameter file specifying the positions of the donor and acceptor labels.

labels = ft.cloud.labeling_params(os.path.join(example_dir+'DNA_hairpin_labels.json'), verbose=False)
labels
Hide code cell output
{'Position': {'Cy3-20-C5': {'attach_id': 626,
   'linker_length': 20,
   'linker_width': 5,
   'dye_radius1': 8,
   'dye_radius2': 3,
   'dye_radius3': 1.5,
   'cv_fraction': 0.57,
   'cv_thickness': 3,
   'use_LabelLib': True,
   'simulation_type': 'AV3',
   'grid_spacing': 1.0,
   'mol_selection': 'all',
   'state': 1,
   'frame_mdtraj': 0,
   'contour_level_AV': 0,
   'contour_level_CV': 0.7,
   'b_factor': 100,
   'gaussian_resolution': 2,
   'grid_buffer': 2.0,
   'transparent_AV': True},
  'Cy5-44-P1': {'attach_id': 1395,
   'linker_length': 20,
   'linker_width': 5,
   'dye_radius1': 9.5,
   'dye_radius2': 3,
   'dye_radius3': 1.5,
   'cv_fraction': 0.39,
   'cv_thickness': 3,
   'use_LabelLib': True,
   'simulation_type': 'AV3',
   'grid_spacing': 1.0,
   'mol_selection': 'all',
   'state': 1,
   'frame_mdtraj': 0,
   'contour_level_AV': 0,
   'contour_level_CV': 0.7,
   'b_factor': 100,
   'gaussian_resolution': 2,
   'grid_buffer': 2.0,
   'transparent_AV': True}},
 'Distance': {'Cy3-Cy5': {'R0': 54, 'n_dist': 1000000}}}

We now calculate an ACV for the donor (Cy3-20-C5) and acceptor (Cy5-44-P1) position.

acv_D = ft.cloud.Volume(struct, 'Cy3-20-C5', labels)
acv_A = ft.cloud.Volume(struct, 'Cy5-44-P1', labels)

The transfer efficiency is calculated by randomly sampling distances between the two ACVs.

fret = ft.cloud.FRET(acv_D, acv_A, 'Cy3-Cy5', labels)
fret.values
R0 (A) <R_DA> (A) <E_DA> <R_DA_E> (A) R_attach (A) R_mp (A)
value 54.0 50.9 0.58 51.2 44.4 48.2
std NaN 10.6 0.24 8.4 NaN NaN

Visualize the ACV together with the DNA directly in the notebook.

acv_D_traj = ft.cloud.create_acv_traj([acv_D])
acv_A_traj = ft.cloud.create_acv_traj([acv_A])
ft.jupyter.nglview_trajectory_ACV(struct, acv_D_traj['FV'], acv_A_traj['FV'], 
                                          acv_D_traj['CV'], acv_A_traj['CV'])

Hint

To see this notebook in action launch a Binder instance by clicking on the 🚀 at the top of the page.