# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/02_meta.ipynb.

# %% auto 0
__all__ = ['Collection', 'Registry']

# %% ../nbs/02_meta.ipynb 4
from pstr import safeattr, keymatch
from ston import RegistryCollection, NameRegistry

# %% ../nbs/02_meta.ipynb 6
class Collection(RegistryCollection):  
    def register(self, instance, attrs: list = ['abrv']):
        super().register(instance, attrs)
    
    def markers(self, cell_type: str):
        '''Return the set of marker genes for a given cell type.'''
        return self.initer(cell_type, 'cells', 'name')

# %% ../nbs/02_meta.ipynb 8
class Registry(NameRegistry):
    def __new__(cls, name, bases, namespace, **kwargs):
        namespace['_registry'] = Collection()
        obj = super().__new__(cls, name, bases, namespace, **kwargs)
        obj._registry =  Collection()
        return obj
