| 1 | # Create session
|
|---|
| 2 | from chimerax.core.session import Session
|
|---|
| 3 | session = Session('cx standalone', offscreen_rendering = True)
|
|---|
| 4 |
|
|---|
| 5 | # Setup residue template path.
|
|---|
| 6 | from chimerax.atomic import initialize_atomic
|
|---|
| 7 | initialize_atomic(session)
|
|---|
| 8 |
|
|---|
| 9 | # Open PDB file
|
|---|
| 10 | from chimerax.pdb import open_pdb
|
|---|
| 11 | from os.path import expanduser
|
|---|
| 12 | models, msg = open_pdb(session, expanduser('~/Downloads/ChimeraX/PDB/1a0s.pdb'))
|
|---|
| 13 | session.models.add(models)
|
|---|
| 14 |
|
|---|
| 15 | s = models[0]
|
|---|
| 16 | print('%s has %d atoms, %d bonds, %d residues, centroid %s, average atom radius %.2f'
|
|---|
| 17 | % (s.name, s.num_atoms, s.num_bonds, s.num_residues,
|
|---|
| 18 | tuple(s.atoms.coords.mean(axis=0)), s.atoms.radii.mean()))
|
|---|
| 19 |
|
|---|
| 20 | # Save an image
|
|---|
| 21 | from chimerax.image_formats import save_image
|
|---|
| 22 | save_image(session, 'test.png')
|
|---|