UCL-CCS / TIES

Topology Superimposition based on joint graph traversal
MIT License
5 stars 1 forks source link

MD Analysis mol2 files #297

Closed adw62 closed 2 years ago

adw62 commented 2 years ago

Now we use Parmed instead of MDAnalysis TIES20 can no longer accept mol2 files generated by MDanalysis. Parmed does not like the files for some reason and here are some example ligands that cause the problem: example.zip

The exact error looks like:


Working Directory: /home/cdt1605/New_projects/FLU/e_fxa/l_H19
MD Engine: openmm
Ligand net charge (-nc): 1
Trying to open the ligand ligand.mol2 with ParmEd..
Trying to open the ligand l_H19.mol2 with ParmEd..

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-8-3fd3a6158af9> in <module>
      6     config.workdir = flu_analogue
      7     config.md_engine = 'openmm'
----> 8     pair = Pair('ligand.mol2', flu_analogue+'.mol2', ligand_net_charge=1, config=config)
      9     pair.make_atom_names_unique()
     10 

~/miniconda3/envs/TIES_loc/lib/python3.7/site-packages/ties/pair.py in __init__(self, ligA, ligZ, config, **kwargs)
     57             self.ligZ = ligZ
     58         else:
---> 59             self.ligZ = ties.ligand.Ligand(ligZ, self.config)
     60 
     61         # initialise the handles to the molecules that morph

~/miniconda3/envs/TIES_loc/lib/python3.7/site-packages/ties/ligand.py in __init__(self, ligand, config, save)
     35         # save workplace root
     36         self.config = Config() if config is None else config
---> 37         self.config.ligand_files = ligand
     38 
     39         self.original_input = Path(ligand).absolute()

~/miniconda3/envs/TIES_loc/lib/python3.7/site-packages/ties/config.py in ligand_files(self, files)
    178             else:
    179                 print(f'Trying to open the ligand {ligand} with ParmEd..')
--> 180                 lig = parmed.load_file(str(ligand), structure=True)
    181                 # there should be one residue
    182                 if len({a.residue.name for a in lig.atoms}) > 1:

~/miniconda3/envs/TIES_loc/lib/python3.7/site-packages/parmed/formats/registry.py in load_file(filename, *args, **kwargs)
    195         _prune_argument(cls.parse, kwargs, 'hasbox')
    196         _prune_argument(cls.parse, kwargs, 'skip_bonds')
--> 197         return cls.parse(filename, *args, **kwargs)
    198     elif hasattr(cls, 'open_old'):
    199         _prune_argument(cls.open_old, kwargs, 'structure')

~/miniconda3/envs/TIES_loc/lib/python3.7/site-packages/parmed/formats/mol2.py in parse(filename, structure)
    153                     #   status_bit -- ignored
    154                     words = line.split()
--> 155                     id = int(words[0])
    156                     name = words[1]
    157                     x = float(words[2])

IndexError: list index out of range
adw62 commented 2 years ago

ParmEd ssems to load ligand.mol2 (made by Schrodinger maestro) fine but does not like l_H19.mol2 (made by MDAnalysis). MDanalysis looks to have changed the spacing of columns? why is it doing that is it in the standard !?

bieniekmateusz commented 2 years ago

Heya, I believe this issue is the strange thing with the "spacing". MDAnalysis while saving a file adds a new empty line between atoms and bonds or something, and that line breaks later other softwares such as parmed and antechamber.

bieniekmateusz commented 2 years ago

Here is the corrected file that works with parmed l.mol2.txt

However, ideally this problem would completley disappear once we stop using mdanalysis for writing mol2 files. As it is MDAnalysis that introduces these spaces (which I should bring to their attention at some point).

adw62 commented 2 years ago

Okay if its MDAnalysis causing the problem then no need to worry. This would still be an issue if someone wanted to prep inputs with MDAnalysis but if they are going outside the mol2 spec then the best we can do is raise it with their team as you suggest.

adw62 commented 2 years ago

raised here: https://github.com/MDAnalysis/mdanalysis/issues/3747