Read only dictionary interface to a sequential sequence file.
Keeps the keys 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.
new empty dictionary
|
__init__(self,
filename,
alphabet,
key_function,
mode=' rU ' )
x.__init__(...) initializes x; see x.__class__.__doc__ for signature |
source code
|
|
|
|
|
|
|
_record_key(self,
identifier,
seek_position)
Used by subclasses to record file offsets for identifiers (PRIVATE). |
source code
|
|
list of D's values
|
values(self)
Would be a list of the SeqRecord objects, but not implemented. |
source code
|
|
list of D's (key, value) pairs, as 2-tuples
|
items(self)
Would be a list of the (key, SeqRecord) tuples, but not implemented. |
source code
|
|
an iterator over the (key, value) items of D
|
|
|
|
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
|
|
|
|
None
|
update(self,
**kwargs)
Would allow adding more values, but not implemented. |
source code
|
|
v, remove specified key and return the corresponding value
|
pop(self,
key,
default=None)
Would remove specified record, but not implemented. |
source code
|
|
(k, v), remove and return some (key, value) pair as a
|
|
None
|
|
New dict with keys from S and values equal to v
|
|
a shallow copy of D
|
|
Inherited from dict :
__cmp__ ,
__contains__ ,
__delitem__ ,
__eq__ ,
__ge__ ,
__getattribute__ ,
__gt__ ,
__iter__ ,
__le__ ,
__len__ ,
__lt__ ,
__ne__ ,
__new__ ,
__sizeof__ ,
has_key ,
iterkeys ,
itervalues ,
keys ,
setdefault
Inherited from object :
__delattr__ ,
__format__ ,
__reduce__ ,
__reduce_ex__ ,
__setattr__ ,
__subclasshook__
|