Back to index

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

List of all members.

Public Member Functions

def __init__
def __iter__
def get
def get_raw

Private Attributes

 _alphabet

Detailed Description

Random access to a Standard Flowgram Format (SFF) file.

Definition at line 562 of file _index.py.


Constructor & Destructor Documentation

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

Reimplemented from Bio.SeqIO._index.SeqFileRandomAccess.

Definition at line 564 of file _index.py.

00564 
00565     def __init__(self, filename, format, alphabet):
00566         SeqFileRandomAccess.__init__(self, filename, format, alphabet)
00567         header_length, index_offset, index_length, number_of_reads, \
00568         self._flows_per_read, self._flow_chars, self._key_sequence \
00569             = SeqIO.SffIO._sff_file_header(self._handle)


Member Function Documentation

Load any index block in the file, or build it the slow way (PRIVATE).

Reimplemented from Bio.SeqIO._index.SeqFileRandomAccess.

Definition at line 570 of file _index.py.

00570 
00571     def __iter__(self):
00572         """Load any index block in the file, or build it the slow way (PRIVATE)."""
00573         if self._alphabet is None:
00574             self._alphabet = Alphabet.generic_dna
00575         handle = self._handle
00576         handle.seek(0)
00577         #Alread did this in __init__ but need handle in right place
00578         header_length, index_offset, index_length, number_of_reads, \
00579         self._flows_per_read, self._flow_chars, self._key_sequence \
00580             = SeqIO.SffIO._sff_file_header(handle)
00581         if index_offset and index_length:
00582             #There is an index provided, try this the fast way:
00583             count = 0
00584             try :
00585                 for name, offset in SeqIO.SffIO._sff_read_roche_index(handle) :
00586                     yield name, offset, 0
00587                     count += 1
00588                 assert count == number_of_reads, \
00589                        "Indexed %i records, expected %i" \
00590                        % (count, number_of_reads)
00591                 return
00592             except ValueError, err :
00593                 import warnings
00594                 warnings.warn("Could not parse the SFF index: %s" % err)
00595                 assert count==0, "Partially populated index"
00596                 handle.seek(0)
00597         #We used to give a warning in this case, but Ion Torrent's
00598         #SFF files don't have an index so that would be annoying.
00599         #Fall back on the slow way!
00600         count = 0
00601         for name, offset in SeqIO.SffIO._sff_do_slow_index(handle) :
00602             yield name, offset, 0
00603             count += 1
00604         assert count == number_of_reads, \
00605                "Indexed %i records, expected %i" % (count, number_of_reads)

def Bio.SeqIO._index.SffRandomAccess.get (   self,
  offset 
)
Returns SeqRecord.

Reimplemented from Bio.SeqIO._index.SeqFileRandomAccess.

Reimplemented in Bio.SeqIO._index.SffTrimedRandomAccess.

Definition at line 606 of file _index.py.

00606 
00607     def get(self, offset) :
00608         handle = self._handle
00609         handle.seek(offset)
00610         return SeqIO.SffIO._sff_read_seq_record(handle,
00611                                                 self._flows_per_read,
00612                                                 self._flow_chars,
00613                                                 self._key_sequence,
00614                                                 self._alphabet)

def Bio.SeqIO._index.SffRandomAccess.get_raw (   self,
  offset 
)
Returns bytes string (if implemented for this file format).

Reimplemented from Bio.SeqIO._index.SeqFileRandomAccess.

Definition at line 615 of file _index.py.

00615 
00616     def get_raw(self, offset):
00617         handle = self._handle
00618         handle.seek(offset)
00619         return SeqIO.SffIO._sff_read_raw_record(handle, self._flows_per_read)
00620 


Member Data Documentation

Reimplemented from Bio.SeqIO._index.SeqFileRandomAccess.

Definition at line 573 of file _index.py.


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