예제 #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
    }
예제 #2
0
import osprey

osprey.start()

# define a strand
strand = osprey.Strand('1CC8.ss.pdb')
strand.flexibility['A2'].setLibraryRotamers('ALA', 'GLY')
strand.flexibility['A3'].setLibraryRotamers(osprey.WILD_TYPE, 'VAL')
strand.flexibility['A4'].setLibraryRotamers(osprey.WILD_TYPE)

# make the conf space
confSpace = osprey.ConfSpace(strand)

# choose a forcefield
ffparams = osprey.ForcefieldParams()

# how should we compute energies of molecules?
ecalc = osprey.EnergyCalculator(confSpace, ffparams)

# how should we define energies of conformations?
confEcalc = osprey.ConfEnergyCalculator(confSpace, ecalc)

# compute the energy matrix
emat = osprey.EnergyMatrix(confEcalc)

# run DEE with just steric pruning
pmat = osprey.DEE(confSpace, emat, showProgress=True)

# or run DEE with Goldstein pruning
#i0 = 10.0 # kcal/mol
예제 #3
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
예제 #4
0
customizedTemplateLib = osprey.TemplateLibrary(
    extraTemplates=[customTemplates],
    extraTemplateCoords=[customTemplateCoords],
    extraRotamers=[customRotamers])

# or read templates from files
# customizedTemplateLibFromFiles = osprey.TemplateLibrary(
# 	extraTemplates=['/path/to/templates/file']
# 	etc...
# )

# or completely replace default templates
# completelyCustomTemplateLib = osprey.TemplateLibrary(
# 	defaultTemplates=False,
# 	extraTemplates=['/path/to/all/templates'],
# 	etc...
# )

# load the molecule and make the strand using our custom template library
protein = osprey.Strand('1CC8.ss.pdb', templateLib=customizedTemplateLib)

# make the conf space
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()
confSpace = osprey.ConfSpace(protein)

# continue design with confSpace
예제 #5
0
파일: bbkstar.py 프로젝트: yazhai/OSPREY3
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
templateLib = osprey.TemplateLibrary(ffparams.forcefld)

# 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()
protein.flexibility['G650'].setLibraryRotamers(
    osprey.WILD_TYPE).addWildTypeRotamers().setContinuous()
protein.flexibility['G651'].setLibraryRotamers(
    osprey.WILD_TYPE).addWildTypeRotamers().setContinuous()
protein.flexibility['G654'].setLibraryRotamers(
    osprey.WILD_TYPE).addWildTypeRotamers().setContinuous()

# define the ligand strand
ligand = osprey.Strand(mol, templateLib=templateLib, residues=['A155', 'A194'])
ligand.flexibility['A156'].setLibraryRotamers(
    osprey.WILD_TYPE).addWildTypeRotamers().setContinuous()
ligand.flexibility['A172'].setLibraryRotamers(
예제 #6
0
파일: runTest.py 프로젝트: yazhai/OSPREY3
                 [
                     'LEU', 'ILE', 'ALA', 'VAL', 'PHE', 'TYR', 'MET', 'GLU',
                     'ASP', 'HID', 'ASN', 'GLN', 'GLY'
                 ],
                 [
                     'GLU', 'ASP', 'PHE', 'TYR', 'ALA', 'VAL', 'ILE', 'LEU',
                     'HIE', 'HID', 'ASN', 'GLN', 'GLY'
                 ]]

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

# define the protein strand
ligand = osprey.Strand(mol,
                       templateLib=templateLib,
                       residues=[startResL, endResL])
for i in range(0, len(resNumsL)):
    ligand.flexibility[resNumsL[i]].setLibraryRotamers(
        *AATypeOptions[posL[i]]).addWildTypeRotamers().setContinuous()

# define the ligand strand
protein = osprey.Strand(mol,
                        templateLib=templateLib,
                        residues=[startResP, endResP])
for i in range(0, len(resNumsP)):
    protein.flexibility[resNumsP[i]].setLibraryRotamers(
        *AATypeOptions[posP[i]]).addWildTypeRotamers().setContinuous()

# make the conf space for the protein
confSpaceP = osprey.ConfSpace(protein)
예제 #7
0
osprey.start()

# let's go more faster
parallelism = osprey.Parallelism(cpuCores=2)

# if you have GPUs, designs can go much faster
#parallelism = osprey.Parallelism(cpuCores=2, gpus=1, streamsPerGpu=16)

# choose a forcefield
ffparams = osprey.ForcefieldParams()

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

# define the conformation space
strand = osprey.Strand(mol, residues=['G648', 'G654'])
for resNum in ['G649', 'G650', 'G651']:
	strand.flexibility[resNum]\
		.setLibraryRotamers(osprey.WILD_TYPE)\
		.addWildTypeRotamers()\
		.setContinuous()
confSpace = osprey.MultiStateConfSpace([
	# yeah, we didn't define any mutations,
	# but SOFEA still needs one "mutable" state to define the sequence space
	osprey.StateMutable('protein', osprey.ConfSpace(strand))
])

# we only care about the "wild-type" sequence in this case
seq = confSpace.seqSpace.makeWildTypeSequence()

# how should we compute energies of molecules?
예제 #8
0
# 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)

# how should molecule energies be calculated?
ecalc = osprey.EnergyCalculator(confSpace, ffparams, parallelism=parallelism)

# how could conformation energies be calculated?
confEcalc = osprey.ConfEnergyCalculator(confSpace, ecalc)
예제 #9
0
import osprey

# initializing osprey
osprey.start()

strand = osprey.Strand('2pt2FH.pdb')

# On strand we will define both the sequence and conformation space
# On every residue for which setLibraryRotamers is not called
# it will be modelled as fixed in space with its position found in the
# pdb file supplied.

# This is where Alanine scanning comes in.
# We can take the top K (tbd) most important residues and
# if they are close enough* to the ligand, i.e. we consider
# it to be on the surface of the protein, we can set it's possible
# mutations to negatively charged polar residues.

# negatively charged residues: ASP, GLUE
# polar uncharged: SER, THR, ASN, GLN, TYR, CYS

# Conversely, "deep" residues should only mutate to hydrophobic

# Fow now here are the residues in the "native pocket"
# For chain X residue number N, the residue is identified by 'XN'
#strand.flexibility['A54'].setLibraryRotamers(osprey.WILD_TYPE, 'ASP', 'GLU') # Wild type means the residue is free to be unchanged
# BUT will still have it's flexibility modelled
strand.flexibility['A145'].setLibraryRotamers(osprey.WILD_TYPE, 'ASP', 'GLU')

# Now the conf space is defined
confSpace = osprey.ConfSpace(strand)
예제 #10
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
    }
예제 #11
0
import osprey

osprey.start()

mol = osprey.readPdb('1CC8.ss.pdb')

# define a strand
strand1 = osprey.Strand(mol, residues=['A2', 'A20'])
strand1.flexibility['A2'].setLibraryRotamers(
    osprey.WILD_TYPE).addWildTypeRotamers()
strand1.flexibility['A3'].setLibraryRotamers(
    osprey.WILD_TYPE).addWildTypeRotamers()
strand1.flexibility['A4'].setLibraryRotamers(
    osprey.WILD_TYPE).addWildTypeRotamers()

# define another strand
strand2 = osprey.Strand(mol, residues=['A21', 'A40'])
strand2.flexibility['A21'].setLibraryRotamers(
    osprey.WILD_TYPE).addWildTypeRotamers()
strand2.flexibility['A22'].setLibraryRotamers(
    osprey.WILD_TYPE).addWildTypeRotamers()
strand2.flexibility['A23'].setLibraryRotamers(
    osprey.WILD_TYPE).addWildTypeRotamers()

# make the conf space
confSpace = osprey.ConfSpace([strand1, strand2])

# choose a forcefield
ffparams = osprey.ForcefieldParams()

# how to compute the energy of a conformation?
예제 #12
0
osprey.start()

# choose a forcefield
ffparams = osprey.ForcefieldParams()

# read a PDB file for molecular info
mol = osprey.readPdb('2hnv_prepped.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
ligandStrand = osprey.Strand(mol,
                             templateLib=templateLib,
                             residues=['A7', 'A87'])
ligandStrand.flexibility['A25'].setLibraryRotamers(
    osprey.WILD_TYPE, 'ASN', 'SER').setContinuous().addWildTypeRotamers()
ligandStrand.flexibility['A36'].setLibraryRotamers(
    osprey.WILD_TYPE).setContinuous().addWildTypeRotamers()

# define the ligand strand
proteinStrand = osprey.Strand(mol,
                              templateLib=templateLib,
                              residues=['B7', 'B87'])
proteinStrand.flexibility['B81'].setLibraryRotamers(
    osprey.WILD_TYPE).setContinuous().addWildTypeRotamers()
proteinStrand.flexibility['B72'].setLibraryRotamers(
    osprey.WILD_TYPE).setContinuous().addWildTypeRotamers()