def __init__(self, sliceDB, seqDB, annotationType=None,
                 itemClass=AnnotationSeq,
                 itemSliceClass=AnnotationSlice,
                 itemAttrDict=None, # GET RID OF THIS BACKWARDS-COMPATIBILITY KLUGE!!
                 sliceAttrDict=None, maxCache=None, autoGC=True,
                 checkFirstID=True, **kwargs):
        '''sliceDB must map identifier to a sliceInfo object;
        sliceInfo must have attributes: id, start, stop, orientation;
        seqDB must map sequence ID to a sliceable sequence object;
        sliceAttrDict gives optional dict of item attributes that
        should be mapped to sliceDB item attributes.
        maxCache specfies the maximum number of annotation objects
        to keep in the cache.'''
        if autoGC: # automatically garbage collect unused objects
            self._weakValueDict = classutil.RecentValueDictionary(autoGC)
        else:
            self._weakValueDict = {} # object cache
        self.autoGC = autoGC
        if sliceAttrDict is None:
            sliceAttrDict = {}
        if sliceDB is not None:
            self.sliceDB = sliceDB
        else: # NEED TO CREATE / OPEN A DATABASE FOR THE USER
            self.sliceDB = classutil.get_shelve_or_dict(**kwargs)
        self.seqDB = seqDB
        self.annotationType = annotationType
        self.itemClass = itemClass
        self.itemSliceClass = itemSliceClass
        self.sliceAttrDict = sliceAttrDict # USER-PROVIDED ALIASES
        if maxCache is not None:
            self.maxCache = maxCache
        if checkFirstID:
            try: # don't cache anything now; schema may change itemClass!
                k = iter(self).next() # get the first ID if any
                self.get_annot_obj(k, self.sliceDB[k]) # valid annotation?
            except KeyError: # a convenient warning to the user...
                raise KeyError('''\
cannot create annotation object %s; sequence database %s may not be correct'''
                               % (k, repr(seqDB), ))
            except __HOLE__:
                pass # dataset is empty so there is nothing we can check...
dataset/ETHPy150Open cjlee112/pygr/pygr/annotation.py/AnnotationDB.__init__