donaldlab / OSPREY3

Open Source Protein REdesign for You v3
GNU General Public License v2.0
47 stars 15 forks source link

TypeError: No matching overloads found for *static* edu.duke.cs.osprey.structure.PDBIO.readFile(edu.duke.cs.osprey.confspace.Strand) #179

Closed elvismartis closed 2 years ago

elvismartis commented 2 years ago

Hello

I need some help understanding this error.

WARNING: Using incubator modules: jdk.incubator.foreign OSPREY 3.2.304, Python 3.9.7, Java 17.0.1, Linux-5.13.0-30-generic-x86_64-with-glibc2.31 Using up to 1024 MiB heap memory: 128 MiB for garbage, 896 MiB for storage read PDB file from file: ./prot-MAD.pdb Traceback (most recent call last): File "/home/martis/work/PNP_UMN/2dMetADO/LUTE.train.py", line 11, in exec(open("LUTE.confSpaces.py").read()) File "", line 19, in File "/home/martis/.local/lib/python3.9/site-packages/osprey/init.py", line 471, in Strand mol = readPdb(pathOrMol) File "/home/martis/.local/lib/python3.9/site-packages/osprey/init.py", line 286, in readPdb mol = c.structure.PDBIO.readFile(path) TypeError: No matching overloads found for static edu.duke.cs.osprey.structure.PDBIO.readFile(edu.duke.cs.osprey.confspace.Strand), options are: public static edu.duke.cs.osprey.structure.Molecule edu.duke.cs.osprey.structure.PDBIO.readFile(java.lang.String) public static edu.duke.cs.osprey.structure.Molecule edu.duke.cs.osprey.structure.PDBIO.readFile(java.io.File)

Additional information: The code I am trying to run is as follows

LUTE.train.py

import osprey

osprey.start()

let's go fast

parallelism = osprey.Parallelism(gpus=1)

import our conf spaces from another file

exec(open("LUTE.confSpaces.py").read())

train each conf space separately

for (id, confSpace) in confSpaces.items():

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

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

# calculate the energy matrix so we can do DEE
emat = osprey.EnergyMatrix(
    confEcalc,
    # save it to disk so we don't have to calculate it again later
    cacheFile='LUTE.emat.%s.dat' % id
)

# Good LUTE fits rely heavily on DEE pruning, so use the best available DEE options here.
# With interval pruning, we prune only conformations whose energies are more than X higher
# than the lower bound of the conformation with the minimum lower bound.
# If we sort the whole conformation space by lower bounds, interval pruning is like keeping
# only conformations in the bottom X kcal/mol slice of the sorted list.
pruningInterval = 20.0 # kcal/mol
pmat = osprey.DEE(
    confSpace,
    emat,
    singlesGoldsteinDiffThreshold=pruningInterval,
    pairsGoldsteinDiffThreshold=pruningInterval,
    triplesGoldsteinDiffThreshold=pruningInterval, # pruning triples is much slower, but important for good fits
    parallelism=parallelism,
    showProgress=True,
    # save it to disk so we don't have to calculate it again later
    cacheFile='LUTE.pmat.%s.dat' % id
)

# train a LUTE model
print('\nTraining %s model...\n' % id)
model = osprey.LUTE_train(
    confEcalc,
    emat,
    pmat,

    # what's the highest RMS error you're willing tolerate for the model fitting?
    maxRMSE = 0.1, # kcal/mol

    # how much overfitting are you willing to tolerate?
    # (overfitting score = training set RMSE / test set RMSE)
    maxOverfittingScore = 1.5, # unitless ratio

    # LUTE uses a conformation database to speed up training.
    # You can save this database to disk by choosing a filename, or don't set this argument to not save the db.
    # If you save it, the datebase can be used to speed up the next training job too, as well as this one.
    # But if you change the conformation space at all, you'll need to delete the db file before training again.
    confDBPath = 'LUTE.conf.%s.db' % id
)

# save the model to a file
osprey.LUTE_write(model, 'LUTE.%s.dat' % id)

While LUTE training runs, a bunch of info will be printed to the console

including progress info, and fit quality scores.

When the training is finished, look at the quality of the fit

and decide if you want to run the design using that LUTE model.

if no, tweak the training parameters and run the training script again

if yes, continue to the LUTE.{algo}.py script, where {algo} is a design algorithm like kstar, or bbkstar

LUTE.confSpaces.py

choose a forcefield

ffparams = osprey.ForcefieldParams()

output from OSPREYPrep.

templateLibrary = osprey.TemplateLibrary( extraTemplates=['./extraTemplates.in'], extraTemplateCoords=['./extraTemplateCoords.in'], extraRotamers=['./genericRotamers.dat'] )

read a PDB file for molecular info

MOL = osprey.Strand('./prot-MAD.pdb', templateLib=templateLibrary)

make sure all strands share the same template library

templateLib = osprey.TemplateLibrary(ffparams.forcefld)

define the protein strand

protein = osprey.Strand(MOL, residues=['A90', 'A158', 'A202', 'A201', 'A179', 'A86', 'A89', 'A178', 'A176', 'A204']) protein.flexibility['A90'].setLibraryRotamers(osprey.WILD_TYPE).setContinuous() protein.flexibility['A158'].setLibraryRotamers(osprey.WILD_TYPE).setContinuous() protein.flexibility['A202'].setLibraryRotamers(osprey.WILD_TYPE).setContinuous() protein.flexibility['A235'].setLibraryRotamers(osprey.WILD_TYPE).setContinuous() protein.flexibility['A201'].setLibraryRotamers(osprey.WILD_TYPE).setContinuous() protein.flexibility['A179'].setLibraryRotamers(osprey.WILD_TYPE).setContinuous() protein.flexibility['A86'].setLibraryRotamers(osprey.WILD_TYPE).setContinuous() protein.flexibility['A89'].setLibraryRotamers(osprey.WILD_TYPE).setContinuous() protein.flexibility['A178'].setLibraryRotamers(osprey.WILD_TYPE).setContinuous() protein.flexibility['A176'].setLibraryRotamers(osprey.WILD_TYPE).setContinuous() protein.flexibility['A204'].setLibraryRotamers(osprey.WILD_TYPE).setContinuous()

define the ligand strand

ligand = osprey.Strand(MOL, residues=['B1']) ligand.flexibility['B1'].setLibraryRotamers(osprey.WILD_TYPE).setContinuous()

ligand.flexibility['A192'].setLibraryRotamers(osprey.WILD_TYPE).addWildTypeRotamers().setContinuous()

ligand.flexibility['A193'].setLibraryRotamers(osprey.WILD_TYPE).addWildTypeRotamers().setContinuous()

make the conf spaces

confSpaces = { 'protein': osprey.ConfSpace(protein), 'ligand': osprey.ConfSpace(ligand), 'complex': osprey.ConfSpace([protein, ligand]) }

elvismartis commented 2 years ago

Nevermind solved it