Back to index

python-biopython  1.60
Public Member Functions | Private Attributes
Bio.SeqIO._index.IntelliGeneticsRandomAccess Class Reference
Inheritance diagram for Bio.SeqIO._index.IntelliGeneticsRandomAccess:
Inheritance graph
[legend]
Collaboration diagram for Bio.SeqIO._index.IntelliGeneticsRandomAccess:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def __iter__
def get_raw
def get

Private Attributes

 _marker_re

Detailed Description

Random access to a IntelliGenetics file.

Definition at line 911 of file _index.py.


Constructor & Destructor Documentation

def Bio.SeqIO._index.IntelliGeneticsRandomAccess.__init__ (   self,
  filename,
  format,
  alphabet 
)

Reimplemented from Bio.SeqIO._index.SeqFileRandomAccess.

Definition at line 913 of file _index.py.

00913 
00914     def __init__(self, filename, format, alphabet):
00915         SeqFileRandomAccess.__init__(self, filename, format, alphabet)
00916         self._marker_re = re.compile(_as_bytes("^;"))


Member Function Documentation

Returns (id,offset) tuples.

Reimplemented from Bio.SeqIO._index.SeqFileRandomAccess.

Definition at line 917 of file _index.py.

00917 
00918     def __iter__(self):
00919         handle = self._handle
00920         handle.seek(0)
00921         marker_re = self._marker_re
00922         semi_char = _as_bytes(";")
00923         while True:
00924             offset = handle.tell()
00925             line = handle.readline()
00926             length = len(line)
00927             if marker_re.match(line):
00928                 #Now look for the first line which doesn't start ";"
00929                 while True:
00930                     line = handle.readline()
00931                     if line[0:1] != semi_char and line.strip():
00932                         key = line.split()[0]
00933                         yield _bytes_to_string(key), offset, length
00934                         break
00935                     if not line:
00936                         raise ValueError("Premature end of file?")
00937                     length += len(line)
00938             elif not line:
00939                 #End of file
00940                 break

Here is the call graph for this function:

def Bio.SeqIO._index.SeqFileRandomAccess.get (   self,
  offset 
) [inherited]
Returns SeqRecord.

Reimplemented in Bio.SeqIO._index.UniprotRandomAccess, Bio.SeqIO._index.SffTrimedRandomAccess, and Bio.SeqIO._index.SffRandomAccess.

Definition at line 540 of file _index.py.

00540 
00541     def get(self, offset):
00542         """Returns SeqRecord."""
00543         #Should be overriden for binary file formats etc:
00544         return self._parse(StringIO(_bytes_to_string(self.get_raw(offset))))

Here is the call graph for this function:

Returns bytes string (if implemented for this file format).

Reimplemented from Bio.SeqIO._index.SeqFileRandomAccess.

Definition at line 941 of file _index.py.

00941 
00942     def get_raw(self, offset):
00943         handle = self._handle
00944         handle.seek(offset)
00945         marker_re = self._marker_re
00946         lines = []
00947         line = handle.readline()
00948         semi_char = _as_bytes(";")
00949         while line.startswith(semi_char):
00950             lines.append(line)
00951             line = handle.readline()
00952         while line and not line.startswith(semi_char):
00953             lines.append(line)
00954             line = handle.readline()
00955         return _as_bytes("").join(lines)

Here is the call graph for this function:


Member Data Documentation

Definition at line 915 of file _index.py.


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