python/methylnet/interpretation_classes.py
def return_cpg_sets(self):
        """Return top sets of CpGs from classes and individuals, and the complementary set. Returns dictionary of sets of CpGs and the union of all the other sets minus the current set.


        Returns
        -------
        cpg_sets
            Dictionary of individuals and classes; CpGs contained in set for particular individual/class
        cpg_exclusion_sets
            Dictionary of individuals and classes; CpGs not contained in set for particular individual/class
        """

        from functools import reduce
        def return_cpg_set(shap_df):
            return set(shap_df['cpg'].values.tolist())
        cpg_sets={}
        for class_name,individuals in self.list_individuals().items():
            cpg_set = [set(self.extract_class(class_name)['cpg'].values.tolist())]
            for individual in individuals:
                cpg_set.append(set(self.extract_individual(individual)[1]['cpg'].values.tolist()))
            cpg_set=set(reduce(lambda x,y: x.union(y),cpg_set))
            cpg_sets[class_name] = cpg_set
        cpg_exclusion_sets={}
        for class_name in cpg_sets:
            #print("Calculating exclusion set for {}".format(class_name))
            cpg_exclusion_sets[class_name]=set(reduce(lambda x,y:x.union(y),[cpg_set for class_name_query,cpg_set in cpg_sets.items() if class_name_query != class_name]))
        return cpg_sets, cpg_exclusion_sets
Return top sets of CpGs from classes and individuals, and the complementary set. Returns dictionary of sets of CpGs and the union of all the other sets minus the current set.


        Returns
        -------
        cpg_sets
            Dictionary of individuals and classes; CpGs contained in set for particular individual/class
        cpg_exclusion_sets
            Dictionary of individuals and classes; CpGs not contained in set for particular individual/class
        
Return top sets of CpGs from classes and individuals, and the complementary set. Returns dictionary of sets of CpGs and the union of all the other sets minus the current set.
Returns

cpg_sets
Dictionary of individuals and classes; CpGs contained in set for particular individual/class
cpg_exclusion_sets
Dictionary of individuals and classes; CpGs not contained in set for particular individual/class
Return top sets of CpGs from classes and individuals and the complementary set . Returns dictionary of sets of CpGs and the union of all the other sets minus the current set . Returns cpg_sets Dictionary of individuals and classes ; CpGs contained in set for particular individual / class cpg_exclusion_sets Dictionary of individuals and classes ; CpGs not contained in set for particular individual / class
def return_cpg_sets(self):
        from functools import reduce
        def return_cpg_set(shap_df):
            return set(shap_df['cpg'].values.tolist())
        cpg_sets={}
        for class_name,individuals in self.list_individuals().items():
            cpg_set = [set(self.extract_class(class_name)['cpg'].values.tolist())]
            for individual in individuals:
                cpg_set.append(set(self.extract_individual(individual)[1]['cpg'].values.tolist()))
            cpg_set=set(reduce(lambda x,y: x.union(y),cpg_set))
            cpg_sets[class_name] = cpg_set
        cpg_exclusion_sets={}
        for class_name in cpg_sets:
            cpg_exclusion_sets[class_name]=set(reduce(lambda x,y:x.union(y),[cpg_set for class_name_query,cpg_set in cpg_sets.items() if class_name_query != class_name]))
        return cpg_sets, cpg_exclusion_sets
def return_cpg_sets ( self ) : from functools import reduce def return_cpg_set ( shap_df ) : return set ( shap_df [ 'cpg' ] . values . tolist ( ) ) cpg_sets = { } for class_name , individuals in self . list_individuals ( ) . items ( ) : cpg_set = [ set ( self . extract_class ( class_name ) [ 'cpg' ] . values . tolist ( ) ) ] for individual in individuals : cpg_set . append ( set ( self . extract_individual ( individual ) [ 1 ] [ 'cpg' ] . values . tolist ( ) ) ) cpg_set = set ( reduce ( lambda x , y : x . union ( y ) , cpg_set ) ) cpg_sets [ class_name ] = cpg_set cpg_exclusion_sets = { } for class_name in cpg_sets : cpg_exclusion_sets [ class_name ] = set ( reduce ( lambda x , y : x . union ( y ) , [ cpg_set for class_name_query , cpg_set in cpg_sets . items ( ) if class_name_query != class_name ] ) ) return cpg_sets , cpg_exclusion_sets
Return top sets of CpGs from classes and individuals, and the complementary set.
Return top sets of CpGs from classes and individuals and the complementary set .
"""Return top sets of CpGs from classes and individuals, and the complementary set. Returns dictionary of sets of CpGs and the union of all the other sets minus the current set.


        Returns
        -------
        cpg_sets
            Dictionary of individuals and classes; CpGs contained in set for particular individual/class
        cpg_exclusion_sets
            Dictionary of individuals and classes; CpGs not contained in set for particular individual/class
        """ #print("Calculating exclusion set for {}".format(class_name))
self