Package Bio :: Package SeqIO :: Module _index :: Class _SQLiteManySeqFilesDict
[hide private]
[frames] | no frames]

Class _SQLiteManySeqFilesDict

source code

UserDict.DictMixin --+    
                     |    
   _IndexedSeqFileDict --+
                         |
                        _SQLiteManySeqFilesDict

Read only dictionary interface to many sequential sequence files.

Keeps the keys, file-numbers and offsets in an SQLite database. To access a record by key, reads from the offset in the approapriate file using Bio.SeqIO for parsing.

There are OS limits on the number of files that can be open at once, so a pool are kept. If a record is required from a closed file, then one of the open handles is closed first.

Instance Methods [hide private]
 
__init__(self, index_filename, filenames, format, alphabet, key_function, max_open=10) source code
 
__repr__(self) source code
 
__contains__(self, key) source code
 
__len__(self)
How many records are there?
source code
 
__iter__(self)
Iterate over the keys.
source code
 
keys(self)
Return a list of all the keys (SeqRecord identifiers).
source code
 
__getitem__(x, y)
x[y]
source code
D[k] if k in D, else d
get(D, k, d=...)
d defaults to None.
source code
 
get_raw(self, key)
Similar to the get method, but returns the record as a raw string.
source code
 
close(self)
Close any open file handles.
source code

Inherited from _IndexedSeqFileDict: __setitem__, __str__, clear, copy, fromkeys, items, iteritems, iterkeys, itervalues, pop, popitem, update, values

Inherited from UserDict.DictMixin: __cmp__, has_key, setdefault

Method Details [hide private]

__init__(self, index_filename, filenames, format, alphabet, key_function, max_open=10)
(Constructor)

source code 
Overrides: _IndexedSeqFileDict.__init__

__repr__(self)
(Representation operator)

source code 
Overrides: UserDict.DictMixin.__repr__

__contains__(self, key)
(In operator)

source code 
Overrides: UserDict.DictMixin.__contains__

__len__(self)
(Length operator)

source code 

How many records are there?

Overrides: UserDict.DictMixin.__len__

__iter__(self)

source code 

Iterate over the keys.

Overrides: UserDict.DictMixin.__iter__

keys(self)

source code 

Return a list of all the keys (SeqRecord identifiers).

Overrides: _IndexedSeqFileDict.keys

__getitem__(x, y)
(Indexing operator)

source code 

x[y]

Overrides: _IndexedSeqFileDict.__getitem__

get(D, k, d=...)

source code 

d defaults to None.

Returns: D[k] if k in D, else d
Overrides: UserDict.DictMixin.get

get_raw(self, key)

source code 

Similar to the get method, but returns the record as a raw string.

If the key is not found, a KeyError exception is raised.

Note that on Python 3 a bytes string is returned, not a typical unicode string.

NOTE - This functionality is not supported for every file format.

Overrides: _IndexedSeqFileDict.get_raw