EnrichmentResult¶
The results from enrichR are return in an EnrichmentResult.
- class magine.enrichment.enrichment_result.EnrichmentResult(*args, **kwargs)[source]¶
Bases:
magine.data.base.BaseData
- dist_matrix(figsize=(8, 8), level='dataframe')[source]¶
Create a distance matrix of all term similarity
- Parameters
- figsizetuple
Size of figure
- levelstr, {‘dataframe’, ‘each’}
How to treats term_name to genes. Dataframe compresses all genes from all sample_ids into same term. ‘each’ treats each term_name individually.
- Returns
- matplotlib.Figure
- filter_based_on_words(words, inplace=False)[source]¶
Filter term_name based on key terms
- Parameters
- wordslist, str
List of words to use to keep rows in dataframe
- inplacebool
Filter the dataframe in place or return filtered copy
- Returns
- pandas.DataFrame
- filter_multi(p_value=None, combined_score=None, db=None, sample_id=None, category=None, rank=None, inplace=False)[source]¶
Filters an enrichment array.
This is an aggregate function that allows ones to filter an entire dataframe with a single function call.
- Parameters
- p_valuefloat
filters all values less than or equal
- combined_scorefloat
filters all values greater than or equal
- dbstr, list
- sample_idstr, list
- categorystr, list
- rankint
- inplacebool
Filter inplace
- Returns
- new_dataEnrichmentResult
- filter_rows(column, options, inplace=False)[source]¶
Filters a pandas dataframe provides a column and filter selection.
- Parameters
- columnstr
- optionsstr, list
Can be a single entry or a list
- inplacebool
Filter inplace
- Returns
- ——-
- pd.DataFrame
- find_similar_terms(term, level='sample', remove_subset=True)[source]¶
Calculates similarity of all other terms to given term
- Parameters
- termstr
- levelstr
Sample or dataframe level, flattens all terms to one set of genes
- remove_subsetbool
If any term is a subset of the other term, a score of 1 will be used instead of jaccard index.
- Returns
- pd.DataFrame
- remove_redundant(threshold=0.75, verbose=False, level='sample', sort_by='combined_score', inplace=False)[source]¶
Calculate similarity between all term sets and removes redundant terms.
- Parameters
- thresholdfloat, default 0.75
- verbosebool, default False
Print similarity scores and removed terms.
- level{‘sample’, ‘dataframe’}, default ‘sample’
Level to filter dataframe. ‘sample’ will pivot the dataframe and filter each group of ‘sample_id’ individually. ‘dataframe’ will merge all genes that share the same ‘term_name’.
- sort_by{‘combined_score’, ‘rank’, ‘adj_p_value’, ‘n_genes’},
default ‘combined_score’ Keyword to sort the dataframe. The scoring starts at the top term and compares to all the lower terms. Options are
- inplacebool
Filter the dataframe in place or return filtered copy
- Returns
- pandas.DataFrame
- show_terms_below(term, level='dataframe', threshold=0.7, remove_subset=True)[source]¶
Find terms that were removed by remove_redundant
- Parameters
- termstr
- levelstr
- thresholdfloat
- remove_subsetbool
- Returns
- EnrichmentResult
This can be saved just like a pandas.DataFrame and loaded in using