Skip to content

Library

Pauline edited this page Apr 22, 2025 · 10 revisions

Main function : ontosunburst

from ontosunburst import ontosunburst

Main function to be called generating the sunburst figure

Parameters

Parameter Type Default Values Description
interest_set List[str] Interest set of concepts to classify.
List of the ontology ID's.
ontology str None 'metacyc'
'ec'
'chebi'
'chebi_r'
'kegg'
'go_cc'
'go_bp'
'go_mf'
'go'
None
Ontology to use
(or None if personal ontology)
abundances List[str] None Abundance values associated to interest_set list parameter.
(List of abundances : indexes matching corresponding interest_set ID's)
reference_set List[str] None Reference set of concepts.
List of the ontology ID's.
ref_abundances List[str] None Abundance values associated to reference_set list parameter.
(List of abundances : indexes matching corresponding reference_set ID's)
analysis str 'topology' 'topology'
'enrichment'
Analysis mode : topology or enrichment.
output str 'sunburst' Path of the output to save figure. (Path + base output name)
If None, outputs will be sunburst.html and sunburst.tsv files
scores Dict[str, float] None Dictionary associating for each ontology ID, its enrichment score.
If None enrichment will be calculated.
write_output bool True True to write the html figure and tsv class files,
False to only return plotly sunburst figure
ontology_dag_input str
Dict[str, str]
None Ontology DAG dictionary or json file.
Dictionary associating to each concept ID of the ontology, the list of their +1 parent concepts.
input_root str None Root item of the ontology.
(To precise only if tailored ontology)
id_to_label_input str
Dict[str, str]
None ID to Label correspondance dictionary (associating ontology ID to a label)
or path to corresponding json file
If None will use default files.
labels bool True True to use labels as labels, False to use IDs otherwise.
test str 'binomial' 'binomial'
'hypergeometric'
Type of test if analysis=enrichment : binomial or hypergeometric test.
root_cut str 'cut' 'uncut'
'cut'
'total'
Mode for root cutting
(uncut, cut or total)
path_cut str 'uncut' 'uncut'
'deeper'
'higher'
'bound'
Mode for nested path cutting
(uncut, deeper, higher or bound)
ref_base bool False True to have the base classes representation of the reference set in the figure.
show_leaves bool False True to show input concepts at sunburst leaves
**kwargs Additional arguments (figure options)

Additional arguments : Kwargs

Kwarg Type Default Topology Default Enrichment Values Description
c_min float 1 -10 Minimal value
c_max float None 10 Maximal value
c_mid float None 0 Mid value
max_depth int 7 7 >1 Maximal sunburst depth
colorscale str Viridis RdBu plotly colorscale name Colorscale
title str '{output} : Proportion of classes' '{output} : Classes enrichment representation' Title of figure
colorbar_legend str 'Count' 'Log10(pvalue)' Legend of colorbar
bg_color str 'rgba(255, 255, 255, 0)' 'rgba(255, 255, 255, 0)' name or hex or rgba Figure background color
font_color str '#111111' '#111111' name or hex or rgba Font color
font_size int 20 20 >1 Font size
table_title str 'Significant p-values' Enrichment table title
table_legend str 'IDs' Enrichment table ID's name
table_color str '#666666' name or hex or rgba Enrichment table cases color

Returns

Type Description
graph_objects.Figure Plotly graph_objects figure of the sunburst

Examples

from ontosunburst import ontosunburst

INT_LST = ['CPD-24674', 'CPD-24687', 'CPD-24688']
REF_LST = ['CPD-24674', 'CPD-24687', 'CPD-24688',
           'CPD-12782', 'CPD-12784', 'CPD-12787',
           'CPD-12788', 'CPD-12789', 'CPD-12796',
           'CPD-12797', 'CPD-12798', 'CPD-12805',
           'CPD-12806', 'CPD-12812', 'CPD-12816',
           'CPD-1282', 'CPD-12824', 'CPD-1283']

fig = ontosunburst(interest_set=INT_LST, ontology='metacyc', abundances=None, 
                   reference_set=REF_LST, ref_abundances=None, analysis='topology', 
                   output='mc7', scores=None, write_output=False,
                   ontology_dag_input=None, input_root=None, id_to_label_input=True, 
                   labels=True, test='binomial', root_cut='cut', path_cut='uncut',
                   ref_base=True, show_leaves=True)

# EQUIVALENT TO :

fig = ontosunburst(interest_set=INT_LST, ontology='metacyc', reference_set=REF_LST, 
                   output='mc7', write_output=False, ref_base=True, show_leaves=True)
Clone this wiki locally