Back to index

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

List of all members.

Public Member Functions

def get
def __iter__
def get_raw

Detailed Description

Definition at line 621 of file _index.py.


Member Function Documentation

def Bio.SeqIO._index.SffRandomAccess.__iter__ (   self) [inherited]
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.SffTrimedRandomAccess.get (   self,
  offset 
)
Returns SeqRecord.

Reimplemented from Bio.SeqIO._index.SffRandomAccess.

Definition at line 622 of file _index.py.

00622 
00623     def get(self, offset) :
00624         handle = self._handle
00625         handle.seek(offset)
00626         return SeqIO.SffIO._sff_read_seq_record(handle,
00627                                                 self._flows_per_read,
00628                                                 self._flow_chars,
00629                                                 self._key_sequence,
00630                                                 self._alphabet,
00631                                                 trim=True)
00632 

def Bio.SeqIO._index.SffRandomAccess.get_raw (   self,
  offset 
) [inherited]
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 


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