Omero-pychrm

From Colettapedia
Revision as of 19:35, 18 June 2013 by Colettace (talk | contribs) (Created page with "==General== * [https://github.com/manics/omero-pychrm repository] ==OmeroPychrm scripts== ===__init__.py=== * empty ===TableConnection.py=== <pre class="brush:python"> clas...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

General

OmeroPychrm scripts

__init__.py

  • empty

TableConnection.py

class PychrmStorageError(Exception):
  pass

class Connection(object):
  def __init__(self, user = None, passwd = None, host = None, client = None):
    """A wrapper for omero.client."""
    self.log = logging.getLogger(__name__)
    self.conn = BlitzGateway(client_obj = client)
    self.res = omero.client.getSession().sharedResources()
  def __enter__(self):
    return self.log.debug('Entering Connection')
  def __exit__(self):
    self.log.debug('Exiting Connection')
    self.conn._closeSession()

class TableConnection(Connection):
  """A basic client-side wrapper for OMERO.tables which handles opening and closing tables."""
  def __init__(self, user = None, passwd = None, host = None, client = None, tableName = None):
    """Create a new table handler, either by specifying user and passwd or by providing a client object (for scripts)."""
    # call base class constructor
    self.rid = self.res.repositories().descriptions[0].id.val
    self.tableName = tableName
    self.tableId = None
    self.table = None
  def close(self, parent=True):
    """standard cleanup stuff"""
    pass
  def openTable(self, tableId):
    """Opens an existing table by ID"""

PychrmStorage.py

class PychrmStorageError(Exception):
  pass

def parseFeatureName( name ):
  """Separate bin number and feature group name"""
  pass

def createFeatureName(ft, idx):
  """Concatenate feature group name and feature bin number"""
  pass

def featureSizes(names):
  """Return a dictionary of feature groups and corresponding numbers of features in them"""
  pass