<commit_before>import models


class Statistics:

    def count(self, model):
        return model.query.count()

    def all_confirmed_mutations(self):
        return models.Mutation.query.filter_by(is_confirmed=True).count()

    def get_all(self):
        return {
            'proteins': self.count(models.Protein),
            'genes': self.count(models.Gene),
            'kinases': self.count(models.Kinase),
            'kinase_groups': self.count(models.KinaseGroup),
            'mutations': {
                # both confirmed and MIMP mutations
                'all': self.count(models.Mutation),
                'all_confirmed': self.all_confirmed_mutations(),
                'clinvar': self.count(models.InheritedMutation),
                'esp': self.count(models.ExomeSequencingMutation),
                'cancer': self.count(models.CancerMutation),
                'thousand_genomes': self.count(models.The1000GenomesMutation),
                'mimp': self.count(models.MIMPMutation),
            },
            'sites': self.count(models.Site),
            'cancer': self.count(models.Cancer),<commit_msg>Differentiate between cancer mutation & anotation.<commit_after>from database import db
import models


class Statistics:

    def count(self, model):
        return model.query.count()

    def all_confirmed_mutations(self):
        return models.Mutation.query.filter_by(is_confirmed=True).count()

    def get_all(self):
        return {
            'proteins': self.count(models.Protein),
            'genes': self.count(models.Gene),
            'kinases': self.count(models.Kinase),
            'kinase_groups': self.count(models.KinaseGroup),
            'mutations': {
                # both confirmed and MIMP mutations
                'all': self.count(models.Mutation),
                'all_confirmed': self.all_confirmed_mutations(),
                'clinvar': self.count(models.InheritedMutation),
                'esp': self.count(models.ExomeSequencingMutation),
                'cancer': db.session.query(models.Mutation).filter(
                    models.Mutation.meta_cancer.any()
                ).count(),
                # each mutation can have multiple cancer annotations
                'cancer_annotations': self.count(models.CancerMutation),
                'thousand_genomes': self.count(models.The1000GenomesMutation),
                'mimp': self.count(models.MIMPMutation),
            },
            'sites': self.count(models.Site),
            'cancer': self.count(models.Cancer),
{'fraction_non_alphanumeric': 0.11785573512022074, 'fraction_numerical': 0.0031533307055577452, 'mean_word_length': 2.200504413619168, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1740648', 'n_tokens_mistral': 747, 'n_tokens_neox': 668, 'n_words': 114}