Table of Contents

Module: FilteredReader Bio/FilteredReader.py

Code for more fancy file handles.

Classes: Filtered is a decorator for File that allows the user to filter the output on a line by line basis.

The FilteredReader module reads a file and applies a sequence of filters to the input The constructor sets a default filter chain, but the user can select another filter by setting Bio.FilteredReader.filter_chain.

handle = open( "filename" ) filtered_reader = Bio.FilteredReader( handle ) filtered_reader.filter_chain = [ remove_asterisks, replace_dot_with_dash ] filtered_reasder.read()

All filters in the chain must provide the same interface with a line of text as the single input parameter and altered text as the return value.

Imported modules   
from File import UndoHandle
import copy
import os
import string
Functions   
dump_saved
fix_punctuation
has_trailing_linefeed
remove_empty_line
remove_useless_dot
  dump_saved 
dump_saved (
        name,
        text,
        j,
        )

  fix_punctuation 
fix_punctuation ( line )

  has_trailing_linefeed 
has_trailing_linefeed ( line )

  remove_empty_line 
remove_empty_line ( line )

  remove_useless_dot 
remove_useless_dot ( line )

Classes   
FilteredReader

Table of Contents

This document was automatically generated on Mon Jul 1 12:02:43 2002 by HappyDoc version 2.0.1