Example #1
0
    def __init__(self, autoGC=True, dbname=None, **kwargs):
        """Initialize seq db from filepath or ifile."""
        if autoGC:  # automatically garbage collect unused objects
            self._weakValueDict = classutil.RecentValueDictionary(autoGC)
        else:
            self._weakValueDict = {}  # object cache @CTB not tested
        self.autoGC = autoGC

        # override itemClass and itemSliceClass if specified
        self.itemClass = kwargs.get('itemClass', self.itemClass)
        self.itemSliceClass = kwargs.get('itemSliceClass', self.itemSliceClass)

        if self.itemClass is None:
            raise TypeError("must supply itemClass to SequenceDB")

        # get a copy we can modify w/o side effects and bind itemClass.
        kwargs = kwargs.copy()
        kwargs['db'] = self
        classutil.get_bound_subclass(self,
                                     'itemClass',
                                     dbname,
                                     subclassArgs=kwargs)

        # guess the sequence type
        self._set_seqtype()
Example #2
0
 def __init__(self, autoGC=True, dbname='generic', **kwargs):
     "Initialize seq db from filepath or ifile"
     if autoGC: # automatically garbage collect unused objects
         self._weakValueDict = classutil.RecentValueDictionary(autoGC)
     else:
         self._weakValueDict = {}  # object cache
     self.autoGC = autoGC
     kwargs = kwargs.copy() # get a copy we can modify w/o side effects
     classutil.apply_itemclass(self, kwargs)
     kwargs['db'] = self
     classutil.get_bound_subclass(self, 'itemClass', dbname,
                                  subclassArgs=kwargs)
     self.set_seqtype()
Example #3
0
 def __init__(self, autoGC=True, dbname='generic', **kwargs):
     "Initialize seq db from filepath or ifile"
     if autoGC:  # automatically garbage collect unused objects
         self._weakValueDict = classutil.RecentValueDictionary(autoGC)
     else:
         self._weakValueDict = {}  # object cache
     self.autoGC = autoGC
     kwargs = kwargs.copy()  # get a copy we can modify w/o side effects
     classutil.apply_itemclass(self, kwargs)
     kwargs['db'] = self
     classutil.get_bound_subclass(self,
                                  'itemClass',
                                  dbname,
                                  subclassArgs=kwargs)
     self.set_seqtype()
Example #4
0
    def __init__(self, autoGC=True, dbname="__generic__", **kwargs):
        """Initialize seq db from filepath or ifile."""
        if autoGC:  # automatically garbage collect unused objects
            self._weakValueDict = classutil.RecentValueDictionary(autoGC)
        else:
            self._weakValueDict = {}  # object cache @CTB not tested
        self.autoGC = autoGC

        # override itemClass and itemSliceClass if specified
        self.itemClass = kwargs.get("itemClass", self.itemClass)
        self.itemSliceClass = kwargs.get("itemSliceClass", self.itemSliceClass)

        if self.itemClass is None:
            raise TypeError, "must supply itemClass to SequenceDB"

        # get a copy we can modify w/o side effects and bind itemClass.
        kwargs = kwargs.copy()
        kwargs["db"] = self
        classutil.get_bound_subclass(self, "itemClass", dbname, subclassArgs=kwargs)

        # guess the sequence type
        self._set_seqtype()