Skip to content

Library

phamongi edited this page Aug 9, 2024 · 5 revisions

Main function : ontosunburst.ontosunburst

from ontosunburst.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'
'kegg'
'go'
None
Ontology to use
(or None if personal ontology)
root str None Root item of the ontology.
(To precise only 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)
scores Dict[str, float] None Dictionary associating for each ontology ID, its enrichment score.
If None enrichment will be calculated.
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
write_output bool True True to write the html figure and tsv class files,
False to only return plotly sunburst figure
class_ontology str
Dict[str, str]
None Class ontology dictionary or json file.
Dictionary associating to each concept ID of the ontology, the list of their +1 parent concepts.
labels str
Dict[str, str]
'default' Label dictionary (associating ontology ID to a label)
or path to corresponding json file
or 'default' to use default files.
If None ontology IDs will be used as labels.
endpoint_url str None URL of ChEBI or GO ontology for SPARQL requests.
If None will be set to corresponding default URL.
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.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', scores=None,
                   abundances=None, reference_set=REF_LST, ref_abundances=None,
                   analysis='topology', output='mc7', write_output=False,
                   class_ontology=None, labels='default', endpoint_url=None,
                   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)