Skip to content
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

Error with save #42

Open
emarsh25 opened this issue Dec 30, 2022 · 1 comment
Open

Error with save #42

emarsh25 opened this issue Dec 30, 2022 · 1 comment

Comments

@emarsh25
Copy link

I am attempting to save a model I created from a set of atoms I got using the .atoms_in_sphere() function. This is the code and the traceback I am getting.

pdb = atomium.open(pdb_path)
pdb.model.optimise_distances()

pocket_atoms = pdb.model.atoms_in_sphere((25.55,13.88,-29.54), 8)

pocket = atomium.structures.Residue(*pocket_atoms, id='A', name='A')
x = set()
x.add(pocket)

new_chain = atomium.Chain(id='A', *x)
new_model = atomium.Model(new_chain)
new_model.save("test.pdb")

Traceback (most recent call last):
File "/home/ray/Pocket-Prediction/src/describe_pocket.py", line 182, in
describe_pockets('./data/4bcf.pdb')
File "/home/ray/Pocket-Prediction/src/describe_pocket.py", line 178, in describe_pockets
get_pocket_atoms(pdb_path)
File "/home/ray/Pocket-Prediction/src/describe_pocket.py", line 129, in get_pocket_atoms
new_model.save("pocket_ctsb_test.pdb")
File "/home/ray/anaconda3/lib/python3.8/site-packages/atomium/structures.py", line 231, in save
string = structure_to_pdb_string(self)
File "/home/ray/anaconda3/lib/python3.8/site-packages/atomium/pdb.py", line 565, in structure_to_pdb_string
atom_to_atom_line(atom, lines)
File "/home/ray/anaconda3/lib/python3.8/site-packages/atomium/pdb.py", line 606, in atom_to_atom_line
residue_id = int("".join([c for c in id_ if c.isdigit() or c == "-"]))
ValueError: invalid literal for int() with base 10: ''

@samirelanduk
Copy link
Owner

It's expecting the residue ID to have at least some numeric component, but it's just 'A' here. If you change the line to:

pocket = atomium.structures.Residue(*pocket_atoms, id='1', name='A')

...instead it should work.

atomium 2.0 will be out soon, which won't have this requirement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants