Table of Contents

Class: RowFilteredView compClust/mlx/views/RowFilteredView.py

View a subset of rows of a dataset based on a filter.

A RowFilteredView is concerned only with the rows of a dataset. The view created contains the rows of the the original dataset which are allowed via the filter function. If no filter is provided then all rows are included in the view. RowFilteredView is derived from RowSubsetView. The filter function should be written such that it takes a dataset and a row and returns either 1 or 0 based on if it is to keep or hide the row. See examples below.

FilterFunction Prototype:

FilterFunc(ds, row) ds is a dataset object row is an int. returns 0 or 1

example:

this creates a filtered view where all rows have a mean > 1

>>> filteredDS = View.RowFilteredView (ds, lambda ds, row: mean(ds.getRowData(row) )> 1)

# this changes the view to have all genes which match the regexp # cool (case insensitive) inside the label in the labeling named # names

>>> filteredDS.setFilter(lambda ds, row: re.compile(cool, re.I).match(ds.getLabeling(names).getLabelsByRow(row)[0]))

Base Classes   
RowSubsetView
Methods   
__init__
setFilter
  __init__ 
__init__ (
        self,
        dataset,
        filterFunc=None,
        )

  setFilter 
setFilter ( self,  filterFunc=None )

setFilter(self, filterFunc=None)

Update the Filtered View with a new filter function. If filter function is None, all data is passed through.

Below is the FilterFunction Prototype, see the class doc-string for examples and more information:

FilterFunc(ds, row) ds is a dataset object row is an int. returns 0 or 1


Table of Contents

This document was automatically generated on Wed Aug 27 14:24:57 2003 by HappyDoc version 2.1