leandroradusky / pyfoldx

pyFoldX: python bindings for FoldX.
37 stars 4 forks source link

IndexError when mutating Structure object #7

Open florisvdf opened 1 year ago

florisvdf commented 1 year ago

Hi Leandro,

I'm trying to mutate a structure with the following code:

from pyfoldx.structure import Structure
pdb_3dkm = Structure("3DKM")
pdb_3dkm.mutate("RA1291L", number_of_runs=1)

But when I run this, I get:

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
Cell In[30], line 1
----> 1 pdb_3dkm.mutate("RA1291L", number_of_runs=5)

File ~/work/phd/projects/APBSMeshCNN/conda_env/lib/python3.8/site-packages/pyfoldx/structure/structure.py:349, in Structure.mutate(self, mutations, number_of_runs, terms, verbose)
    346 trajMut = Ensemble(self.code+"_Mut",working_path="")
    347 trajWT = Ensemble(self.code+"_WT",working_path="")
--> 349 ddGsDf, mutModels, wtModels = foldxHandler.getMutants(self, mutations, number_of_runs)
    351 # if generate mutated ensemble, add models to the ensemples
    352 for i in range(number_of_runs):

File ~/work/phd/projects/APBSMeshCNN/conda_env/lib/python3.8/site-packages/pyfoldx/foldx/foldxHandler.py:248, in getMutants(st, mutations, number_of_runs, other_parameters)
    246 for i in range(number_of_runs):
    247     mut_line_number = number_of_runs*(-2) + i
--> 248     dfData = raw_lines[mut_line_number].split("\t")[1:]
    249     mutPdbs[i].totalEnergy = pd.DataFrame(data = [dfData], columns= ENERGY_TERMS, index=[mutPdbs[i].code])
    251     wt_line_number = -number_of_runs + i

IndexError: list index out of range

I wondered if this had anything to do with pyfoldx not ocating the foldx binary, so I checked this with:

from pyfoldx.foldx.foldxHandler import FOLDX_LOCATION

Which is set to the correct path. Any clue what could be causing this?

Cheers, Floris

allmanbrent commented 9 months ago

I faced a similar issue.