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

Class ProjectRow

object --+
         |
        ProjectRow


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)
Returns: Structure: The entry's 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.
 
row_number(self)
This is the Project Table row number, as it appears to the user in Maestro.
 
_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
 
surface(self)
A dictionary of all surfaces 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]
  structure = property(_getStructure, _setStructure, doc= ...
  title = property(_getTitle, _setTitle, doc= "The title of the ...
  index = property(_getProjectIndex, doc= "Internal Project inde...
  entry_id = property(_getEntryID, doc= "Entry ID of the row")
  group = property(_getGroup, doc= "EntryGroup for the row")
  doc = "Inclusion state of the entry (NOT_IN_WORKSPACE/IN_WORKS...
  in_workspace = property(_getEntryInWorkspace, _setEntryInWorks...
  is_selected = property(_getEntryIsSelected, _setEntryIsSelecte...
  read_only = property(_getEntryIsReadOnly, _setEntryIsReadOnly,...
  deletable = property(_getEntryIsDeletable, _setEntryIsDeletabl...
  cms_structure_reader = property(_getCMSStructureReader, doc= "...
  cms_file = property(_getCMSFile, doc= "Return associated CMS f...
  surfaces = property(_getSurfaces, doc= "Return an interator to...
Properties [hide private]

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)

 

Returns:
Structure:  The entry's structure

Arguments:
props:      True  - Associated properties are included
            in the returned Structure.
            False - Associated properties are excluded from
            the returne Structure.
copy:       True  - Makes and returns a duplicate of the entry's CT
            False - Returns the original CT for the entry

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.

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.

row_number(self)

 

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

Decorators:
  • @property

_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

surface(self)

 

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

Decorators:
  • @property

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]

structure

Value:
property(_getStructure, _setStructure, doc= """
    This attribute is obsolete. Please use ProjectRow.getStructure() a\
nd
    ProjectRow.setStructure() instead.

    Reference for the entry Structure.  Associated properties are not \
included.
    Properties can be accessed directly from the project via getProper\
...

title

Value:
property(_getTitle, _setTitle, doc= "The title of the entry")

index

Value:
property(_getProjectIndex, doc= "Internal Project index of the row. " \
"This is different from Project Table row number or from entry ID.")

doc

Value:
"Inclusion state of the entry (NOT_IN_WORKSPACE/IN_WORKSPACE/LOCKED_IN\
_WORKSPACE)"

in_workspace

Value:
property(_getEntryInWorkspace, _setEntryInWorkspace, doc= doc)

is_selected

Value:
property(_getEntryIsSelected, _setEntryIsSelected, doc= "Whether the e\
ntry is selected")

read_only

Value:
property(_getEntryIsReadOnly, _setEntryIsReadOnly, doc= "Whether the e\
ntry is read only or not")

deletable

Value:
property(_getEntryIsDeletable, _setEntryIsDeletable, doc= "Whether the\
 entry is deletable or not")

cms_structure_reader

Value:
property(_getCMSStructureReader, doc= "Return StructureReader for asso\
ciated CMS file or EmptyIterator if there is no associated file")

cms_file

Value:
property(_getCMSFile, doc= "Return associated CMS file or None if ther\
e is no associated file")

surfaces

Value:
property(_getSurfaces, doc= "Return an interator to the surface object\
s available for this entry")