Example #1
0
def make_confspace(cfs_file, data, cfs_dir=DEFAULT_CFS_DIR):
    """make_confspace

    Generate conf spaces from input file

    Takes as input a cfs_file that contains chain definitions, flexible
    residues, and mutable residues.

    Returns a dictionary containing forcefield parameters and OSPREY
    confspace objects for:
        protein
        ligand
        complex
    """
    # Get the pdb code for this design
    data["pdb"] = cfs_file[:4]
    print("pdb: %s" % data["pdb"])

    # Load the design conformation space information
    data["cfs"] = os.path.join(cfs_dir, cfs_file)
    confspace = imp.load_source('confspace', data["cfs"])
    print("CFS File: %s" % data["cfs"])

    # Get the sequences if they exist
    try:
        data["sequences"] = confspace.sequences
    except AttributeError:
        data["sequences"] = [None]

    ffparams = osprey.ForcefieldParams()
    mol = osprey.readPdb(confspace.mol)
    template_library = osprey.TemplateLibrary(ffparams.forcefld)

    # Make sure we don't have 3 strands (some cfs files do)
    assert len(confspace.strand_defs) == 2

    # Define the protein strand
    protein = osprey.Strand(mol,
                            templateLib=template_library,
                            residues=confspace.strand_defs["strand0"])
    for resi, res_allowed in confspace.strand_flex["strand0"].iteritems():
        protein.flexibility[resi]\
                .setLibraryRotamers(osprey.WILD_TYPE, *res_allowed)\
                .setContinuous()\
                .addWildTypeRotamers()

    # Define the ligand strand
    ligand = osprey.Strand(mol,
                           templateLib=template_library,
                           residues=confspace.strand_defs["strand1"])
    for resi, res_allowed in confspace.strand_flex["strand1"].iteritems():
        ligand.flexibility[resi]\
                .setLibraryRotamers(osprey.WILD_TYPE,*res_allowed)\
                .setContinuous()\
                .addWildTypeRotamers()

    # Build spaces
    return {
        'protein': osprey.ConfSpace(protein),
        'ligand': osprey.ConfSpace(ligand),
        'complex': osprey.ConfSpace([protein, ligand]),
        'ffparams': ffparams
    }
Example #2
0
import osprey

osprey.start()

# choose a forcefield
ffparams = osprey.ForcefieldParams()

# read a PDB file for molecular info
mol = osprey.readPdb(
    '../../test-resources/4npd.A_DomainA_noH_trim_his_clean.min.pdb')

# make sure all strands share the same template library
templateLib = osprey.TemplateLibrary(ffparams.forcefld)

# define the protein strand
protein = osprey.Strand(mol, templateLib=templateLib, residues=['A1', 'A37'])
protein.flexibility['A8'].setLibraryRotamers(
    osprey.WILD_TYPE).addWildTypeRotamers().setContinuous()

# define the ligand strand
ligand = osprey.Strand(mol, templateLib=templateLib, residues=['A38', 'A58'])
ligand.flexibility['A41'].setLibraryRotamers(
    osprey.WILD_TYPE).addWildTypeRotamers().setContinuous()
ligand.flexibility['A42'].setLibraryRotamers(
    osprey.WILD_TYPE, 'THR', 'LYS').addWildTypeRotamers().setContinuous()
ligand.flexibility['A45'].setLibraryRotamers(
    osprey.WILD_TYPE).addWildTypeRotamers().setContinuous()
ligand.flexibility['A46'].setLibraryRotamers(
    osprey.WILD_TYPE).addWildTypeRotamers().setContinuous()

# make the conf space for the protein+ligand complex
Example #3
0
import osprey

osprey.start()

# default template library contains templates, coords, entropies etc for natual amino acids
defaultTemplateLib = osprey.TemplateLibrary()

# define our custom templates
customTemplates = """
Ignored comment 1
Ignored comment 2
ALANINE
 ALA  INT     1                                                 
 CORR OMIT DU   BEG                                             
   0.00000                                                      
   1  DUMM  DU    M    0  -1  -2     0.000     0.000     0.000  0.00000 
   2  DUMM  DU    M    1   0  -1     1.449     0.000     0.000  0.00000 
   3  DUMM  DU    M    2   1   0     1.522   111.100     0.000  0.00000 
   4  N     N     M    3   2   1     1.335   116.600   180.000 -0.41570 
   5  H     H     E    4   3   2     1.010   119.800     0.000  0.27190 
   6  CA    CT    M    4   3   2     1.449   121.900   180.000  0.03370 
   7  HA    H1    E    6   4   3     1.090   109.500   300.000  0.08230 
   8  CB    CT    3    6   4   3     1.525   111.100    60.000 -0.18250 
   9  HB1   HC    E    8   6   4     1.090   109.500    60.000  0.06030 
  10  HB2   HC    E    8   6   4     1.090   109.500   180.000  0.06030 
  11  HB3   HC    E    8   6   4     1.090   109.500   300.000  0.06030 
  12  C     C     M    6   4   3     1.522   111.100   180.000  0.59730 
  13  O     O     E   12   6   4     1.229   120.500     0.000 -0.56790 

IMPROPER                                                        
 -M   CA   N    H                                               
Example #4
0
import osprey
osprey.start()

# choose a forcefield
ffparams = osprey.ForcefieldParams()

# read a PDB file for molecular info
mol = osprey.readPdb('2RL0.min.reduce.pdb')

# make sure all strands share the same template library (including wild-type rotamers)
templateLib = osprey.TemplateLibrary(ffparams.forcefld,
                                     moleculesForWildTypeRotamers=[mol])

# define the protein strand
protein = osprey.Strand(mol,
                        templateLib=templateLib,
                        residues=['G648', 'G654'])
protein.flexibility['G649'].setLibraryRotamers(osprey.WILD_TYPE, 'TYR', 'ALA', 'VAL', 'ILE', 'LEU') \
 .addWildTypeRotamers().setContinuous()
for res in ['G650', 'G651', 'G654']:
    protein.flexibility[res].setLibraryRotamers(
        osprey.WILD_TYPE).addWildTypeRotamers().setContinuous()

# define the ligand strand
ligand = osprey.Strand(mol, templateLib=templateLib, residues=['A155', 'A194'])
for res in ['A156', 'A172', 'A192', 'A193']:
    ligand.flexibility['A156'].setLibraryRotamers(
        osprey.WILD_TYPE).addWildTypeRotamers().setContinuous()

# make the conf space for the protein, ligand, and complex
proteinConfSpace = osprey.ConfSpace(protein)
Example #5
0
osprey.start()

# what kind of hardware do we have?
parallelism = osprey.Parallelism(cpuCores=2)
# or use GPUs
gpuPrallelism = osprey.Parallelism(cpuCores=2, gpus=1, streamsPerGpu=1)

# choose a forcefield
ffparams = osprey.ForcefieldParams(osprey.Forcefield.AMBER)
ffparams.solvationForcefield = osprey.SolvationForcefield.EEF1  # this is the default
# or turn off solvation energy
#ffparams.solvationForcefield = None

# choose a template library
# (see templateLibrary.py for more detailed examples of custom template libraries)
templateLib = osprey.TemplateLibrary()

# load a molecule
mol = osprey.readPdb('1CC8.ss.pdb')

# define the protein strand
protein = osprey.Strand(mol, residues=['A2', 'A30'])

protein.flexibility['A2'].setLibraryRotamers('ALA', 'GLY')
protein.flexibility['A3'].setLibraryRotamers(osprey.WILD_TYPE, 'VAL',
                                             'ARG').setContinuous(10)
protein.flexibility['A4'].setLibraryRotamers(
    osprey.WILD_TYPE).addWildTypeRotamers()

# make the conf space
confSpace = osprey.ConfSpace(protein)
Example #6
0
def loadd_confspaces(config,
                     xtal_rotamers=True,
                     continuous=False,
                     force_wt=True):
    """Loads OSPREY ConfSpace objects from a config dictionary.

        OPTIONS:
            xtal_rotamers:  if true, add the rotamers from the input pdb
            continuous:     if true, set continuous rotamers
            force_wt:       if true, always add the wild-type amino acid

    """
    ffparams = osprey.ForcefieldParams()
    mol = osprey.readPdb(join(PDB, config["molecule"]))
    template_library = osprey.TemplateLibrary(ffparams.forcefld)
    # Make sure we don't have 3 strands (some cfs files do)
    if len(config["strand_definitions"]) > 2:
        exit()

    # Define the protein strand
    protein = osprey.Strand(mol,
                            templateLib=template_library,
                            residues=config["strand_definitions"]["strand0"])
    for resi, res_allowed in config["strand_mutations"]["strand0"].items():

        # Add the osprey.WILD_TYPE object to the allowed residues if desired
        if force_wt:
            res_allowed.append(osprey.WILD_TYPE)

        # Set the flexibility
        protein.flexibility[resi]\
                .setLibraryRotamers(*res_allowed)
        if xtal_rotamers:
            protein.flexibility[resi].addWildTypeRotamers()
        if continuous:
            protein.flexibility[resi].setContinuous()

    # Define the ligand strand
    ligand = osprey.Strand(mol,
                           templateLib=template_library,
                           residues=config["strand_definitions"]["strand1"])
    for resi, res_allowed in config["strand_mutations"]["strand1"].items():

        # Add the osprey.WILD_TYPE object to the allowed residues if desired
        if force_wt:
            res_allowed.append(osprey.WILD_TYPE)

        # Set the flexibility
        ligand.flexibility[resi]\
                .setLibraryRotamers(*res_allowed)
        if xtal_rotamers:
            ligand.flexibility[resi].addWildTypeRotamers()
        if continuous:
            ligand.flexibility[resi].setContinuous()

    # Build spaces
    return {
        'protein': osprey.ConfSpace(protein),
        'ligand': osprey.ConfSpace(ligand),
        'complex': osprey.ConfSpace([protein, ligand]),
        'ffparams': ffparams
    }