Skip to content

Instantly share code, notes, and snippets.

@alisterburt
Created July 17, 2022 19:14
Show Gist options
  • Select an option

  • Save alisterburt/bfed02f356aa3df2fcd6089f7d668434 to your computer and use it in GitHub Desktop.

Select an option

Save alisterburt/bfed02f356aa3df2fcd6089f7d668434 to your computer and use it in GitHub Desktop.
Read PDB/mmCIF coords using gemmi
import gemmi
import numpy as np
pdb = '4v6x-ribo.cif'
structure = gemmi.read_structure(pdb)
model = structure[0] # assumes one model in the file
ca_coords = np.array([
[cra.atom.pos.x, cra.atom.pos.y, cra.atom.pos.z]
for cra in model.all()
if cra.atom.name =='CA'
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment