-
Notifications
You must be signed in to change notification settings - Fork 767
Closed
Labels
Component-WritersFormat-MOL2interoperabilityimportant for making MDAnalysis work with other packages and toolsimportant for making MDAnalysis work with other packages and toolswontfix
Description
Is your feature request related to a problem?
Hello, I'd like to be able to use the mol2 files output by MDAnalysis with programs such as ParmED. Currently I can't and I believe the issue is caused by blank lines in the output mol2 files for example I generate the files using this code:
import MDAnalysis as mda
import parmed
#Use MD analysis to create all input for fluorinated analogues
un_flu = mda.Universe("ligand.mol2")
hydrogen = un_flu.select_atoms("name H19")[0]
flu = mda.Universe("ligand.mol2")
for atom in flu.atoms:
if atom.name == hydrogen.name:
atom.type = 'F'
atom.name = 'F1'
sel = flu.select_atoms("all")
sel.write("l_{}.mol2".format(hydrogen.name))
lig = parmed.load_file("l_{}.mol2".format(hydrogen.name), structure=True)which results in:
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-13-931952670e8c> in <module>
13 sel.write("l_{}.mol2".format(hydrogen.name))
14
---> 15 lig = parmed.load_file("l_{}.mol2".format(hydrogen.name), structure=True)
~/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 rangeHere are the input ligand.mol2 that I use and the output l_H19.mol2 that parmed does not like
ligands.zip
If I remove the blank lines between the @ATOM, @BOND and @SUBSTRUCTURE blocks the file is accepted.
Describe the solution you'd like
Ideally I would like to be able to use the mol2 files in parmed. Or if the blank lines are normal and this is problem with parmed please tell me this is also useful information to me.
Thanks,
Alex
Metadata
Metadata
Assignees
Labels
Component-WritersFormat-MOL2interoperabilityimportant for making MDAnalysis work with other packages and toolsimportant for making MDAnalysis work with other packages and toolswontfix