Home Linus Helper Programs Examples File Descriptions Index

Sample LINUS Run Files

 

Minimal Run File

Multiple Simulation Run File

Read Weights Run File

Read Mesostate Run File

All Options Run File


LINUS

 

This example LINUS run file contains all the available options with annotation.

Make a copy of this file in your working directory and edit appropriately for your case.


from pylinus_2_3 import linusSim, ran

def gen_seeds():
    from random import uniform
    s1 = long(uniform(1.0, ran.M1))
    s2 = long(uniform(1.0, ran.M1))
    s3 = long(uniform(1.0, ran.M1))
    s4 = long(uniform(1.0, ran.M2))
    s5 = long(uniform(1.0, ran.M2))
    s6 = long(uniform(1.0, ran.M2))
    return s1, s2, s3, s4, s5, s6

def run(file,seed=None,mlfile=None,wtsfile=None,msfile=None,
        pmsfile=None,distfile=None):
    if seed is None:
        gen = apply(ran.generator, gen_seeds())
    else:
        gen = apply(ran.generator, seed)

    sim = linusSim.Linus(file, gen)

    # Define the number of actual amino acids
    # (Subtract ACE and NME)
    NUMRES = sim.protein.num_residues-2

    # This MUST be left uncommented
    # Set mlfile either to None or the actual name as below
    sim.load_movelist(mlfile)

    # Do not change anything above this line

    # This MAY be left uncommented
    # if msfile = None (see below) all mesostates will be Ck
    # or if msfile is defined below it will be loaded
    # or if use_ms_sampling=0 this will be ignored
    sim.load_mesostates(msfile)

    # Default conformational weights = "smart move set"
    sim.set_weights("helix", 0.25,"all")
    sim.set_weights("strand", 0.25,"all")
    sim.set_weights("turn1", 0.125,"all")
    sim.set_weights("turn2", 0.125,"all")
    sim.set_weights("coil", 0.25,"all")

    # Next command is only necessary if above do not total 1.0
    sim.normalize_weights()
    # Turn this on by defining pmsfile below
    if pmsfile is not None:
        sim.load_pmeso_weights(pmsfile)

    # Turn this on by defining distfile below
    if distfile is not None:
        sim.load_dist_const(distfile)

    # Turn this on by definging weights file below
    if wtsfile is not None:
        sim.read_weights_from_file(wtsfile)

    # with the following use_[flag]'s set to zero a default
    # pylinus simulation will be run
    # if you turn on some of the use_[flags]'s you may have to 
    # define the appropriate file below
    sim.set_simulation_parameters(numsave=100,
                                  beta=2.0,
                                  trials=1,
                                  reset_conformation=0,
                                  reset_emin_struc=0,
                                  updateweights=0,
                                  updatepmeso=0,
                                  use_lock_ss=0,
                                  use_pms_sampling=0,
                                  use_msd_sampling=0,
                                  use_ms_sampling=0,
                                  use_local_mov=0,
                                  use_dist_constraints=0,
                                  write_rc=0,
                                  numcycle=5000)
    sim.set_hbond_parameters(use_hbond=1,
                             hbond_score_short=0.4,
                             hbond_score_long=1.0,
                             hbond_winmax=NUMRES,
                             use_sidechain_hbond=1)
    sim.set_contact_parameters(use_contact=1,
                               contact_winmax=NUMRES)

    sim.run()

if __name__ == "__main__":
    try:
        import psyco
    except ImportError:
        pass
    else:
        psyco.bind(run)  
    import sys, os
    filename = sys.argv[1]
    file = os.path.basename(filename)

    # Only one of the following two lines uncommented
    mlfile = None
#   mlfile = os.path.abspath('movelist')

    # Only one of the following two lines uncommented
    wtsfile = None
#   wtsfile = os.path.abspath('weights')

    # Only one of the following two lines uncommented
    msfile = None
#   msfile = os.path.abspath('mesostates')

    # Only one of the following two lines uncommented
    pmsfile = None
#   pmsfile = os.path.abspath('pmeso_weights')

    # Only one of the following two lines uncommented
    distfile = None
#   distfile = os.path.abspath('noe.tbl')

    basedir = os.getcwd()
    for i in range(1):
        curdir = basedir + os.sep + 'sim_all'
        os.mkdir(curdir)
        os.link(filename, curdir+os.sep+file)

        # if any of these files are defined above uncomment the line
#       os.link('movelist', curdir+os.sep+'movelist')
#       os.link('weights', curdir+os.sep+'weights')
#       os.link('mesostates', curdir+os.sep+'mesostates')
#       os.link('pmeso_weights', curdir+os.sep+'pmeso_weights')
#       os.link('noe.tbl', curdir+os.sep+'noe.tbl')

        os.chdir(curdir)
        run(file,mlfile=mlfile,wtsfile=wtsfile,msfile=msfile,
            pmsfile=pmsfile,distfile=distfile)