Chris,

I've been rooting around in seqdb again, trying to understand exactly
how to make my own on-disk sequence database implementation (as a
prelude to making an implementation available based on Alex's code for
large short-read dbs).

I thought I'd start by making my own in-memory seq db class; here's what
I've got so far:

---
class MemSequence(SequenceBase):
    def _init_subclass(cls, db, **kwargs):
        cls.db = db
        db.seqInfoDict = kwargs['theDict']
    _init_subclass = classmethod(_init_subclass)

    def __init__(self, db, id):
        self.id = id
        SequenceBase.__init__(self)
        self.seq = db.seqInfoDict[id]

class MemSequenceDB(SequenceDB):
    itemClass = MemSequence
---

You can use this by taking a dictionary of sequences and passing it in
as the 'theDict' argument:

---
d = dict(a='ATCG', b='ATGGCAT')
memdb = MemSequenceDB(theDict=d)
---

In essence, all that's happening is that the dictionary 'd' becomes
db.seqInfoDict; the rest is just machinery surrounding that.

So, my question to you is, is this a reasonable start?  I realize that
MemSequenceDB

 - isn't pickleable; not sure exactly what I'd need to do to implement
        that;
 - doesn't do any caching or anything clever with strslice;

So, my next step is to provide a simple dict-like interface to Alexs
code that can then replace 'd'.  Anything else I need to note in order
to proceed with linking this to an actual on-disk file of sequences?

thanks,
--titus
-- 
C. Titus Brown, [email protected]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pygr-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pygr-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to