root/galaxy-central/eggs/bx_python-0.5.0_dev_f74aec067563-py2.6-macosx-10.6-universal-ucs2.egg/bx/align/sitemask/core.py @ 3

リビジョン 3, 1.0 KB (コミッタ: kohda, 14 年 前)

Install Unix tools  http://hannonlab.cshl.edu/galaxy_unix_tools/galaxy.html

行番号 
1"""
2Base classes for site maskers.
3"""
4
5from bx.filter import *
6
7class Masker( Filter ):
8    def __init__( self, **kwargs ):
9        self.masked = 0
10        self.total = 0
11        Exception("Abstract class")
12
13class MaskPipeline( Pipeline ):
14    """
15    MaskPipeline implements a Pipeline through which alignments can be
16    pushed and masked.  Pipelines can be aggregated.
17    """
18    def get_masked( self ):
19        masked = 0
20        for function in self.pipeline:
21            try: masked += masker.masked
22            except AttributeError: pass
23        return masked
24    masked = property( fget=get_masked )
25   
26    def __call__( self, block ):
27        if not block: return
28        # push alignment block through all filters
29        self.total += len( block.components[0].text )
30        for masker in self.filters:
31            if not block: return
32            try: m_filter = masker.__call__
33            except AttributeError:
34                raise Exception("Masker in pipeline does not implement \"filter( self, block )\".")
35            masker( block )
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。