Esempio n. 1
0
    def get_filter_by_sources(sources):

        filters = and_(((Mutation.get_relationship(source).any()
                         if are_details_managed(source) else
                         Mutation.get_relationship(source).has())
                        for source in sources))

        return filters
Esempio n. 2
0
    def __init__(self):

        for source_model in source_manager.all:
            # dirty trick: 1KGenomes is not a valid name in Python
            name = 'mutations_' + source_model.name.replace('1', 'T')

            def muts_counter(_self):
                return self.count_by_sources([source_model])

            self.register(counter(muts_counter, name=name))

        for source_model in filter(lambda model: are_details_managed(model),
                                   source_manager.all):
            name = f'mutations_{source_model.name}_annotations'

            self.register(models_counter(source_model, name=name))
Esempio n. 3
0
    def __init__(self):

        for model in Mutation.source_specific_data:
            # dirty trick: 1KGenomes is not a valid name in Python
            name = 'mutations_' + model.name.replace('1', 'T')

            def muts_counter(self, model=model):
                return self.count_mutations(model)

            muts_counter.to_be_registered = True

            self.__dict__[name] = muts_counter

        for model in filter(lambda model: are_details_managed(model),
                            Mutation.source_specific_data):
            name = 'mutations_' + model.name + '_annotations'

            self.__dict__[name] = models_counter(model)

        for name, method in get_methods(self):
            if hasattr(method, 'to_be_registered'):
                self.__dict__[name] = counter(method, name)