Utils¶
This module contains miscellaneous methods.
-
compath.utils.dict_to_pandas_df(d)[source]¶ Transform pandas df into a dict.
- Parameters
d (dict) –
- Return type
pandas.DataFrame
- Returns
pandas dataframe
-
compath.utils.process_form_gene_set(text)[source]¶ Process the string containing gene symbols and returns a gene set.
-
compath.utils.calculate_relative_enrichments(results, total_pathways_by_resource)[source]¶ Calculate relative enrichment of pathways (enriched pathways/total pathways).
-
compath.utils.count_genes_in_pathway(pathways_gene_sets, genes)[source]¶ Calculate how many of the genes are associated to each pathway gene set.
-
compath.utils.simulate_pathway_enrichment(resource_gene_sets, gene_set_query, runs=200)[source]¶ Simulate pathway enrichment.
-
compath.utils.get_genes_without_assigned_pathways(enrichment_results, genes_query)[source]¶ Return the genes without any known pathway assigned.
-
compath.utils.get_enriched_pathways(manager_list, gene_set)[source]¶ Return the results of the queries for every registered manager.
-
compath.utils.get_gene_pathways(manager_list, gene)[source]¶ Return the pathways associated with a gene for every registered manager.
-
compath.utils.get_mappings(compath_manager, only_accepted=True)[source]¶ Return a pandas dataframe with mappings information as an excel sheet file.
- Parameters
compath_manager (compath.manager.Manager) – ComPath Manager
only_accepted (bool) – only accepted (True) or all (False)
-
compath.utils.get_pathway_model_by_name(manager_dict, resource, pathway_name)[source]¶ Return the pathway object from the resource manager.
-
compath.utils.get_pathway_model_by_id(app, resource, pathway_id)[source]¶ Return the pathway object from the resource manager.
-
compath.utils.get_gene_sets_from_pathway_names(app, pathways)[source]¶ Return the gene sets for a given pathway/resource tuple.
-
compath.utils.get_pathway_info(app, pathways)[source]¶ Return the gene sets for a given pathway/resource tuple.
-
compath.utils.get_last_action_in_module(module_name, action)[source]¶ Return the info about the last action in the given module.
- Parameters
module_name (str) –
- Returns
-
compath.utils.perform_hypergeometric_test(gene_set, manager_pathways_dict, gene_universe, apply_threshold=False, threshold=0.05)[source]¶ Perform hypergeometric tests.
- Parameters
- Return type
- Returns
manager_pathways_dict with p value info
-
compath.utils.calculate_szymkiewicz_simpson_coefficient(set_1, set_2)[source]¶ Calculate Szymkiewicz-Simpson coefficient between two sets.
-
compath.utils.calculate_similarity(name_1, name_2)[source]¶ Calculate the string based similarity between two names.
-
compath.utils.get_top_matches(matches, top)[source]¶ Order list of tuples by second value and returns top values.
-
compath.utils.filter_results(results, threshold)[source]¶ Filter a tuple based iterator given a threshold.