msmbuilder / msmbuilder-legacy

Legacy release of MSMBuilder
http://msmbuilder.org
GNU General Public License v2.0
25 stars 28 forks source link

ConvertDataToHDF.py error for mismatched atom numbers not too helpful #235

Closed sryckbos closed 10 years ago

sryckbos commented 10 years ago

I was trying to use ConvertDataToHDF.py and kept getting this error:

IndexError: index (988) out of range (0<=index<987) in dimension 1

It turns out my problem was that I was using a pdb with waters still in it (more than 988 atoms), but xtc files with waters stripped (988 atoms). Still, this doesn't seem like too noob-friendly an error message with what seams like an easy mistake to make.

rmcgibbo commented 10 years ago

Yeah, for sure. That is a somewhat "obvious" error mode (using files that don't mesh with one another) that we should definitely check for explicitly and give a nice error message with. Can you post the full traceback that the error came from, so I can flag the line number?

sryckbos commented 10 years ago

Sure, here you go!

Traceback (most recent call last): File "/home/sryckbos/epd-7.3-2-rh5-x86_64/bin/ConvertDataToHDF.py", line 216, in args.mingen, args.stride, rmsd_cutoff, args.parallel) File "/home/sryckbos/epd-7.3-2-rh5-x86_64/bin/ConvertDataToHDF.py", line 136, in run center_conformations, num_proc, input_style ) File "/home/sryckbos/epd-7.3-2-rh5-x86_64/lib/python2.7/site-packages/msmbuilder/FahProject.py", line 284, in write_all_trajectories map(self.write_trajectory_mapper, jobs) File "/home/sryckbos/epd-7.3-2-rh5-x86_64/lib/python2.7/site-packages/msmbuilder/FahProject.py", line 362, in write_trajectory_mapper min_gens, center_conformations, memory_check, omp_parallel_rmsd) File "/home/sryckbos/epd-7.3-2-rh5-x86_64/lib/python2.7/site-packages/msmbuilder/FahProject.py", line 465, in write_trajectory ptraj = rmsdmetric.prepare_trajectory(trajectory) File "/home/sryckbos/epd-7.3-2-rh5-x86_64/lib/python2.7/site-packages/msmbuilder/metrics.py", line 1056, in prepare_trajectory return self.TheoData(trajectory['XYZList'][:,self.atomindices]) IndexError: index (988) out of range (0<=index<987) in dimension 1

rmcgibbo commented 10 years ago

I think this is fixed in the master version? Do you know what version of msmbuilder you're using? On the master branch, I get this error when I use an incorrect pdb in ConvertDataToHDF.py

$ ConvertDataToHDF.py -i ~/local/msmbuilder/Tutorial/XTC -s ~/projects/met-enkephalin/1PLX-0-solvated.pdb
--------------------------------------------------------------------------------

MSMBuilder version 2.7.dev.dev-9b03650

See file AUTHORS for a list of MSMBuilder contributors.

--------------------------------------------------------------------------------

Copyright 2011 Stanford University.

MSMBuilder comes with ABSOLUTELY NO WARRANTY.

MSMBuilder is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

--------------------------------------------------------------------------------

Please cite the following references:

GR Bowman, X Huang, and VS Pande. Methods 2009. Using generalized ensemble 
simulations and Markov state models to identify conformational states.

KA Beauchamp, GR Bowman, TJ Lane, L Maibaum, IS Haque, VS Pande.  JCTC 2011.
MSMBuilder2: Modeling Conformational Dynamics
at the Picosecond to Millisecond Timescale

IS Haque, KA Beauchamp, VS Pande.  In preparation.
A Fast 3 x N Matrix Multiply Routine for Calculation of Protein RMSD.

--------------------------------------------------------------------------------
{'input_dir': '/home/rmcgibbo/local/msmbuilder/Tutorial/XTC',
 'min_length': 0,
 'pdb': '/home/rmcgibbo/projects/met-enkephalin/1PLX-0-solvated.pdb',
 'project': 'ProjectInfo.yaml',
 'quiet': False,
 'rmsd_cutoff': -1,
 'source': 'file',
 'stride': 1}
16:22:45 - WARNING: Sorting trajectory files by numerical values in their names.
16:22:45 - Ensure that numbering is as intended.
16:22:45 - Found 100 traj dirs
Traceback (most recent call last):
  File "/home/rmcgibbo/.pythonbrew/venvs/Python-2.7.3/sci/bin/ConvertDataToHDF.py", line 5, in <module>
    pkg_resources.run_script('msmbuilder==2.7.dev', 'ConvertDataToHDF.py')
  File "/home/rmcgibbo/.pythonbrew/venvs/Python-2.7.3/sci/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 489, in run_script
  File "/home/rmcgibbo/.pythonbrew/venvs/Python-2.7.3/sci/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 1207, in run_script
  File "/home/rmcgibbo/.pythonbrew/venvs/Python-2.7.3/sci/lib/python2.7/site-packages/msmbuilder-2.7.dev-py2.7-linux-x86_64.egg/EGG-INFO/scripts/ConvertDataToHDF.py", line 136, in <module>
    args.min_length, args.stride, rmsd_cutoff)
  File "/home/rmcgibbo/.pythonbrew/venvs/Python-2.7.3/sci/lib/python2.7/site-packages/msmbuilder-2.7.dev-py2.7-linux-x86_64.egg/EGG-INFO/scripts/ConvertDataToHDF.py", line 70, in run
    pb.get_project().save(projectfn)
  File "/home/rmcgibbo/.pythonbrew/venvs/Python-2.7.3/sci/lib/python2.7/site-packages/msmbuilder-2.7.dev-py2.7-linux-x86_64.egg/msmbuilder/project/builder.py", line 128, in get_project
    self.convert()
  File "/home/rmcgibbo/.pythonbrew/venvs/Python-2.7.3/sci/lib/python2.7/site-packages/msmbuilder-2.7.dev-py2.7-linux-x86_64.egg/msmbuilder/project/builder.py", line 159, in convert
    traj = self._load_traj(file_list)
  File "/home/rmcgibbo/.pythonbrew/venvs/Python-2.7.3/sci/lib/python2.7/site-packages/msmbuilder-2.7.dev-py2.7-linux-x86_64.egg/msmbuilder/project/builder.py", line 221, in _load_traj
    discard_overlapping_frames=True)
  File "/home/rmcgibbo/.pythonbrew/venvs/Python-2.7.3/sci/lib/python2.7/site-packages/msmbuilder-2.7.dev-py2.7-linux-x86_64.egg/msmbuilder/Trajectory.py", line 396, in load_from_xtc
    raise ValueError('The coordinate data contains %d atoms, but the topology contains %d atoms. Did you supply the wrong topology perhaps?' % (A["XYZList"].shape[1], A['AtomNames'].shape[0]))
ValueError: The coordinate data contains 22 atoms, but the topology contains 2571 atoms. Did you supply the wrong topology perhaps?
sryckbos commented 10 years ago

I actually was using an older version now that I look at it. Don't know how I ended up with that one rather than the newest one but you're right. My mistake!

rmcgibbo commented 10 years ago

No problem.