Skip to content

paramx.py expects a rotabase.txt file that is not included with FoldX 5.0 #9

@kalestew

Description

@kalestew

How can I use paramx.py to properly parameterize an arbitrary ligand from a PDB structure?

I am trying to follow the included notebooks to parameterize a structure of interest but I am running into some issues with the newMol = parameterize( glcLines, atomMappingsDict) parameterize() function from paramx.py.

Just following the included example but it is clear that this method is expecting a rotabase.txt file from FoldX which is not present in 5.0 distributions. I have attempted using the rotabase.txt file and 4.0 binaries but this is not appropriate as the old rotabase.txt file is not json formatted as this package is expecting.

Maybe I am missing something but I have used FoldX 5.0/5.1 a fair amount and have never seen a rotabase.txt file used; there is the /molecules directory which contains the .json definition files for their prepared ligands but those do not contain the mappings for standard residue types.
Am I just missing the right rotabase.txt file from somewhere or is there a way to force FoldX5.0 to generate one?

Running: newMol = parameterize( glcLines, atomMappingsDict) from paramX_AtomTemplates.ipynb:

Mappings loaded:
Atom C1 mapped to atom ('CG', 'PRO')
Atom C2 mapped to atom ('CG', 'PRO')
Atom O1 mapped to atom ('OG', 'SER')
Atom O2 mapped to atom ('OG', 'SER')
Atom C3 mapped to atom ('CG', 'PRO')
Atom O3 mapped to atom ('OG', 'SER')
Atom C4 mapped to atom ('CG', 'PRO')
Atom O4 mapped to atom ('OG', 'SER')
Atom C5 mapped to atom ('CG', 'PRO')
Atom C6 mapped to atom ('CG', 'ARG')
Atom O5 mapped to atom ('O4*', 'A')
Atom O6 mapped to atom ('OG', 'SER')

---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
Cell In[11], line 1
----> 1 newMol = parameterize( glcLines, atomMappingsDict)

File ~/nuProtean/pyfoldx/pyfoldx-env/lib/python3.12/site-packages/pyfoldx/paramx/paramx.py:475, in parameterize(mol_string, mappings_dict)
    472 for atom in mappings_dict:
    473     for table in ["H_Pos", "solvenergy", "hbondinfo", "xyz_water"]:
    474         # Get the records of the table for the selected molecule and the target atom
--> 475         records = JSonParameterLoader.getRecordsInTable(table,mappings_dict[atom][1],mappings_dict[atom][0])
    477         for record in records:
    478             # Re-define the molecule name in the record
    479             record[JSonParameterLoader.getAAFieldName(table)] = JsonMol.threeLetterCode

File ~/nuProtean/pyfoldx/pyfoldx-env/lib/python3.12/site-packages/pyfoldx/paramx/paramx.py:183, in JSonParameterLoader.getRecordsInTable(table, molecule, atom)
    181 @staticmethod
    182 def getRecordsInTable(table,molecule, atom):
--> 183     loaded_dict = JSonParameterLoader.loadTable(TABLE_ALIAS[table])
    186     records = []
    187     for record in loaded_dict[TABLE_ALIAS[table]]:

File ~/nuProtean/pyfoldx/pyfoldx-env/lib/python3.12/site-packages/pyfoldx/paramx/paramx.py:139, in JSonParameterLoader.loadTable(table)
    136     if line == "JSonDataStart %s" % table or line == "JSonDataStart %s" % TABLE_ALIAS[table]:
    137         read = True
--> 139 loaded_dict = simplejson.loads("\n".join(json_lines))
    141 return loaded_dict

File ~/nuProtean/pyfoldx/pyfoldx-env/lib/python3.12/site-packages/simplejson/__init__.py:514, in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, use_decimal, allow_nan, **kw)
    462 """Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON
    463 document) to a Python object.
    464 
   (...)    508 
    509 """
    510 if (cls is None and encoding is None and object_hook is None and
    511         parse_int is None and parse_float is None and
    512         parse_constant is None and object_pairs_hook is None
    513         and not use_decimal and not allow_nan and not kw):
--> 514     return _default_decoder.decode(s)
    515 if cls is None:
    516     cls = JSONDecoder

File ~/nuProtean/pyfoldx/pyfoldx-env/lib/python3.12/site-packages/simplejson/decoder.py:386, in JSONDecoder.decode(self, s, _w, _PY3)
    384 if _PY3 and isinstance(s, bytes):
    385     s = str(s, self.encoding)
--> 386 obj, end = self.raw_decode(s)
    387 end = _w(s, end).end()
    388 if end != len(s):

File ~/nuProtean/pyfoldx/pyfoldx-env/lib/python3.12/site-packages/simplejson/decoder.py:416, in JSONDecoder.raw_decode(self, s, idx, _w, _PY3)
    414     elif ord0 == 0xef and s[idx:idx + 3] == '\xef\xbb\xbf':
    415         idx += 3
--> 416 return self.scan_once(s, idx=_w(s, idx).end())

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions