Package schrodinger :: Module project :: Class ProjectRow
[hide private]
[frames] | no frames]

Class ProjectRow

object --+
         |
        ProjectRow
Known Subclasses:


ProjectRow allows access to the structure and properties of an entry
in the project.  It is an access mechanism and not a completely
self-contained object - project row objects should be treated as
transient, they may become invalid by subsequent project operations.

This class represents a project entry.
Each row is linked to one entry, but row != entry

There are 3 ways to identify a row:
  ProjectRow.index: Internal project order, entry in project - NOT sorted
                    and NOT same as entry_id.
  ProjectRow.row_number: Table row position - changes when table is sorted
  ProjectRow.entry_id: ID of the entry represented by this row, never changes.

Normally it won't be necessary to create an explicit ProjectRow object,
one will be returned by indexing into a ProjectTable object

Instance Methods [hide private]
 
__init__(self, pt, row_index)
Construct a ProjectRow for the given Project instance based on an entry index.
 
__repr__(self)
Return string representation
 
__eq__(self, other)
Test ProjectRow equality by project handle and entry index.
 
__ne__(self, other)
Test ProjectRow inequality by project handle and entry index.
 
getStructure(self, props=True, copy=True)
@return: The entry's structure @rtype: L{structure.Structure}
 
_getStructure(self)
See docstring for structure property
 
setStructure(self, struct, props=True, copy=True)
Set the structure of the entry to the specified structure.
 
_setStructure(self, struct, copy=True)
See docstring for structure property
 
__getitem__(self, prop)
Return property value of C{prop} corresponding to ProjectRow object.
 
__setitem__(self, prop, value)
Set the C{value} for C{prop} in the ProjectRow object.
 
_setValue(self, data_name, data_type, value)
Private function to set a property value
 
__delitem__(self, prop)
Delete the property C{prop} from ProjectRow object.
 
inWorkspace(self)
Obsolete.
 
includeOnly(self)
Include this entry in the workspace and exclude all other entries.
 
selectOnly(self)
Select this entry and de-select all other entries in the Project Table.
 
_getTitle(self)
 
_setTitle(self, title)
 
_getProjectIndex(self)
The index property is not the same as Project Table row.
 
_getEntryID(self)
 
_getGroup(self)
 
_getEntryInWorkspace(self)
 
_setEntryInWorkspace(self, include)
 
_getEntryIsSelected(self)
 
_setEntryIsSelected(self, select)
 
_getEntryIsReadOnly(self)
 
_setEntryIsReadOnly(self, is_read_only)
 
_getEntryIsDeletable(self)
 
_setEntryIsDeletable(self, deletable)
 
_getCMSStructureReader(self)
If there is no associated cms file, then we return an empty iterator.
 
_getCMSFile(self)
Returns the file instead of the reader.
 
_getSurfaces(self)
Returns an iterator to the available surfaces
surface.Surface
newMolecularSurface(self, *args, **kwargs)
Create a new molecular surface for this row
 
moveToGroup(self, group_name)
Move this entry to group.
 
ungroup(self)
Remove this entry from its current group.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  doc = 'Inclusion state of the entry (NOT_IN_WORKSPACE/IN_WORKS...
Properties [hide private]
  structure
This attribute is obsolete.
  title
The title of the entry
  index
Internal Project index of the row.
  row_number
This is the Project Table row number, as it appears to the user in Maestro.
  entry_id
Entry ID of the row
  group
EntryGroup for the row
  in_workspace
Inclusion state of the entry (NOT_IN_WORKSPACE/IN_WORKSPACE/LOCKED_IN_WORKSPACE) WARNING: This property should NOT be treated as a boolean.
  is_selected
Whether the entry is selected
  read_only
Whether the entry is read only or not
  deletable
Whether the entry is deletable or not
  cms_structure_reader
Return StructureReader for associated CMS file or EmptyIterator if there is no associated file
  cms_file
Return associated CMS file or None if there is no associated file
  surfaces
Return an interator to the surface objects available for this entry
surface.SurfaceDict surface
A dictionary of all surfaces for this row.

Inherited from object: __class__

Method Details [hide private]

__init__(self, pt, row_index)
(Constructor)

 

Construct a ProjectRow for the given Project instance based on an entry index.

Overrides: object.__init__

__repr__(self)
(Representation operator)

 

Return string representation

Overrides: object.__repr__

getStructure(self, props=True, copy=True)

 

@return: The entry's structure
@rtype: L{structure.Structure}

@param props: Whether the accociated PT properties are included in the
    returned structure (default).
@type props: bool

@param copy: Whether to return a copy of the PT structure (default). If
    set to False, returns the original CT for the entry. Such use should
    in general be avoided, except as an optimization.
    NOTE: With copy=False, when the returned CT is modified, the changes
    are instantly propagated to the PT, but not the Workspace, and
    changes to properties do not propagate. Unless it's certain that
    properties didn't change, and that the structure is not included in
    the Workspace, any changes to it should be followed up by a call to
    setStructure().


WARNING: The current default (copy=True) is to make a duplicate
of the entry's structure.  These will be marked for garbage
collection once they go out of scope in the calling code, but if,
for example, you are in a loop your memory usage will grow until
the loop is exited (and it may even take a while for it to drop
since garbage collection is not necessarily immediate).  This can
cause large memory usage if, for example,  you are iterating over
a large number entries.  In some cases you may want to
explicitly delete the returned Structure.  For example,
in a loop iterating over a large number of entries you may want to
delete the Structure while still in the loop (after you're
done processing the Structure) to prevent memory bloat.

setStructure(self, struct, props=True, copy=True)

 

Set the structure of the entry to the specified structure.
If the entry is included in the Workspace, the Workspace CT will be
updated accordingly.

Arguments:
struct (required) - Set the entry to this Structure object
copy   (optional, default True) -
                    If True, a copy of the Structure (CT) is
                    made and that copy is used to set the entry.

                    If False, the original Structure, struct,
                    is placed into the project table.  Doing this
                    hands off control of struct and you should no
                    longer use struct.

props  (option, default True) -
                    If True, update properties in the entry.
                    If False, properties are ignored.

__getitem__(self, prop)
(Indexing operator)

 

Return property value of C{prop} corresponding to ProjectRow object.
Return None if the property doesn't exist. C{prop} acts as the key.

For example,
    title = proj_row['Title']

__setitem__(self, prop, value)
(Index assignment operator)

 

Set the C{value} for C{prop} in the ProjectRow object.
C{prop} acts as the key of the property.

For example,
    proj_row['Title'] = "Karthik"

__delitem__(self, prop)
(Index deletion operator)

 

Delete the property C{prop} from ProjectRow object.
In addition, this clears the cell in the project table.

For example,
    del proj_row["Title"]

inWorkspace(self)

 

Obsolete. Use ProjectRow.in_workspace property instead.

_getProjectIndex(self)

 

The index property is not the same as Project Table row. This property indicates what order entries were added to the project. This can change when an entry in the project is deleted.

_getCMSStructureReader(self)

 

If there is no associated cms file, then we return an empty iterator. This allows you to always just write a loop:

  for i in cms_structure_reader:

and avoid checking if cms_structure_reader exists. If it does not, the loop will do nothing.

If there is an associated cms file, then we return a StructureReader that allows one to retrieve the data by iterating.

_getCMSFile(self)

 

Returns the file instead of the reader. This is more convenient to use than the reader in some cases. If there is no associated cms file, then we return None.

newMolecularSurface(self, *args, **kwargs)

 

Create a new molecular surface for this row

Parameters:
  • name (str) - The name of the surface. Note that project rows require all surfaces to be named uniquely. See overwrite.
  • asl (str or NoneType) - If given, the surface will only be created for atoms in the structure that match the provided ASL. Note that only one of asl and atoms may be given. If neither are given, then the surface will be created for all atoms in the structure.
  • atoms (list or NoneType) - An optional list of atom numbers. If given, the surface will only be created for the specified atoms. Note that only one of asl and atoms may be given. If neither are given, then the surface will be created for all atoms in the structure.
  • resolution (float) - The resolution of the surface, generally between 0 and 1. Smaller numbers lead to a more highly detailed surface.
  • probe_radius (float) - The radius of the rolling sphere used to calculate the surface. Defaults to 1.4 if mol_surf_type is surface.MolSurfType.Molecular or surface.MolSurfType.Extended. May not be given if mol_surf_type is surface.MolSurfType.vdw.
  • vdw_scaling (float) - If given, all atomic radii will be scaled by the provided value before the surface is calculated.
  • mol_surf_type (surface.MolSurfType) - The type of surface to create.
  • overwrite (bool) - What to do if the new surface has the same name as an existing surface for this project row. If True, the existing surface will be overwritten. In False, a ValueError will be raised.
Returns: surface.Surface
The new surface

moveToGroup(self, group_name)

 

Move this entry to group. If group does not exist it will be created.

Parameters:
  • group_name (string) - name of group, which this entry is moved

Class Variable Details [hide private]

doc

Value:
'''Inclusion state of the entry (NOT_IN_WORKSPACE/IN_WORKSPACE/LOCKED_\
IN_WORKSPACE)
WARNING: This property should NOT be treated as a boolean.'''

Property Details [hide private]

structure


This attribute is obsolete. Please use ProjectRow.getStructure() and
ProjectRow.setStructure() instead.

Reference for the entry Structure.  Associated properties are not included.
Properties can be accessed directly from the project via getPropertyNames()

If you wish to update a structure in the project, you may work on that
structure directly. Do something like:

for row in pt.selected_rows:
  for atom in row.structure.atom
    atom.color = 44 #blue

You must be careful that the project entry you modify is not also
currently included in the Workspace.  When that entry is excluded
from the Workspace, its updated contents will be placed into the
entry in the project, potentially overwriting any direct changes
you made to the project entry.

If you want to pass the returned structure to another operation, make a
copy of it first as follows:
    st = row.structure.copy()

The Structure returned by row.structure will be invalid after the entry is
edited by Maestro or after setting row.structure to another structure.

WARNING: If you are working with large numbers of entries, you
may experience high memory usage.  This typically happens when
retrieving structures while iterating over large number of entries,
but will increase for every structure you retrieve. So if your
cumulative total of retrieved structurs is large then your memory
foot print is likely to be large as well.   This is because
the returned structures are configured not to be garbage collected.
You may wish to explicitly delete each Structure once you've finished
processing it in order to minimize memory usage.

Get Method:
_getStructure(self) - See docstring for structure property
Set Method:
_setStructure(self, struct, copy=True) - See docstring for structure property

title

The title of the entry

Get Method:
_getTitle(self)
Set Method:
_setTitle(self, title)

index

Internal Project index of the row. This is different from Project Table row number or from entry ID.

Get Method:
_getProjectIndex(self) - The index property is not the same as Project Table row.

row_number

This is the Project Table row number, as it appears to the user in Maestro. It is different from the internal row index.

Get Method:
unreachable.row_number(self) - This is the Project Table row number, as it appears to the user in Maestro.

entry_id

Entry ID of the row

Get Method:
_getEntryID(self)

group

EntryGroup for the row

Get Method:
_getGroup(self)

in_workspace

Inclusion state of the entry (NOT_IN_WORKSPACE/IN_WORKSPACE/LOCKED_IN_WORKSPACE) WARNING: This property should NOT be treated as a boolean.

Get Method:
_getEntryInWorkspace(self)
Set Method:
_setEntryInWorkspace(self, include)

is_selected

Whether the entry is selected

Get Method:
_getEntryIsSelected(self)
Set Method:
_setEntryIsSelected(self, select)

read_only

Whether the entry is read only or not

Get Method:
_getEntryIsReadOnly(self)
Set Method:
_setEntryIsReadOnly(self, is_read_only)

deletable

Whether the entry is deletable or not

Get Method:
_getEntryIsDeletable(self)
Set Method:
_setEntryIsDeletable(self, deletable)

cms_structure_reader

Return StructureReader for associated CMS file or EmptyIterator if there is no associated file

Get Method:
_getCMSStructureReader(self) - If there is no associated cms file, then we return an empty iterator.

cms_file

Return associated CMS file or None if there is no associated file

Get Method:
_getCMSFile(self) - Returns the file instead of the reader.

surfaces

Return an interator to the surface objects available for this entry

Get Method:
_getSurfaces(self) - Returns an iterator to the available surfaces

surface

A dictionary of all surfaces for this row. Keys are surface names and values are surface.Surface objects.

Get Method:
unreachable.surface(self) - A dictionary of all surfaces for this row.
Type:
surface.SurfaceDict