OEAltLocationFactory

class OEAltLocationFactory

This class represents OEAltLocationFactory, a class to perceive and manage alternate locations in a molecule and generate new subset molecules for specific sets of OEAltLocation selections.

Constructors

OEAltLocationFactory(impl: OEAltLocationFactoryImpl) -> OEAltLocationFactory
OEAltLocationFactory(fact: OEAltLocationFactory) -> OEAltLocationFactory
OEAltLocationFactory(src: Union[OEGraphMol,OEMol,OEQMol],
                     options: int) -> OEAltLocationFactory

Default and copy constructors.

If an OEMolBase is supplied, the constructed factory will describe alternate locations in the input molecule and generate new single-conformation molecules on demand for any set of alternate location selections. The initial selection state of this factory is as if SetPrimaryAlt has been called.

Note

When reading a molecule from a PDB file that will be used to construct an OEAltLocationFactory be sure to specify the input flavor: OEIFlavor_PDB_ALTLOC so that all the alternate location atoms will be retained.

The options argument provides control over how the factory is constructed. The set of unsigned values for this parameter is specified by the OEAltLocFactOption namespace.

If an OEAltLocationFactory is supplied, an object is constructed that matches the input.

GetAltAtoms

GetAltAtoms() -> Iterable[OEAtomBase]
GetAltAtoms() -> OEAtomIter
GetAltAtoms(pred: OEUnaryAtomPred) -> Iterable[OEAtomBase]
GetAltAtoms(pred: OEUnaryAtomPred) -> OEAtomIter
GetAltAtoms(grp: OEAltGroup) -> Iterable[OEAtomBase]
GetAltAtoms(grp: OEAltGroup) -> OEAtomIter
GetAltAtoms(grp: OEAltGroup, pred: OEUnaryAtomPred) -> Iterable[OEAtomBase]
GetAltAtoms(grp: OEAltGroup, pred: OEUnaryAtomPred) -> OEAtomIter
GetAltAtoms(loc: OEAltLocation) -> Iterable[OEAtomBase]
GetAltAtoms(loc: OEAltLocation) -> OEAtomIter
GetAltAtoms(loc: OEAltLocation, pred: OEUnaryAtomPred) -> Iterable[OEAtomBase]
GetAltAtoms(loc: OEAltLocation, pred: OEUnaryAtomPred) -> OEAtomIter

Returns an OEAtomBase iterator over the atoms with alternate locations. Both const and non-const versions are supplied for each iterator.

If no arguments are supplied, the iterator is over all alternate location atoms.

If an OEAltGroup or OEAltLocation is supplied, the iterator is only over the atoms in the specified group or location.

If an OEUnaryPredicate is supplied, the iterator will return those alternate location atoms that also match the predicate.

GetAtomMapSize

GetAtomMapSize() -> int

Returns the minimum size of the array of OEAtomBase pointers the user must supply to one of the MakePrimaryAltMol, MakeCurrentAltMol, or MakeAltMol methods if an atom map is to be returned. Atom maps are pointers to atoms in the generated molecule at locations in the array equal to the internal index of atoms in the molecule returned by GetSourceMol, or 0 for atoms not included in the generated molecule.

GetBondMapSize

GetBondMapSize() -> int

Returns the minimum size of the array of OEBondBase pointers the user must supply to one of the MakePrimaryAltMol, MakeCurrentAltMol, or MakeAltMol methods if a bond map is to be returned. Bond maps are arrays of pointers to bonds in the generated molecule at locations in the array equal to the internal index of bonds in the molecule returned by GetSourceMol, or 0 for bonds not included in the generated molecule.

GetCurrentAtoms

GetCurrentAtoms() -> Iterable[OEAtomBase]
GetCurrentAtoms() -> OEAtomIter
GetCurrentAtoms(pred: OEUnaryAtomPred) -> Iterable[OEAtomBase]
GetCurrentAtoms(pred: OEUnaryAtomPred) -> OEAtomIter

Returns an OEAtomBase iterator over the atoms in the current selection – atoms in selected locations in each group plus atoms that are not in any alternate location group. Both const and non-const versions are supplied for each iterator.

If an OEUnaryPredicate is supplied, the iterator will return those selected atoms that also match the predicate.

GetCurrentLocations

GetCurrentLocations() -> Iterable[OEAltLocation]
GetCurrentLocations(grp: OEAltGroup) -> Iterable[OEAltLocation]
GetCurrentLocations(grpNum: int) -> Iterable[OEAltLocation]

Returns an iterator over currently selected OEAltLocations. If no argument is supplied, every selected location is returned, otherwise only the selected location(s) for the specified OEAltGroup is returned. Unless SetAlt has been called with multiLoc set to true, only a single OEAltLocation will be returned per OEAltGroup.

GetGroup

GetGroup(selAtom: OEAtomBase) -> OEAltGroup
GetGroup(loc: OEAltLocation) -> OEAltGroup

If an OEAtomBase pointer is supplied, the method returns the OEAltGroup that includes the residue of the atom provided as input. If the input atom residue is not in any of the alternate location groups, a warning will be thrown, the OEAltGroup will be uninitialized and will return false when operator bool is called.

If an OEAltLocation is supplied, the method returns the OEAltGroup the location is associated with.

GetGroupCount

GetGroupCount() -> int

Returns the total number of OEAltGroups identified by this OEAltLocationFactory.

GetGroups

OESystem::OEIterBase<const OEAltGroup> *GetGroups() const

Returns an iterator over all OEAltGroups managed by this OEAltLocationFactory.

GetLocation

GetLocation(selAtom: OEAtomBase, confCode: str,
            caseSensitive: bool = True) -> OEAltLocation

Returns the OEAltLocation that includes the residue of the selected atom and the conformation code provided as input. The user can select whether or not the conformation code match is case sensitive. If the input atom residue is not in any of the alternate location groups, a warning will be thrown, the OEAltLocation will be uninitialized and will return false when operator bool is called.

GetLocationCodes

GetLocationCodes(grp: OEAltGroup) -> str
GetLocationCodes(loc: OEAltLocation) -> str

Returns a string listing all the alternate location characters in the input OEAltGroup or OEAltLocation. Although most OEAltLocations will return a string containing only a single character, some that are more complicated will return a string with more than one character.

GetSourceMol

GetSourceMol() -> OEGraphMol

Returns a constant reference to a copy of the OEMolBase supplied to the Constructor.

GetState

GetState() -> OEAltLocationState
GetState(state: OEAltLocationState) -> None

Returns an OEAltLocationState that represents the current selection state of this OEAltLocationFactory.

See also

MakeAltMol

MakeAltMol(dst: Union[OEGraphMol,OEMol,OEQMol], loc: OEAltLocation,
           atomMap: OEAtomBase = None, bondMap: OEBondBase = None,
           options: int) -> bool
MakeAltMol(dst: Union[OEGraphMol,OEMol,OEQMol],
           selAtom: OEAtomBase, confCode: str,
           caseSensitive: bool = True, atomMap: OEAtomBase = None,
           bondMap: OEBondBase = None, options: int) -> bool
MakeAltMol(dst: Union[OEGraphMol,OEMol,OEQMol],
           state: OEAltLocationState, atomMap: OEAtomBase = None,
           bondMap: OEBondBase = None, options: int) -> bool

Sets the selection state of this OEAltLocationFactory and generates a new subset molecule (dst) for this state, returning a value indicating whether the selection was valid. Unless SetAlt has been called with multiLoc set to true, the subset mol will represent a single conformation.

If either a location or an atom selection is supplied (see GetLocation), the selection state of only one group is set. If an OEAltLocationState is supplied, the selection state of all groups may be affected (see GetState).

If either a location or an atom selection is supplied and cannot be found in any alternation group, the dst molecule is not updated and false is returned.

If an array of OEAtomBase pointers is provided, this method will fill it with an atom map: pointers to atoms in the generated molecule at locations in the array equal to the internal index of atoms in the molecule returned by GetSourceMol, or 0 for atoms not included in the generated molecule.

If an array of OEBondBase pointers is provided, this method will fill it with a bond map: pointers to bonds in the generated molecule at locations in the array equal to the internal index of bonds in the molecule returned by GetSourceMol, or 0 for bonds not included in the generated molecule.

The options argument provides control over how the molecule is constructed. The set of unsigned values for this parameter is specified by the OEMakeAltMolOption namespace.

MakeCurrentAltMol

MakeCurrentAltMol(dst: Union[OEGraphMol,OEMol,OEQMol],
                  atomMap: OEAtomBase = None,
                  bondMap: OEBondBase = None, options: int) -> None

Generates a new subset molecule (dst) for the current selection state. Unless SetAlt has been called with multiLoc set to true, the subset mol will represent a single conformation.

If an array of OEAtomBase pointers is provided, this method will fill it with an atom map: pointers to atoms in the generated molecule at locations in the array of the internal index of atoms in the molecule returned by GetSourceMol, or 0 for atoms not included in the generated molecule.

If an array of OEBondBase pointers is provided, this method will fill it with a bond map: pointers to bonds in the generated molecule at locations in the array of the internal index of bonds in the molecule returned by GetSourceMol, or 0 for bonds not included in the generated molecule.

The options argument provides control over how the molecule is constructed. The set of unsigned values for this parameter is specified by the OEMakeAltMolOption namespace.

MakePrimaryAltMol

MakePrimaryAltMol(dst: Union[OEGraphMol,OEMol,OEQMol],
                  atomMap: OEAtomBase = None,
                  bondMap: OEBondBase = None, options: int) -> None

Resets the selection state of this OEAltLocationFactory to the primary location (see SetPrimaryAlt) and generates a new subset molecule (dst) for this state. Unless SetAlt has been called with multiLoc set to true, the subset mol will represent a single conformation.

If an array of OEAtomBase pointers is provided, this method will fill it with an atom map: pointers to atoms in the generated molecule at locations in the array of the internal index of atoms in the molecule returned by GetSourceMol, or 0 for atoms not included in the generated molecule.

If an array of OEBondBase pointers is provided, this method will fill it with a bond map: pointers to bonds in the generated molecule at locations in the array of the internal index of bonds in the molecule returned by GetSourceMol, or 0 for bonds not included in the generated molecule.

The options argument provides control over how the molecule is constructed. The set of unsigned values for this parameter is specified by the OEMakeAltMolOption namespace.

SetAlt

SetAlt(loc: OEAltLocation, multiLoc: bool = False) -> bool
SetAlt(selAtom: OEAtomBase, confCode: str,
       caseSensitive: bool = True) -> bool

If an OEAltLocation is supplied, the selection state of the OEAltGroup containing the location is set to select that location, with a return value indicating whether the location was found. If the optional multiLoc parameter has the (default) value of false, the function acts like a toggle: the previous location for this group is unselected before the new location is selected.

For a description of the atom selection form, see GetLocation.

Warning

If this method is called with the multiLoc parameter set to true, the OEAltLocationFactory may be left in a state where MakeCurrentAltMol no longer generates a single-conformation molecule.

SetPrimaryAlt

SetPrimaryAlt() -> None

Resets the selection state of this OEAltLocationFactory to the first location for each group – the location with the highest average occupancy.

SetState

SetState(state: OEAltLocationState) -> bool

Resets the selection state of this OEAltLocationFactory to that represented by the input OEAltLocationState, with a return value indicating whether the state was valid.

See also