Commit 818da844 authored by Berk Onat's avatar Berk Onat

Fixed several bugs related to topology info in MDDataAccess

parent f17b07a1
......@@ -1062,7 +1062,7 @@ class MDDataAccess(object):
if self.topohandler is None:
if self.topofile:
self.check_topology_format_support("traj")
self.check_topology_format_support()
if self.trajhandler is None:
self.check_trajectory_format_support("traj")
......@@ -1288,9 +1288,8 @@ class MDDataAccess(object):
filetrajformat = re.sub('[.]', '', chkformat)
trajhandler_check = None
if self.topohandler is not None:
numatoms = self.get_natoms_from_topo(topocode="pymolfile")
if(isinstance(self.topohandler, pym.OpenMolfile)
or isinstance(self.topohandler, pym.OpenMolfile.topology)):
numatoms = self.get_natoms_from_topo(topocode=self.topocode)
if isinstance(self.topohandler, pym.OpenMolfile):
molfile_traj = pym.OpenMolfile(chkfile, file_format=filetrajformat, topology=self.topohandler, silent=False)
elif numatoms is not None:
if numatoms > 0:
......@@ -1409,7 +1408,7 @@ class MDDataAccess(object):
self.natoms = numatoms
usedefault=False
break
except (AttributeError, IOError, OSError, ValueError, TypeError):
except (AttributeError, IOError, OSError, ValueError, TypeError, KeyError):
try:
universe = mda_u.Universe(self.topohandler, self.trajfile, format=mdanalysis_format)
trajhandler = None
......@@ -1447,8 +1446,8 @@ class MDDataAccess(object):
self.natoms = numatoms
usedefault=False
break
#except (AttributeError, IOError, OSError, ValueError, TypeError):
except IOError:
except (IOError, ValueError, TypeError, KeyError):
#except IOError:
pass
# if topology handler is not a MDAnalysis Universe
# or is not initialized, we can try accessing only
......@@ -2799,11 +2798,21 @@ class MDDataAccess(object):
if __name__ == "__main__":
topo_file = sys.argv[1]
traj_file = sys.argv[2]
topo_format = sys.argv[2]
traj_file = sys.argv[3]
traj_format = sys.argv[4]
MDdata = MDDataAccess()
MDdata.trajfile = traj_file
MDdata.topofile = topo_file
#MDdata.interfaceorder = ["mdanalysis", "pymolfile", "mdtraj", "ase"]
if 'None' in topo_format:
pass
else:
MDdata.topoformat = topo_format
if 'None' in traj_format:
pass
else:
MDdata.trajformat = traj_format
MDdata.interfaceorder = ["mdanalysis", "pymolfile", "mdtraj", "ase"]
#MDdata.interfaceorder = ["pymolfile", "mdanalysis", "mdtraj", "ase"]
MDdata.interfacematch = False
traj_iterator = MDdata.load()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment