Back to index

python-biopython  1.60
Public Member Functions | Private Attributes | Static Private Attributes
Bio.Blast.NCBIStandalone._HSPConsumer Class Reference
Inheritance diagram for Bio.Blast.NCBIStandalone._HSPConsumer:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def start_hsp
def score
def identities
def strand
def frame
def query
def align
def sbjct
def end_hsp

Private Attributes

 _hsp
 _query_start_index
 _query_len

Static Private Attributes

tuple _query_re = re.compile(r"Query(:?) \s*(\d+)\s*(.+) (\d+)")
tuple _sbjct_re = re.compile(r"Sbjct(:?) \s*(\d+)\s*(.+) (\d+)")

Detailed Description

Definition at line 1136 of file NCBIStandalone.py.


Member Function Documentation

def Bio.Blast.NCBIStandalone._HSPConsumer.align (   self,
  line 
)

Definition at line 1222 of file NCBIStandalone.py.

01222 
01223     def align(self, line):
01224         seq = line[self._query_start_index:].rstrip()
01225         if len(seq) < self._query_len:
01226             # Make sure the alignment is the same length as the query
01227             seq = seq + ' ' * (self._query_len-len(seq))
01228         elif len(seq) < self._query_len:
01229             raise ValueError("Match is longer than the query in line\n%s" \
01230                              % line)
01231         self._hsp.match = self._hsp.match + seq

Reimplemented in Bio.Blast.NCBIStandalone._PSIBlastConsumer, and Bio.Blast.NCBIStandalone._BlastConsumer.

Definition at line 1259 of file NCBIStandalone.py.

01259 
01260     def end_hsp(self):
01261         pass

def Bio.Blast.NCBIStandalone._HSPConsumer.frame (   self,
  line 
)

Definition at line 1183 of file NCBIStandalone.py.

01183 
01184     def frame(self, line):
01185         # Frame can be in formats:
01186         # Frame = +1
01187         # Frame = +2 / +2
01188         if line.find('/') != -1:
01189             self._hsp.frame = _re_search(
01190                 r"Frame\s?=\s?([-+][123])\s?/\s?([-+][123])", line,
01191                 "I could not find the frame in line\n%s" % line)
01192         else:
01193             self._hsp.frame = _re_search(
01194                 r"Frame = ([-+][123])", line,
01195                 "I could not find the frame in line\n%s" % line)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1156 of file NCBIStandalone.py.

01156 
01157     def identities(self, line):
01158         x, y = _re_search(
01159             r"Identities = (\d+)\/(\d+)", line,
01160             "I could not find the identities in line\n%s" % line)
01161         self._hsp.identities = _safe_int(x), _safe_int(y)
01162         self._hsp.align_length = _safe_int(y)
01163 
01164         if line.find('Positives') != -1:
01165             x, y = _re_search(
01166                 r"Positives = (\d+)\/(\d+)", line,
01167                 "I could not find the positives in line\n%s" % line)
01168             self._hsp.positives = _safe_int(x), _safe_int(y)
01169             assert self._hsp.align_length == _safe_int(y)
01170 
01171         if line.find('Gaps') != -1:
01172             x, y = _re_search(
01173                 r"Gaps = (\d+)\/(\d+)", line,
01174                 "I could not find the gaps in line\n%s" % line)
01175             self._hsp.gaps = _safe_int(x), _safe_int(y)
01176             assert self._hsp.align_length == _safe_int(y)
01177 
        

Here is the call graph for this function:

def Bio.Blast.NCBIStandalone._HSPConsumer.query (   self,
  line 
)

Definition at line 1202 of file NCBIStandalone.py.

01202 
01203     def query(self, line):
01204         m = self._query_re.search(line)
01205         if m is None:
01206             raise ValueError("I could not find the query in line\n%s" % line)
01207         
01208         # line below modified by Yair Benita, Sep 2004.
01209         # added the end attribute for the query
01210         colon, start, seq, end = m.groups()
01211         self._hsp.query = self._hsp.query + seq
01212         if self._hsp.query_start is None:
01213             self._hsp.query_start = _safe_int(start)
01214 
01215         # line below added by Yair Benita, Sep 2004.
01216         # added the end attribute for the query
01217         self._hsp.query_end = _safe_int(end)
01218 
01219         #Get index for sequence start (regular expression element 3)
01220         self._query_start_index = m.start(3)
01221         self._query_len = len(seq)

Here is the call graph for this function:

def Bio.Blast.NCBIStandalone._HSPConsumer.sbjct (   self,
  line 
)

Definition at line 1235 of file NCBIStandalone.py.

01235 
01236     def sbjct(self, line):
01237         m = self._sbjct_re.search(line)
01238         if m is None:
01239             raise ValueError("I could not find the sbjct in line\n%s" % line)
01240         colon, start, seq, end = m.groups()
01241         #mikep 26/9/00
01242         #On occasion, there is a blast hit with no subject match
01243         #so far, it only occurs with 1-line short "matches"
01244         #I have decided to let these pass as they appear
01245         if not seq.strip():
01246             seq = ' ' * self._query_len
01247         self._hsp.sbjct = self._hsp.sbjct + seq
01248         if self._hsp.sbjct_start is None:
01249             self._hsp.sbjct_start = _safe_int(start)
01250 
01251         self._hsp.sbjct_end = _safe_int(end)
01252         if len(seq) != self._query_len:
01253             raise ValueError( \
01254                   "QUERY and SBJCT sequence lengths don't match in line\n%s" \
01255                   % line)
01256 
01257         del self._query_start_index   # clean up unused variables
01258         del self._query_len

Here is the call graph for this function:

def Bio.Blast.NCBIStandalone._HSPConsumer.score (   self,
  line 
)

Definition at line 1140 of file NCBIStandalone.py.

01140 
01141     def score(self, line):
01142         self._hsp.bits, self._hsp.score = _re_search(
01143             r"Score =\s*([0-9.e+]+) bits \(([0-9]+)\)", line,
01144             "I could not find the score in line\n%s" % line)
01145         self._hsp.score = _safe_float(self._hsp.score)
01146         self._hsp.bits = _safe_float(self._hsp.bits)
01147 
01148         x, y = _re_search(
01149             r"Expect\(?(\d*)\)? = +([0-9.e\-|\+]+)", line,
01150             "I could not find the expect in line\n%s" % line)
01151         if x:
01152             self._hsp.num_alignments = _safe_int(x)
01153         else:
01154             self._hsp.num_alignments = 1
01155         self._hsp.expect = _safe_float(y)

Here is the call graph for this function:

Definition at line 1137 of file NCBIStandalone.py.

01137 
01138     def start_hsp(self):
01139         self._hsp = Record.HSP()

Definition at line 1178 of file NCBIStandalone.py.

01178 
01179     def strand(self, line):
01180         self._hsp.strand = _re_search(
01181             r"Strand\s?=\s?(\w+)\s?/\s?(\w+)", line,
01182             "I could not find the strand in line\n%s" % line)

Here is the call graph for this function:


Member Data Documentation

Definition at line 1138 of file NCBIStandalone.py.

Definition at line 1220 of file NCBIStandalone.py.

tuple Bio.Blast.NCBIStandalone._HSPConsumer._query_re = re.compile(r"Query(:?) \s*(\d+)\s*(.+) (\d+)") [static, private]

Definition at line 1201 of file NCBIStandalone.py.

Definition at line 1219 of file NCBIStandalone.py.

tuple Bio.Blast.NCBIStandalone._HSPConsumer._sbjct_re = re.compile(r"Sbjct(:?) \s*(\d+)\s*(.+) (\d+)") [static, private]

Definition at line 1234 of file NCBIStandalone.py.


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