Supporting Functions

This module defines some functions for handling atomic classes and data.

iterFragments(atoms)[source]

Yield fragments, connected subsets in atoms, as Selection instances.

findFragments(atoms)[source]

Returns list of fragments, connected subsets in atoms. See also iterFragments().

loadAtoms(filename)[source]

Returns AtomGroup instance loaded from filename using numpy.load() function. See also saveAtoms().

saveAtoms(atoms, filename=None, **kwargs)[source]

Save atoms in ProDy internal format. All Atomic classes are accepted as atoms argument. This function saves user set atomic data as well. Note that title of the AtomGroup instance is used as the filename when atoms is not an AtomGroup. To avoid overwriting an existing file with the same name, specify a filename.

isReserved(word)[source]

Returns True if word is reserved for internal data labeling or atom selections. See listReservedWords() for a list of reserved words.

listReservedWords()[source]

Returns list of words that are reserved for atom selections and internal variables. These words are: abs, acidic, acos, acyclic, aliphatic, all, altloc, aminoacid, and, anisou, aromatic, as, asin, at, atan, backbone, backbonefull, basic, bb, bbfull, bend, beta, bmap, bonded, bonds, bridge, buried, ca, calpha, carbon, ceil, cg, chain, charge, charged, chid, chindex, coil, coordinates, cos, cosh, cslabels, cyclic, dummy, element, exbonded, exp, extended, exwithin, floor, fragindex, fragment, heavy, helix, helix310, helixpi, heme, hetero, hydrogen, hydrophobic, icode, index, ion, large, lipid, log, log10, mapped, mass, medium, n_atoms, n_csets, name, neutral, nitrogen, noh, none, nonstdaa, not, nucleic, nucleobase, nucleoside, nucleotide, numbonds, occupancy, of, or, oxygen, polar, protein, purine, pyrimidine, radius, resid, resindex, resname, resnum, same, sc, secclass, secid, secindex, secondary, secstr, segindex, segment, segname, sequence, serial, sidechain, siguij, sin, sinh, small, sq, sqrt, stdaa, sugar, sulfur, surface, tahn, tan, title, to, turn, type, water, within, x, y, z.

sortAtoms(atoms, label, reverse=False)[source]

Returns an AtomMap pointing to atoms sorted in ascending data label order, or optionally in reverse order.

sliceAtoms(atoms, select)[source]

Slice atoms using the selection defined by select.

Parameters:
  • atoms (Atomic) – atoms to be selected from
  • select (Selection, str) – a Selection instance or selection string
extendAtoms(nodes, atoms, is3d=False)[source]

Returns extended mapping indices and an AtomMap.

sliceAtomicData(data, atoms, select, axis=None)[source]

Slice a matrix using indices extracted using sliceAtoms().

Parameters:
  • data (ndarray) – any data array
  • atoms (Atomic) – atoms to be selected from
  • select (Selection, str) – a Selection instance or selection string
  • axis (int, list) – the axis along which the data is sliced. See numpy for details of this parameter. Default is None (all axes)
extendAtomicData(data, nodes, atoms, axis=None)[source]

Extend a coarse grained data obtained for nodes to atoms.

Parameters:
  • data (ndarray) – any data array
  • nodes (Atomic) – a set of atoms that has been used as nodes in data generation
  • atoms (Atomic) – atoms to be selected from
  • axis (int) – the axis/direction you want to use to slice data from the matrix. The options are 0 or 1 or None like in numpy. Default is None (all axes)