Read only dictionary interface to a sequential sequence file.
Keeps the keys and associated file offsets in memory, reads the file
to access entries as SeqRecord objects using Bio.SeqIO for parsing them.
This approach is memory limited, but will work even with millions of
sequences.
Note - as with the Bio.SeqIO.to_dict() function, duplicate keys
(record identifiers by default) are not allowed. If this happens, a
ValueError exception is raised.
By default the SeqRecord's id string is used as the dictionary key.
This can be changed by suppling an optional key_function, a callback
function which will be given the record id and must return the desired
key. For example, this allows you to parse NCBI style FASTA identifiers,
and extract the GI number to use as the dictionary key.
Note that this dictionary is essentially read only. You cannot add or
change values, pop values, nor clear the dictionary.
|
__init__(self,
filename,
format,
alphabet,
key_function) |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
items(self)
Would be a list of the (key, SeqRecord) tuples, but not implemented. |
source code
|
|
|
values(self)
Would be a list of the SeqRecord objects, but not implemented. |
source code
|
|
|
keys(self)
Return a list of all the keys (SeqRecord identifiers). |
source code
|
|
|
|
|
|
D[k] if k in D, else d
|
|
|
get_raw(self,
key)
Similar to the get method, but returns the record as a raw string. |
source code
|
|
|
__setitem__(self,
key,
value)
Would allow setting or replacing records, but not implemented. |
source code
|
|
|
update(self,
**kwargs)
Would allow adding more values, but not implemented. |
source code
|
|
|
pop(self,
key,
default=None)
Would remove specified record, but not implemented. |
source code
|
|
|
|
|
|
|
fromkeys(self,
keys,
value=None)
A dictionary method which we don't implement. |
source code
|
|
|
copy(self)
A dictionary method which we don't implement. |
source code
|
|
Inherited from UserDict.DictMixin :
__cmp__ ,
has_key ,
setdefault
|