IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
tg2_flexfit.py
1## \example bff/structure/imp_bff_flexfit.py
2"""
3Transglutaminase 2: Flexible fitting with AV restraints
4========================================
5transglutaminase 2 (TG2)
6
7
8``IMP.bff`` includes the command line tool ``imp_bff`` that
9contains the program ``flexfit`` - a software to sample and
10optimize biomolecular structures with flexible regions based on
11experimental information such as fluorophore distances in a protein.
12
13The output of ``imp_bff flexfit`` can be visualized in Chimera.
14
15.. image:: ../../img/examples_structure_flexfit.gif
16 :alt: Accessible Volume Flexible Fitting illustrated in Chimera
17 :align: center
18
19``imp_bff flexfit`` uses an initial structure, a flex.fps.json file. A
20flex.fps.json file contains information on inter-label distances and flexible
21regions.
22
23For full help on the rrt_sample tool, run from a command line:
24
25 .. code-block:: console
26
27 $ imp_bff flexfit --help
28
29"""
30# sphinx_gallery_thumbnail_path = 'img/examples_structure_flexfit.gif'
31
32# %%
33# Setup
34# -----------
35# First, obtain the input files used in this example and put them
36# in the current directory, by typing:
37#
38# .. code-block:: console
39#
40# $ cp "<imp_example_path>"/bff/structure/TG2/*.* .
41#
42# (On a Windows machine, use copy rather than cp.) Here, <imp_example_path>
43# is the directory containing the IMP example files. The full path to the
44# files can be determined by running in a Python interpreter.
45
46# %%
47# Calculation
48# -------------
49# Structure of the protein (transglutaminase 2) that are consistent with
50# additional experimental information can be sampled running ``imp_bff flexfit``.
51# First, we need to gather experimental information (here inter fluorophore distances)
52# and define flexible regions. Labeling sites, distances between labeling sites, and
53# flexible regions are listed in the input file flex.fps.json.
54# A flex.fps.json file can contain multiple sets of distances. Thus, distance set used
55# for scoring must be defined via the ``-c`` option. Moreover, a flex.fps.json
56# file can contain multiple sets of flexible residues (this requires to define the used
57# set of flexible resiudes via the ``-f`` option.
58#
59# .. code-block:: console
60#
61# $ imp_bff flexfit -i topology.pdb -l flex.fps.json -c S1_chi2 -f FexResSet1
62#
63# ``imp_bff flexfit`` can operate in a slow and in a fast mode. In the slow mode the
64# accessible volume (AV) of the labels is computed at each iteration. In the fast mode, the
65# AVs of the labels are computed once, the mean label position becomes part of a rigid
66# body and the distance between the mean positions is used for scoring (using a transfer function
67# that transforms distances between mean positions into experimental observables).
68#
69# The output files are RMS files that can be inspected in Chimera.