pymodulon.core
Core functions for the IcaData object
Module Contents
Classes
Class representation of all iModulon-related data |
|
-
class
pymodulon.core.
IcaData
(M, A, X=None, log_tpm=None, gene_table=None, sample_table=None, imodulon_table=None, trn=None, dagostino_cutoff=None, optimize_cutoff=False, thresholds=None, threshold_method='dagostino', motif_info=None, imodulondb_table=None, gene_links=None, tf_links=None)[source] Bases:
object
Class representation of all iModulon-related data
-
view_imodulon
(self, imodulon)[source] View genes in an iModulon and show relevant information about each gene.
-
find_single_gene_imodulons
(self, save=False)[source] A simple function that returns the names of all likely single-gene iModulons. Checks if the largest iModulon gene weight is more than twice the weight of the second highest iModulon gene weight.
-
_update_imodulon_table
(self, enrichment)[source] Update iModulon table given new iModulon enrichments
-
compute_regulon_enrichment
(self, imodulon, regulator, save=False, evidence=None)[source] Compare an iModulon against a regulon. (Note: q-values cannot be computed for single enrichments)
- Parameters
regulator (str) – TF name, or complex regulon, where “/” uses genes in any regulon and “+” uses genes in all regulons
save (bool) – If true, save enrichment score to the imodulon_table (default: True)
evidence (list or str) – ‘Evidence’ level of TRN interactions to include during TRN enrichment (default: None)
- Returns
enrich – Table containing enrichment statistics
- Return type
-
compute_trn_enrichment
(self, imodulons=None, fdr=1e-05, max_regs=1, save=False, method='both', force=False, evidence=None)[source] Compare iModulons against all regulons in the TRN
- Parameters
imodulons (int or str) – Name of iModulon(s). If none given, compute enrichments for all ‘iModulons’ (default: None)
fdr (float) – False detection rate (default: 1e-5)
max_regs (int) – Maximum number of regulators to include in complex regulon ( default: 1)
save (bool) – Save regulons with highest enrichment scores to the imodulon_table (default: False)
method (str) – How to combine multiple regulators (default: ‘both’). ‘or’ computes enrichment against union of regulons, ‘and’ computes enrichment against intersection of regulons, and ‘both’ performs both tests
force (bool) – If false, prevents computation of >2 regulators (default: False)
evidence (list or str) – Evidence level of TRN interactions to include during TRN enrichment
- Returns
df_enriched – Table of statistically significant enrichments
- Return type
-
compute_annotation_enrichment
(self, annotation, column, imodulons=None, fdr=0.1)[source] Compare iModulons against a gene annotation table
- Parameters
annotation (DataFrame) – Table containing two columns: the gene locus tag, and its appropriate annotation
column (str) – Name of the column containing the annotation
imodulons (list or str or int) – Name of iModulon(s). If none given, compute enrichments for all iModulons (default: None)
fdr (float) – False detection rate (default: 0.1)
- Returns
DF_enriched – Table of statistically significant enrichments
- Return type
-
recompute_thresholds
(self, dagostino_cutoff)[source] Re-computes iModulon thresholds using a new D’Agostino cutoff
-
reoptimize_thresholds
(self, progress=True, plot=True)[source] Re-optimizes the D’Agostino statistic cutoff for defining iModulon thresholds if the TRN has been updated
-
_optimize_dagostino_cutoff
(self, progress, plot)[source] Computes an abridged version of the TRN enrichments for the 20 highest-weighted genes in order to determine a global minimum for the D’Agostino cutoff ultimately used to threshold and define the genes “in” an iModulon
-
compute_kmeans_thresholds
(self)[source] Computes iModulon thresholds using K-means clustering
- Returns
None
- Return type
-
copy
(self)[source] Make a deep copy of an IcaData object
- Returns
IcaData – Copy of IcaData object
- Return type
-