Closed andresilvapimentel closed 3 years ago
Hi, this is because your input to load
is already an MDTraj trajectory. Can you try giving it the filename(s) instead?
Thank you I did not understand what you mean. Could you explain in a different way, please?
How exactly does your call look like? You might want to try using it like this:
pyemma.coordinates.load(['file1.xtc', 'file2.xtc'], featurizer=torsions_feat)
I also tried like this: trajs = ['traj01.xtc', 'traj02.xtc'] files = load(trajs, top='my_structure.pdb')
But it did not work out... Any other suggestion?
Can you post the stack trace (full error message) of
trajs = ['traj01.xtc', 'traj02.xtc']
files = load(trajs, top='my_structure.pdb')
? this should work.
ValueError Traceback (most recent call last)
What is the output if you print(files)
before the call to load
?
['spa_no_ca_back_none.pdb'] [array([[5.032 , 5.6740003, 2.4680002, ..., 5.4080005, 4.2640004, 4.8320003], [4.9820004, 5.5360003, 2.3100002, ..., 5.51 , 4.2200003, 4.86 ], [5.322 , 5.6520004, 2.41 , ..., 5.6340003, 4.124 , 4.9620004], ..., [9.51 , 1.95 , 5.458 , ..., 6.596 , 3.6940002, 5.51 ], [9.412001 , 1.8780001, 6.044 , ..., 6.7860003, 3.6640003, 5.55 ], [9.616 , 1.8340001, 6.5160003, ..., 6.8960004, 3.3400002, 5.6580005]], dtype=float32), array([[5.032 , 5.6740003, 2.4680002, ..., 5.4080005, 4.2640004, 4.8320003], [4.9820004, 5.5360003, 2.3100002, ..., 5.51 , 4.2200003, 4.86 ], [5.322 , 5.6520004, 2.41 , ..., 5.6340003, 4.124 , 4.9620004], ..., [9.51 , 1.95 , 5.458 , ..., 6.596 , 3.6940002, 5.51 ], [9.412001 , 1.8780001, 6.044 , ..., 6.7860003, 3.6640003, 5.55 ], [9.616 , 1.8340001, 6.5160003, ..., 6.8960004, 3.3400002, 5.6580005]], dtype=float32)]
So it seems that files
are not quite the files you want to load but rather the pdb and a bunch of arrays, right? Do you know how to proceed from here? Otherwise, please let me know how you create the files
object.
Thanks. This is what I was thinking since the begining... I do not know how to proceed from here to create the right files object. Could you helpe me, please?
Well somewhere on your machine you'll have XTC files, just create a Python list of them and put it into the load function like so:
import pyemma
my_files = ['path/to/file1.xtc', 'path/to/file2.xtc'] # you can use more (or fewer) than two files of course
featurizer = pyemma.coordinates.featurizer('spa_no_ca_back_none.pdb')
torsions_feat.add_backbone_torsions(cossin=True, periodic=False)
data = pyemma.coordinates.load(my_files, featurizer=featurizer)
This is really all you need to do, afterwards data
contains the loaded and featurized trajectories which you can use for further analysis.
I am uploading the pdb and xtc files into the notebook using: from google.colab import files uploaded = files.upload()
I loaded the data input as you suggested: pdb = ['path/to/spa_no_ca_back_none.pdb'] files = ['path/to/spa_back_none.xtc']
I printed the files: print(pdb) print(files) and I got: ['path/to/spa_no_ca_back_none.pdb'] ['path/to/spa_back_none.xtc']
Then, I featurized as you suggested: featurizer = pyemma.coordinates.featurizer('spa_no_ca_back_none.pdb') data = pyemma.coordinates.load(files, featurizer=featurizer)
and got the error message: TypeError Traceback (most recent call last)
import pyemma
from google.colab import files
uploaded = files.upload()
print("Uploaded files:", list(uploaded.keys()))
files = ["spa_back_none.xtc"]
featurizer = pyemma.coordinates.featurizer('spa_no_ca_back_none.pdb')
featurizer.add_backbone_torsions(cossin=True, periodic=False)
torsions_data = pyemma.coordinates.load(files, features=featurizer)
This should do the trick :) If it doesn't, please paste the error message(s) here.
I did exactly what you suggested and I got the following error message: ValueError Traceback (most recent call last)
Hi, you still got path/to/spa_back_none_1.xtc
instead of just spa_back_none_1.xtc
, could you change that?
Yes. It worked it out. However, I needed to change the foolowing command:
torsions_feat = pyemma.coordinates.featurizer(pdb) to torsions_feat = pyemma.coordinates.featurizer('spa_no_ca_back_none.pdb')
positions_feat = pyemma.coordinates.featurizer(pdb) to positions_feat = pyemma.coordinates.featurizer('spa_no_ca_back_none.pdb')
distances_feat = pyemma.coordinates.featurizer(pdb) to distances_feat = pyemma.coordinates.featurizer('spa_no_ca_back_none.pdb')
Thanks!!! I will follow the tutorial now... but it seems it is going to work everything else.
Great! :slightly_smiling_face: Closing this issue then, please open a new one if something doesn't work.
Hi all, I am trying to load a xtc file using the mdtraj.load And, the coordinates and features are being loaded using the pyemma.coordinates.load(files, features=feat) or pyemma.coordinates.load(files, features=torsions_feat). The pdb file has unit cells, but I removed unitcells later. However, the trajectory file also has unit cells, but I was unable to remove the unitcells. I think this is the issue about giving an error message below. Do you know how to fix this issue?
The error message is: ValueError Traceback (most recent call last)