Base class for selections.
Selection(name, description) => Selection instance
A Selection is a set of selectable objects.
This class must be subclassed.
|
Methods
|
|
|
|
|
|
__len__
|
__len__ ( self )
Total count of items in selection
|
|
|
__str__
|
__str__ ( self )
Return the printable string representation of the selection.
str(selection) => string
|
Exceptions
|
|
TypeError, "Instance must be of a subtype of Selection"
|
|
|
|
apply
|
apply (
self,
vFunc=None,
eFunc=None,
)
Call given functions for objects that match selection.
selection.apply(vFunc, eFunc) => None
vFunc is the function for vertices while eFunc is the
function for edges.
All calls to the eFunc are made before any calls to the vFunc.
This function must be implemented in subclasses.
|
Exceptions
|
|
AssertionError, "Selection subclass does not implement apply()"
|
|
|
|
atoms
|
atoms ( self, **kw )
|
|
|
barrenGraphs
|
barrenGraphs ( self, asDict=False )
Graphs that have no vertices/edges
Since contained graphs are normally computed from
vertices/edges, such barren graphs have to be
tracked separately. If asDict is True, then a
dictionary (keys: barren graphs, values: arbitrary)
is returned instead of a list.
Must be implemented by subclasses
|
Exceptions
|
|
AssertionError, "Selection subclass does not implement barrenGraphs()"
|
|
|
|
bonds
|
bonds ( self, **kw )
|
|
|
contents
|
contents ( self, asDict=False )
Return all vertices/edges selected by the selection.
selection.contents() => ( [vertex-objs], [edge-objs] )
if asDict is True, the vertices/edges are returned as
dictionaries (keys are vertices/edges, arbitrary values)
This is a default implementation that uses the apply function.
|
|
|
counts
|
counts ( self )
|
|
|
edges
|
edges ( self, asDict=False )
Return all edges in the selection.
selection.edges() => [edge-objs]
if asDict is True, the edges are returned as a
dictionary (keys are edges, arbitrary values)
This is a default implementation that uses the apply function.
|
|
|
graphs
|
graphs ( self, asDict=False )
|
|
|
molecules
|
molecules ( self, **kw )
|
|
|
residues
|
residues ( self, **kw )
|
|
|
subgraphs
|
subgraphs ( self, asDict=False )
Return the implicitly selected graphs
selection.subgraphs() => [subgraphs]
if asDict is True, the subgraphs are returned as a
dictionary (keys are subgraphs, arbitrary values)
|
|
|
vertices
|
vertices ( self, asDict=False )
Return all vertices in the selection.
selection.vertices() => [vertex-objs]
if asDict is True, the vertices are returned as a
dictionary (keys are vertices, arbitrary values)
This is a default implementation that uses the apply function.
|
|