Back to index

python-biopython  1.60
Public Member Functions | Public Attributes | Private Member Functions
xbb_search.DNAsearch Class Reference
Inheritance diagram for xbb_search.DNAsearch:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def __init__
def init_alphabet
def SetSeq
def SetPattern
def IUPAC2regex
def Search
def SearchAll

Public Attributes

 sequence
 alphabet
 pattern
 rx_pattern
 rx

Private Member Functions

def _Search

Detailed Description

Definition at line 17 of file xbb_search.py.


Constructor & Destructor Documentation

Definition at line 18 of file xbb_search.py.

00018 
00019     def __init__(self):
00020         self.init_alphabet()
00021         self.sequence = ''
        

Here is the call graph for this function:


Member Function Documentation

def xbb_search.DNAsearch._Search (   self,
  start = 0 
) [private]

Definition at line 48 of file xbb_search.py.

00048 
00049     def _Search(self, start = 0):
00050         pos = self.rx.search(self.sequence, start)
00051         return pos
    

Here is the caller graph for this function:

Definition at line 22 of file xbb_search.py.

00022 
00023     def init_alphabet(self):
00024         self.alphabet = ambiguous_dna_values
00025         other = ''.join(self.alphabet.keys())
00026         self.alphabet['N'] = self.alphabet['N'] + other
00027         for key in self.alphabet.keys():
00028             if key == 'N': continue
00029             if key in self.alphabet[key]: continue
00030             self.alphabet[key] = self.alphabet[key] + key

Here is the caller graph for this function:

def xbb_search.DNAsearch.IUPAC2regex (   self,
  s 
)

Definition at line 38 of file xbb_search.py.

00038 
00039     def IUPAC2regex(self, s):
00040         rx = ''
00041         for i in s:
00042             r = self.alphabet.get(i,i)
00043             if len(r) > 1:
00044                 rx = '%s[%s]' % (rx, r)
00045             else:
00046                 rx += r
00047         return rx
    
def xbb_search.DNAsearch.Search (   self,
  start = 0 
)

Definition at line 52 of file xbb_search.py.

00052 
00053     def Search(self, start = 0):
00054         pos = self.rx.search(self.sequence, start)
00055         if pos:
00056             return pos.start()
00057         else:
00058             return -1
00059         

Here is the caller graph for this function:

Definition at line 60 of file xbb_search.py.

00060 
00061     def SearchAll(self):
00062         pos = -1
00063         positions = []
00064         while 1:
00065             m   = self._Search(pos+1)
00066             if not m: break
00067             pos = m.start()
00068             if pos == -1:
00069                 break
00070             
00071             positions.append(pos)
00072         return positions
00073     
        

Here is the call graph for this function:

def xbb_search.DNAsearch.SetPattern (   self,
  pattern 
)

Definition at line 33 of file xbb_search.py.

00033 
00034     def SetPattern(self, pattern):
00035         self.pattern = pattern
00036         self.rx_pattern = self.IUPAC2regex(pattern)
00037         self.rx = re.compile(self.rx_pattern)
    

Here is the caller graph for this function:

def xbb_search.DNAsearch.SetSeq (   self,
  seq 
)

Definition at line 31 of file xbb_search.py.

00031 
00032     def SetSeq(self, seq): self.sequence = seq
    

Member Data Documentation

Definition at line 23 of file xbb_search.py.

Definition at line 34 of file xbb_search.py.

Definition at line 36 of file xbb_search.py.

Definition at line 35 of file xbb_search.py.

Reimplemented in xbb_search.XDNAsearch.

Definition at line 20 of file xbb_search.py.


The documentation for this class was generated from the following file: