Back to index

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

List of all members.

Public Member Functions

def start_descriptions
def description_header
def description
def model_sequences
def nonmodel_sequences
def converged
def no_hits
def round
def end_descriptions

Private Member Functions

def _parse

Private Attributes

 _descriptions
 _model_sequences
 _nonmodel_sequences
 _converged
 _type
 _roundnum
 __has_n

Detailed Description

Definition at line 893 of file NCBIStandalone.py.


Member Function Documentation

def Bio.Blast.NCBIStandalone._DescriptionConsumer._parse (   self,
  description_line 
) [private]

Definition at line 939 of file NCBIStandalone.py.

00939 
00940     def _parse(self, description_line):
00941         line = description_line  # for convenience
00942         dh = Record.Description()
00943         
00944         # I need to separate the score and p-value from the title.
00945         # sp|P21297|FLBT_CAUCR FLBT PROTEIN     [snip]         284  7e-77
00946         # sp|P21297|FLBT_CAUCR FLBT PROTEIN     [snip]         284  7e-77  1
00947         # special cases to handle:
00948         #   - title must be preserved exactly (including whitespaces)
00949         #   - score could be equal to e-value (not likely, but what if??)
00950         #   - sometimes there's an "N" score of '1'.
00951         cols = line.split()
00952         if len(cols) < 3:
00953             raise ValueError( \
00954                   "Line does not appear to contain description:\n%s" % line)
00955         if self.__has_n:
00956             i = line.rfind(cols[-1])        # find start of N
00957             i = line.rfind(cols[-2], 0, i)  # find start of p-value
00958             i = line.rfind(cols[-3], 0, i)  # find start of score
00959         else:
00960             i = line.rfind(cols[-1])        # find start of p-value
00961             i = line.rfind(cols[-2], 0, i)  # find start of score
00962         if self.__has_n:
00963             dh.title, dh.score, dh.e, dh.num_alignments = \
00964                       line[:i].rstrip(), cols[-3], cols[-2], cols[-1]
00965         else:
00966             dh.title, dh.score, dh.e, dh.num_alignments = \
00967                       line[:i].rstrip(), cols[-2], cols[-1], 1
00968         dh.num_alignments = _safe_int(dh.num_alignments)
00969         dh.score = _safe_int(dh.score)
00970         dh.e = _safe_float(dh.e)
00971         return dh

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 925 of file NCBIStandalone.py.

00925 
00926     def converged(self, line):
00927         self._converged = 1

Definition at line 910 of file NCBIStandalone.py.

00910 
00911     def description(self, line):
00912         dh = self._parse(line)
00913         if self._type == 'model':
00914             self._model_sequences.append(dh)
00915         elif self._type == 'nonmodel':
00916             self._nonmodel_sequences.append(dh)
00917         else:
00918             self._descriptions.append(dh)

Here is the call graph for this function:

Definition at line 904 of file NCBIStandalone.py.

00904 
00905     def description_header(self, line):
00906         if line.startswith('Sequences producing'):
00907             cols = line.split()
00908             if cols[-1] == 'N':
00909                 self.__has_n = 1
    

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

Definition at line 936 of file NCBIStandalone.py.

00936 
00937     def end_descriptions(self):
00938         pass

Definition at line 919 of file NCBIStandalone.py.

00919 
00920     def model_sequences(self, line):
00921         self._type = 'model'

Definition at line 928 of file NCBIStandalone.py.

00928 
00929     def no_hits(self, line):
00930         pass

Definition at line 922 of file NCBIStandalone.py.

00922 
00923     def nonmodel_sequences(self, line):
00924         self._type = 'nonmodel'

Reimplemented in Bio.Blast.NCBIStandalone._BlastConsumer.

Definition at line 931 of file NCBIStandalone.py.

00931 
00932     def round(self, line):
00933         if not line.startswith('Results from round'):
00934             raise ValueError("I didn't understand the round line\n%s" % line)
00935         self._roundnum = _safe_int(line[18:].strip())

Here is the call graph for this function:

Reimplemented in Bio.Blast.NCBIStandalone._PSIBlastConsumer.

Definition at line 894 of file NCBIStandalone.py.

00894 
00895     def start_descriptions(self):
00896         self._descriptions = []
00897         self._model_sequences = []
00898         self._nonmodel_sequences = []
00899         self._converged = 0
00900         self._type = None
00901         self._roundnum = None
00902 
00903         self.__has_n = 0   # Does the description line contain an N value?


Member Data Documentation

Definition at line 902 of file NCBIStandalone.py.

Definition at line 898 of file NCBIStandalone.py.

Definition at line 895 of file NCBIStandalone.py.

Definition at line 896 of file NCBIStandalone.py.

Definition at line 897 of file NCBIStandalone.py.

Definition at line 900 of file NCBIStandalone.py.

Definition at line 899 of file NCBIStandalone.py.


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