-
Notifications
You must be signed in to change notification settings - Fork 167
added trajectory wrap method #1344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
be6141c
to
e255fd2
Compare
e9aad40
to
26eee69
Compare
This should probably have more testing |
@jamesmkrieger, I have a dcd file with wrapping and am trying to run the following code with it:
The
Am I doing something wrong? |
I don’t really remember these functions so I don’t know. Did you actually set a unit cell or anything like that? |
The frames do have a unitcell:
|
I wonder where we are ending up with a numpy array. Maybe DCDFile isn’t the right object? |
I'll look into this a bit more. |
Thanks |
@AnthonyBogetti did you have a chance to look at this further? Otherwise, can you send me a minimal trajectory please? You could sample it every 20 frames, so I have 5 frames to play with. |
Hi @jamesmkrieger, can you merge all recent changes from main into this branch? I will try to get this resolved this week. |
Here is a trajectory with some wrapped ions: |
I just pulled and it merged cleanly. Hopefully all the checks pass now |
great. Would you like me to test something or is it good to go? |
I can take a look at this later today if you want, James. I have many simulations which requires wrapping. |
That would be great. Thank you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked at this and I am unable to wrap my trajectory (see below). I don't know how to provide data with unitcell to wrap all frames at once.
Usually to wrap trajectory programs require xst file with size of the box. Here, we need to provide numpy.ndarray
. I tried with collecting the size of the box for each frame and providing them like this dcd.wrap(unitcell=unitCell_data), but that won't work either. Any suggestions?
In [1]: from prody import *
In [2]: dcd = DCDFile('tests_wrap.dcd')
In [3]: dcd.hasUnitcell
Out[3]: <bound method DCDFile.hasUnitcell of <DCDFile: tests_wrap (next 0 of 51 frames; 71107 atoms)>>
In [4]: dcd.wrap()
AttributeError Traceback (most recent call last)
File ~/anaconda3/envs/prody_tests/lib/python3.10/site-packages/ProDy-2.5.0-py3.10-linux-x86_64.egg/prody/measure/transform.py:530, in wrapAtoms(frame, unitcell, center)
529 try:
--> 530 unitcell = frame.getUnitcell()[:3]
531 except AttributeError:
AttributeError: 'numpy.ndarray' object has no attribute 'getUnitcell'
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
Cell In[4], line 1
----> 1 dcd.wrap()
File ~/anaconda3/envs/prody_tests/lib/python3.10/site-packages/ProDy-2.5.0-py3.10-linux-x86_64.egg/prody/trajectory/trajbase.py:397, in TrajBase.wrap(self, unitcell, center)
395 LOGGER.progress('Wrapping trajectory ...', len(coordsets))
396 for i, coordset in enumerate(coordsets):
--> 397 wrapped.addCoordset(wrapAtoms(coordset), unitcell=unitcell, center=center)
398 LOGGER.update(i)
400 LOGGER.finish()
File ~/anaconda3/envs/prody_tests/lib/python3.10/site-packages/ProDy-2.5.0-py3.10-linux-x86_64.egg/prody/measure/transform.py:532, in wrapAtoms(frame, unitcell, center)
530 unitcell = frame.getUnitcell()[:3]
531 except AttributeError:
--> 532 raise TypeError('unitcell information must be provided')
534 half = unitcell / 2
535 ucmin = center - half
TypeError: unitcell information must be provided
ok, it looks like you have a similar problem to Anthony so probably there's something that needs fixing here |
ok, I had a bracket in the wrong place. Now it should work:
|
The trajectory I uploaded was actually not generated by me (I forget who it came from) but I noticed the wrapping of the ions and thought it would be a good example. To test, calculating the inter-ionic distance and not seeing any jumps would indicate success I think. |
Hi @jamesmkrieger, I tested it on my trajectory. It does work (wraps) but I see what you are saying it's hard to know if it is working correctly bc the trajectory I provided is not very simple. |
Maybe you can use an RMSD? |
From visualization it seems to be working. |
I don't think a system with 2 ions is a very good one to look at. It's not easy to tell what we're seeing at all. |
I am testing on my system. I will let you know how it goes. In the system I have two protein, ligand and oxygen molecules. Ligand and oxygens should be wrapped. |
I am wondering..how long should it take? I have ~50 frames, 42 MB file and I am waiting and waiting (already >10 mins). Also, usually I am using parseDCD instead of DCDFile, so maybe I am doing something wrong, but shouldn't this work differently: I wanted to select less number of frames, but I cannot see the difference. |
That's not good. I don't know how long it should take but that's surprising. Have you got lots of atoms? |
oh, 71k doesn't seem like so many |
Hi @karolamik13, were you able to confirm that this functionality works as expected? Is it just slow? @jamesmkrieger do you think we should merge this in for 2.6.0 and improve it later on or should we wait for a future release? I think this may be the last open PR (other than some of the WatFinder improvements and new tools) for the 2.6.0 release. |
Hi @AnthonyBogetti, I cannot confirm it right now. I have a problem with my Linux machine, where I was testing everything. I will be able to fix it no earlier than Thursday. |
Previously there was only a function to wrapAtoms for individual frames. This extends that to the whole trajectory.