コード例 #1
0
    def test_virtual_residue_atoms(self):
        cg = ftmc.from_pdb('test/forgi/threedee/data/1y26.pdb')

        ftug.add_virtual_residues(cg, 's0')
        ftug.add_virtual_residues(cg, 's1')
        bases_to_test = []
        bases_to_test.append(ftug.virtual_residue_atoms(cg, 's0', 1, 0))
        bases_to_test.append(ftug.virtual_residue_atoms(cg, 's0', 2, 1))
        bases_to_test.append(ftug.virtual_residue_atoms(cg, 's1', 0, 0))

        #Assert that any two atoms of the same base within reasonable distance to each other
        #(https://en.wikipedia.org/wiki/Bond_length says than a CH-bond is >= 1.06A)
        for va in bases_to_test:
            for k1, v1 in va.items():
                for k2, v2 in va.items():
                    dist = ftuv.magnitude(v1 - v2)
                    self.assertLess(dist,
                                    30,
                                    msg="Nucleotide too big: "
                                    "Distance between {} and {} is {}".format(
                                        k1, k2, dist))
                    if k1 != k2:
                        dist = ftuv.magnitude(v1 - v2)
                        self.assertGreater(
                            dist,
                            0.8,
                            msg="Nucleotide too small: "
                            "Distance between {} and {} is {}".format(
                                k1, k2, dist))
コード例 #2
0
 def test_virtual_residue_atom_exact_match(self):
     #This test serves to detect unwanted changes in the virtual atom calculation algorithm.
     #It is allowed to fail, if the virtual atom calculation changes.
     cg = ftmc.from_pdb('test/forgi/threedee/data/1y26.pdb')
     ftug.add_virtual_residues(cg, 's0')
     vres= ftug.virtual_residue_atoms(cg, 's0', 1, 0)
     nptest.assert_allclose(vres['C8'], np.array([ 5.60052258, -2.31817798, -2.74075904]))
     nptest.assert_allclose(vres['N2'], np.array([ 7.27932017,  2.84403948, -2.83806392]))
コード例 #3
0
 def test_virtual_residue_atom_exact_match(self):
     #This test serves to detect unwanted changes in the virtual atom calculation algorithm.
     #It is allowed to fail, if the virtual atom calculation changes.
     cg = ftmc.from_pdb('test/forgi/threedee/data/1y26.pdb')
     ftug.add_virtual_residues(cg, 's0')
     vres = ftug.virtual_residue_atoms(cg, 's0', 1, 0)
     nptest.assert_allclose(vres['C8'],
                            np.array([5.23455929, -2.9606417, -2.18156476]))
     nptest.assert_allclose(vres['N2'],
                            np.array([6.99285237, 2.32505693, -1.95868568]))
コード例 #4
0
 def setUp(self):
     self.rs_random_281=ftmc.from_pdb('test/forgi/threedee/data/RS_random_281_S_0.pdb')
     for key in self.rs_random_281.defines.keys():
       if key[0] =="s":
         ftug.add_virtual_residues(self.rs_random_281, key)
     self.minimal_multiloop = ftmc.CoarseGrainRNA()
     self.minimal_multiloop.from_file('test/forgi/threedee/data/minimal_multiloop.cg')
     for key in self.minimal_multiloop.defines.keys():
       if key[0] =="s":
         ftug.add_virtual_residues(self.minimal_multiloop, key)
コード例 #5
0
ファイル: graph_pdb_test.py プロジェクト: tcarlile/forgi
 def setUp(self):
     self.rs_random_281=ftmc.from_pdb('test/forgi/threedee/data/RS_random_281_S_0.pdb')
     for key in self.rs_random_281.defines.keys():
       if key[0] =="s":
         ftug.add_virtual_residues(self.rs_random_281, key)
     self.minimal_multiloop = ftmc.CoarseGrainRNA()
     self.minimal_multiloop.from_file('test/forgi/threedee/data/minimal_multiloop.cg')
     for key in self.minimal_multiloop.defines.keys():
       if key[0] =="s":
         ftug.add_virtual_residues(self.minimal_multiloop, key)
コード例 #6
0
ファイル: graph_pdb_test.py プロジェクト: pkerpedjiev/forgi
    def setUp(self):
        try:
            self.rs_random_281, = ftmc.CoarseGrainRNA.from_pdb(
                'test/forgi/threedee/data/RS_random_281_S_0.pdb', annotation_tool="MC-Annotate")
        except ftmc.AnnotationToolNotInstalled:
            self.skipTest("Requires MC-Annotate")

        for key in self.rs_random_281.defines.keys():
            if key[0] == "s":
                ftug.add_virtual_residues(self.rs_random_281, key)
        self.minimal_multiloop = ftmc.CoarseGrainRNA.from_bg_file(
            'test/forgi/threedee/data/minimal_multiloop.cg')
        for key in self.minimal_multiloop.defines.keys():
            if key[0] == "s":
                ftug.add_virtual_residues(self.minimal_multiloop, key)
コード例 #7
0
ファイル: graph_pdb_test.py プロジェクト: pkerpedjiev/forgi
 def test_basis_transformation_for_virtual_residues(self):
     cg, = ftmc.CoarseGrainRNA.from_pdb('test/forgi/threedee/data/1y26.pdb')
     ftug.add_virtual_residues(cg, 's0')
     offset = cg.vposs["s0"][0]
     vbasis = cg.vbases["s0"][0]
     local_pos = np.array([0, 0, 1])
     global_pos = np.dot(vbasis.transpose(), local_pos) + offset
     # Checking dimensions of vectors, just in case...
     self.assertEqual(len(global_pos), 3)
     self.assertEqual(len(vbasis), 3)
     self.assertEqual(len(vbasis[0]), 3)
     # Analytically true:
     self.assertTrue(all(global_pos[x] - vbasis[2][x] - offset[x] < 0.0000001 for x in [0, 1, 2]),
                     msg="global pos for (0,0,1) should be {}+{}={}, but is {} instead.".format(
         vbasis[2], offset, vbasis[2] + offset, global_pos))
コード例 #8
0
 def test_basis_transformation_for_virtual_residues(self):
     cg = ftmc.from_pdb('test/forgi/threedee/data/1y26.pdb')
     ftug.add_virtual_residues(cg, 's0')
     offset=cg.vposs["s0"][0]
     vbasis=cg.vbases["s0"][0]
     local_pos=np.array([0,0,1])
     global_pos = np.dot(vbasis.transpose(), local_pos) + offset
     #Checking dimensions of vectors, just in case...
     self.assertEqual(len(global_pos),3)
     self.assertEqual(len(vbasis),3)
     self.assertEqual(len(vbasis[0]),3)
     #Analytically true: 
     self.assertTrue(all(global_pos[x]-vbasis[2][x]-offset[x]<0.0000001 for x in [0,1,2]), 
               msg="global pos for (0,0,1) should be {}+{}={}, but is {} instead.".format(
                                               vbasis[2], offset, vbasis[2]+offset, global_pos))
コード例 #9
0
ファイル: graph_pdb_test.py プロジェクト: porteusconf/forgi
    def setUp(self):
        try:
            self.rs_random_281, = ftmc.CoarseGrainRNA.from_pdb(
                'test/forgi/threedee/data/RS_random_281_S_0.pdb',
                annotation_tool="MC-Annotate")
        except ftmc.AnnotationToolNotInstalled:
            self.skipTest("Requires MC-Annotate")

        for key in self.rs_random_281.defines.keys():
            if key[0] == "s":
                ftug.add_virtual_residues(self.rs_random_281, key)
        self.minimal_multiloop = ftmc.CoarseGrainRNA.from_bg_file(
            'test/forgi/threedee/data/minimal_multiloop.cg')
        for key in self.minimal_multiloop.defines.keys():
            if key[0] == "s":
                ftug.add_virtual_residues(self.minimal_multiloop, key)
コード例 #10
0
ファイル: graph_pdb_test.py プロジェクト: pkerpedjiev/forgi
 def test_virtual_residue_atom_exact_match(self):
     # This test serves to detect unwanted changes in the virtual atom calculation algorithm.
     # It is allowed to fail, if the virtual atom calculation changes.
     try:
         cg, = ftmc.CoarseGrainRNA.from_pdb('test/forgi/threedee/data/1y26.pdb',
                                            annotation_tool="MC-Annotate")
     except ftmc.AnnotationToolNotInstalled:
         self.skipTest("Requires MC-Annotate")
     ftug.add_virtual_residues(cg, 's0')
     vres = ftug.virtual_residue_atoms(cg, 's0', 1, 0)
     print(vres['C8'])
     print(vres['N2'])
     nptest.assert_allclose(vres['C8'], np.array(
         [5.17130963, -2.93616933, -2.16725865]))
     nptest.assert_allclose(vres['N2'], np.array(
         [6.91170703,  2.35440312, -1.92080436]))
コード例 #11
0
ファイル: graph_pdb_test.py プロジェクト: porteusconf/forgi
    def test_coordinates_for_add_virtual_residues(self):
        try:
            cg, = ftmc.CoarseGrainRNA.from_pdb(
                'test/forgi/threedee/data/1y26.pdb',
                annotation_tool="MC-Annotate")
        except ftmc.AnnotationToolNotInstalled:
            self.skipTest("This requires MC-Annotate")

        ftug.add_virtual_residues(cg, 's0')
        # XYZ coordinate for first residue are ok:
        self.assertAlmostEqual(
            cg.vposs["s0"][0][0],
            2.3,
            delta=3,
            msg="Wrong x-position for virtual residue 0 of stem s0: {}".format(
                cg.vposs["s0"][0][0]))
        self.assertAlmostEqual(
            cg.vposs["s0"][0][1],
            1.3,
            delta=3,
            msg="Wrong y-position for virtual residue 0 of stem s0: {}".format(
                cg.vposs["s0"][0][1]))
        self.assertAlmostEqual(
            cg.vposs["s0"][0][2],
            1.0,
            delta=3,
            msg="Wrong z-position for virtual residue 0 of stem s0: {}".format(
                cg.vposs["s0"][0][2]))
        last_residue = cg.stem_length("s0") - 1
        self.assertAlmostEqual(
            cg.vposs["s0"][last_residue][0],
            16,
            delta=4,
            msg="Wrong x-position for virtual residue {} of stem s0: {}".
            format(last_residue, cg.vposs["s0"][last_residue][0]))
        self.assertAlmostEqual(
            cg.vposs["s0"][last_residue][1],
            -13,
            delta=4,
            msg="Wrong y-position for virtual residue {} of stem s0: {}".
            format(last_residue, cg.vposs["s0"][last_residue][1]))
        self.assertAlmostEqual(
            cg.vposs["s0"][last_residue][2],
            8,
            delta=4,
            msg="Wrong z-position for virtual residue {} of stem s0: {}".
            format(last_residue, cg.vposs["s0"][last_residue][2]))
コード例 #12
0
 def test_coordinates_for_add_virtual_residues(self):
     cg = ftmc.from_pdb('test/forgi/threedee/data/1y26.pdb')
     ftug.add_virtual_residues(cg, 's0')
     #XYZ coordinate for first residue are ok:
     self.assertAlmostEqual(cg.vposs["s0"][0][0], 2.3, delta=3, 
               msg="Wrong x-position for virtual residue 0 of stem s0: {}".format(cg.vposs["s0"][0][0]))
     self.assertAlmostEqual(cg.vposs["s0"][0][1], 1.3, delta=3, 
               msg="Wrong y-position for virtual residue 0 of stem s0: {}".format(cg.vposs["s0"][0][1]))
     self.assertAlmostEqual(cg.vposs["s0"][0][2], 1.0, delta=3, 
               msg="Wrong z-position for virtual residue 0 of stem s0: {}".format(cg.vposs["s0"][0][2]))
     last_residue=cg.stem_length("s0") - 1
     self.assertAlmostEqual(cg.vposs["s0"][last_residue][0], 16, delta=4, 
               msg="Wrong x-position for virtual residue {} of stem s0: {}".format(last_residue,cg.vposs["s0"][last_residue][0]))
     self.assertAlmostEqual(cg.vposs["s0"][last_residue][1], -13, delta=4, 
               msg="Wrong y-position for virtual residue {} of stem s0: {}".format(last_residue,cg.vposs["s0"][last_residue][1]))
     self.assertAlmostEqual(cg.vposs["s0"][last_residue][2], 8, delta=4, 
               msg="Wrong z-position for virtual residue {} of stem s0: {}".format(last_residue,cg.vposs["s0"][last_residue][2]))
コード例 #13
0
ファイル: graph_pdb_test.py プロジェクト: porteusconf/forgi
 def test_virtual_residue_atom_exact_match(self):
     # This test serves to detect unwanted changes in the virtual atom calculation algorithm.
     # It is allowed to fail, if the virtual atom calculation changes.
     try:
         cg, = ftmc.CoarseGrainRNA.from_pdb(
             'test/forgi/threedee/data/1y26.pdb',
             annotation_tool="MC-Annotate")
     except ftmc.AnnotationToolNotInstalled:
         self.skipTest("Requires MC-Annotate")
     ftug.add_virtual_residues(cg, 's0')
     vres = ftug.virtual_residue_atoms(cg, 's0', 1, 0)
     print(vres['C8'])
     print(vres['N2'])
     nptest.assert_allclose(
         vres['C8'], np.array([5.17130963, -2.93616933, -2.16725865]))
     nptest.assert_allclose(vres['N2'],
                            np.array([6.91170703, 2.35440312, -1.92080436]))
コード例 #14
0
ファイル: graph_pdb_test.py プロジェクト: tcarlile/forgi
 def test_coordinates_for_add_virtual_residues(self):
     cg = ftmc.from_pdb('test/forgi/threedee/data/1y26.pdb')
     ftug.add_virtual_residues(cg, 's0')
     #XYZ coordinate for first residue are ok:
     self.assertAlmostEqual(cg.vposs["s0"][0][0], 2.3, delta=3, 
               msg="Wrong x-position for virtual residue 0 of stem s0: {}".format(cg.vposs["s0"][0][0]))
     self.assertAlmostEqual(cg.vposs["s0"][0][1], 1.3, delta=3, 
               msg="Wrong y-position for virtual residue 0 of stem s0: {}".format(cg.vposs["s0"][0][1]))
     self.assertAlmostEqual(cg.vposs["s0"][0][2], 1.0, delta=3, 
               msg="Wrong z-position for virtual residue 0 of stem s0: {}".format(cg.vposs["s0"][0][2]))
     last_residue=cg.stem_length("s0") - 1
     self.assertAlmostEqual(cg.vposs["s0"][last_residue][0], 16, delta=4, 
               msg="Wrong x-position for virtual residue {} of stem s0: {}".format(last_residue,cg.vposs["s0"][last_residue][0]))
     self.assertAlmostEqual(cg.vposs["s0"][last_residue][1], -13, delta=4, 
               msg="Wrong y-position for virtual residue {} of stem s0: {}".format(last_residue,cg.vposs["s0"][last_residue][1]))
     self.assertAlmostEqual(cg.vposs["s0"][last_residue][2], 8, delta=4, 
               msg="Wrong z-position for virtual residue {} of stem s0: {}".format(last_residue,cg.vposs["s0"][last_residue][2]))
コード例 #15
0
ファイル: graph_pdb_test.py プロジェクト: pkerpedjiev/forgi
    def test_coordinates_for_add_virtual_residues(self):
        try:
            cg, = ftmc.CoarseGrainRNA.from_pdb('test/forgi/threedee/data/1y26.pdb', annotation_tool="MC-Annotate")
        except ftmc.AnnotationToolNotInstalled:
            self.skipTest("This requires MC-Annotate")

        ftug.add_virtual_residues(cg, 's0')
        # XYZ coordinate for first residue are ok:
        self.assertAlmostEqual(cg.vposs["s0"][0][0], 2.3, delta=3,
                               msg="Wrong x-position for virtual residue 0 of stem s0: {}".format(cg.vposs["s0"][0][0]))
        self.assertAlmostEqual(cg.vposs["s0"][0][1], 1.3, delta=3,
                               msg="Wrong y-position for virtual residue 0 of stem s0: {}".format(cg.vposs["s0"][0][1]))
        self.assertAlmostEqual(cg.vposs["s0"][0][2], 1.0, delta=3,
                               msg="Wrong z-position for virtual residue 0 of stem s0: {}".format(cg.vposs["s0"][0][2]))
        last_residue = cg.stem_length("s0") - 1
        self.assertAlmostEqual(cg.vposs["s0"][last_residue][0], 16, delta=4,
                               msg="Wrong x-position for virtual residue {} of stem s0: {}".format(last_residue, cg.vposs["s0"][last_residue][0]))
        self.assertAlmostEqual(cg.vposs["s0"][last_residue][1], -13, delta=4,
                               msg="Wrong y-position for virtual residue {} of stem s0: {}".format(last_residue, cg.vposs["s0"][last_residue][1]))
        self.assertAlmostEqual(cg.vposs["s0"][last_residue][2], 8, delta=4,
                               msg="Wrong z-position for virtual residue {} of stem s0: {}".format(last_residue, cg.vposs["s0"][last_residue][2]))
コード例 #16
0
ファイル: graph_pdb_test.py プロジェクト: pkerpedjiev/forgi
    def test_virtual_residue_atoms(self):
        cg, = ftmc.CoarseGrainRNA.from_pdb('test/forgi/threedee/data/1y26.pdb')

        ftug.add_virtual_residues(cg, 's0')
        ftug.add_virtual_residues(cg, 's1')
        bases_to_test = []
        bases_to_test.append(ftug.virtual_residue_atoms(cg, 's0', 1, 0))
        bases_to_test.append(ftug.virtual_residue_atoms(cg, 's0', 2, 1))
        bases_to_test.append(ftug.virtual_residue_atoms(cg, 's1', 0, 0))

        # Assert that any two atoms of the same base within reasonable distance to each other
        #(https://en.wikipedia.org/wiki/Bond_length says than a CH-bond is >= 1.06A)
        for va in bases_to_test:
            for k1, v1 in va.items():
                for k2, v2 in va.items():
                    dist = ftuv.magnitude(v1 - v2)
                    self.assertLess(dist, 30, msg="Nucleotide too big: "
                                    "Distance between {} and {} is {}".format(k1, k2, dist))
                    if k1 != k2:
                        dist = ftuv.magnitude(v1 - v2)
                        self.assertGreater(dist, 0.8, msg="Nucleotide too small: "
                                           "Distance between {} and {} is {}".format(k1, k2, dist))
コード例 #17
0
ファイル: ernwin_go.py プロジェクト: pkerpedjiev/ernwin
def predict(bg, energies_to_sample, options):
    fud.pv('energies_to_sample[0].energies')

    if options.cheating:
        sm = fbm.SpatialModel(bg)
        #energies_to_sample += [fbe.CombinedEnergy([], [fbe.CheatingEnergy(sm.bg)])]
        energies_to_sample = [fbe.CheatingEnergy(sm.bg)]

    if not os.path.exists(options.output_dir):
        os.makedirs(options.output_dir)
    if options.output_file == None or options.output_file == sys.stdout:
        options.output_file = sys.stdout
    else:
        options.output_file = open(options.output_file, 'w')

    cbc.Configuration.sampling_output_dir = op.join(options.output_dir, bg.name)

    if options.output_dir_suffix != None:
        cbc.Configuration.sampling_output_dir = op.join(cbc.Configuration.sampling_output_dir, options.output_dir_suffix)

    if not os.path.exists(cbc.Configuration.sampling_output_dir):
        os.makedirs(cbc.Configuration.sampling_output_dir)

    if options.fix_all_loops:
        options.fix_loop = ','.join([d for d in bg.defines if d[0] == 'i'])

    if options.jared_dir is not None:
        # run the jar3d_annotate script to get a list of potential statistics for each interior loop
        jared_script = op.join(options.jared_dir, 'scripts/annotate_structure.py')
        jared_data = op.join(options.jared_dir, 'JAR3D')

        filtered_stats_fn = op.join(cbc.Configuration.sampling_output_dir,
                                    'filtered.stats')

        cmd = ['python', jared_script, options.bg_filename, '-o', jared_data,
               '-m', '-e', '-d', jared_data]

        fud.pv('cmd')
        p = spr.Popen(cmd, stdout=spr.PIPE)
        out, err = p.communicate()

        with open(filtered_stats_fn, 'w') as filtered_out:
            filtered_out.write(out)

        filtered_stats = ftms.FilteredConformationStats(stats_file=options.stats_file,
                                                        filter_filename=filtered_stats_fn)
        ftms.set_conformation_stats(filtered_stats)
        print >>sys.stderr, "Using JAR3D filtered stats"
    elif options.filtered_stats_file is not None:
        filtered_stats = ftms.FilteredConformationStats(stats_file=options.stats_file,
                                                        filter_filename=options.filtered_stats_file)
        ftms.set_conformation_stats(filtered_stats)
    elif options.fix_loop is not None:
        filtered_stats = ftms.FilteredConformationStats(stats_file=options.stats_file)
        filtered_stats.filtered_stats = col.defaultdict(list)

        for element_to_fix in options.fix_loop.split(','):
            print >>sys.stderr, "fixing loop", element_to_fix
            if element_to_fix[0] != 'i' and element_to_fix[0] != 'm':
                print >>sys.stderr, "Cannot fix non-interior loop or multi-loop stats, yet!"
                sys.exit(1)
            as1, as2 = bg.get_bulge_angle_stats(element_to_fix)


            filtered_stats.filtered_stats[(element_to_fix, as1.ang_type)] += [as1]
            filtered_stats.filtered_stats[(element_to_fix, as2.ang_type)] += [as2]

        ftms.set_conformation_stats(filtered_stats)
        fud.pv('element_to_fix')

    elif options.stats_file is not None:
        cbc.Configuration.stats_file = options.stats_file
        print >>sys.stderr, "1"
        ftms.set_conformation_stats(ftms.ConformationStats(options.stats_file))

    sm = fbm.SpatialModel(bg)

    if options.log_to_file:
        options.output_file = open(op.join(cbc.Configuration.sampling_output_dir, 'log.txt'), 'w')

    if options.eval_energy:
        for s in sm.bg.stem_iterator():
            cgg.add_virtual_residues(sm.bg, s)

        for energy in energies_to_sample:
            fud.pv('energy.eval_energy(sm, verbose=True, background=False)')
        sys.exit(1)

    if options.plot:
        plotter = fbs.StatisticsPlotter()
    else:
        plotter = None

    colors = ['g','y','r']
    samplers = []

    # parse the distances that we want to keep track of 
    to_track_dists = []
    if options.dists is not None:
        for distance_pair in options.dists.split(':'):
            to_track_dists += [map(int, distance_pair.split(','))]

    # only samples from the first energy will be saved
    silent = False

    for color,energy in zip(colors, energies_to_sample):
        fud.pv('options.no_rmsd')
        stat = fbs.SamplingStatistics(sm, plotter, color, silent=silent, 
                                      output_file=options.output_file, 
                                      save_n_best = options.save_n_best, 
                                      dists = to_track_dists, 
                                      save_iterative_cg_measures=options.save_iterative_cg_measures, 
                                      no_rmsd = options.no_rmsd)
        stat.step_save = options.step_save

        fud.pv('options.mcmc_sampler')
        if options.mcmc_sampler:
            sm = fbm.SpatialModel(copy.deepcopy(bg))

            sm.constraint_energy = fbe.CombinedEnergy([])
            sm.junction_constraint_energy = fbe.CombinedEnergy([])

            if not (options.cheating or options.no_constraint):
                sm.constraint_energy = fbe.CombinedEnergy([fbe.CoarseStemClashEnergy(), fbe.StemVirtualResClashEnergy()])
                sm.junction_constraint_energy = fbe.RoughJunctionClosureEnergy()
            else:
                sm.constraint_energy = None
                sm.junction_constraint_energy = None

            #sm.constraint_energy = fbe.CombinedEnergy([fbe.RoughJunctionClosureEnergy()])
            #sm.constraint_energy = fbe.CombinedEnergy([fbe.StemVirtualResClashEnergy()])
            #sm.constraint_energy = fbe.CombinedEnergy([fbe.StemVirtualResClashEnergy(), fbe.RoughJunctionClosureEnergy()])
            if options.track_energies:
                energies_to_track = [fbe.RadiusOfGyrationEnergy()]

                fud.pv('len(list(bg.hloop_iterator()))')
                if len(list(bg.hloop_iterator())) > 1:
                    energies_to_track += [fbe.ShortestLoopDistanceEnergy()]
                    for h in bg.hloop_iterator():
                        energies_to_track += [fbe.ShortestLoopDistancePerLoop(h)]

                energies_to_track += [fbe.AMinorEnergy(loop_type='h')]
                #energies_to_track += [fbe.AMinorEnergy(loop_type='i')]
            else:
                energies_to_track = []

            fud.pv('energies_to_track')
            fud.pv('energy')
            sampler = fbs.MCMCSampler(sm, energy, stat, options.stats_type, options.no_rmsd, energies_to_track=energies_to_track)
            sampler.dump_measures = options.dump_energies
            samplers += [sampler]
        else:
            sm = fbm.SpatialModel(copy.deepcopy(bg))
            sm.constraint_energy = fbe.StemVirtualResClashEnergy()
            samplers += [fbs.GibbsBGSampler(sm, energy, stat)]
        silent = True

    fud.pv('samplers')
    for i in range(options.iterations):
        if options.single_sampler:
            samplers[0].step()
        else:
            for s in samplers:
                s.step()

    #stats.print_final_stats(energy_function)
    #stats.save_top()

    if plotter:
        plotter.finish()
        #plotter.plt.ioff()
        #plt.show()
        pass