示例#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()

# 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()
示例#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
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
    }