wiki:ChimeraProgrammingResources

Resources

Chimera Molecular Data

# a list of open models
models = chimera.openModels.list()

# restrict list to Molecules
molecules = chimera.openModels.list(modelTypes=[chimera.Molecule])

# a Molecule's residues, atoms, or bonds
if len(molecules):
  r = molecules[0].residues
  a = molecules[0].atoms
  b = molecules[0].bonds

Residues

  • type: LYS, HEM, etc.
  • id.position / id.chainId / id.insertionCode: number / chain ID / insertion code
  • molecule: parent Molecule
  • atoms: list of atoms
  • atomsMap: dict of {atom-name: [list of atoms]}
  • isHelix / isStrand: in helix / strand

Atoms

  • name: name
  • coord() / xformCoord(): untransformed / transformed coordinates
  • residue / molecule: parent Residue / Molecule
  • bonds: list of bonds
  • neighbors: list of bonded atoms
  • primaryBonds() / primaryNeighbors(): same as above but only primary altlocs
  • bondsMap: dict of {bonded-atom: bond}
  • color: Color
  • display: True if shown
  • drawMode: one of chimera.Atom.X with X being Dot, Sphere, EndCap, or Ball
  • element: chemical element (type chimera.Element, settable with string or number)
  • label: label shown in graphics window
  • radius: VdW radius

Bonds

  • atoms: 2-tuple of atoms
  • otherAtom(a): [a is one of the bond's atoms] other atom in bond
  • drawMode: one of chimera.Bond.X with X being Wire or Stick
  • label: label shown in graphics window
  • molecule: parent Molecule
  • length(): length

Molecular Measurements

chimera module functions use Points, which are returned by Atom's coord() or xformCoord() methods

  • distance / sqdistance
  • also: a1.coord().[sq]distance(a2.coord()) [similar for xformCoord]
  • angle (in degrees)
  • dihedral (in degrees)

Molecular Editing

Look in $CHIMERA/share/BuildStructure/__init__.py for examples of creating new molecules and residues.

Using the chimera.molEdit module:

  • addAtom
    • if adding in bulk, make sure to specify optional serialNumber keyword
  • addBond
  • addDihedralAtom -- add atom given a bond length / angle / dihedral

Setting or Querying Selections

Using the chimera.selection module:

  • currentAtoms / currentBonds / currentResidues / currentMolecules: currently selected Atoms / Bonds / Residues / Molecules
  • setCurrent: set current selection to given items
  • addCurrent / addImpliedCurrent: add given items to current selection
  • the "implied" version also selects endpoint Atoms of added Bonds and connecting Bonds of added Atoms
  • removeCurrent: remove items from current selection, if present

Miscellaneous

  • chimera.runCommand: execute any command-line command (arg is a string)
    • direct Python equivalent usually in Midas module
  • chimera.colorTable module:
    • getColorByName: get a Color by name
  • OpenSave module:
    • osOpen: open a file or HTTP URL, with or without compression
  • chimera.extension module
    • manager.instances: running dialogs listed at end of Tools menu
Last modified 15 years ago Last modified on Dec 21, 2010, 2:20:50 PM
Note: See TracWiki for help on using the wiki.