Plot a subset of the HPO as a 3D network.
network_3d(
g,
layout_func = igraph::layout.fruchterman.reingold,
node_color_var = "ontLvl",
edge_color_var = "zend",
text_color_var = node_color_var,
node_symbol_var = "ancestor_name",
node_palette = pals::kovesi.cyclic_mrybm_35_75_c68_s25,
edge_palette = pals::kovesi.cyclic_mrybm_35_75_c68_s25,
node_opacity = 0.75,
edge_opacity = 0.5,
kde_palette = pals::gnuplot,
add_kde = TRUE,
extend_kde = 1.5,
bg_color = kde_palette(6)[1],
add_labels = FALSE,
keep_grid = FALSE,
aspectmode = "cube",
hover_width = 80,
label_width = 80,
seed = 2023,
showlegend = TRUE,
show_plot = TRUE,
save_path = tempfile(fileext = "network_3d.html"),
verbose = TRUE
)
igraph object generated by make_igraph_object.
Layout function for the graph.
Variable in the vertex metadata to color nodes by.
Variable in the edge metadata to color edges by.
Variable in the node metadata to color text by.
Variable in the vertex metadata to shape nodes by.
Color palette function for the nodes/points.
Color palette function for the edges/lines.
Node opacity.
Edge opacity.
Color palette function for the KDE plot.
Add a kernel density estimation (KDE) plot below the 3D scatter plot (i.e. the "mountains" beneath the points).
Extend the area that the KDE plot covers.
Plot background color.
Add phenotype name labels to each point.
Keep all grid lines and axis labels.
The proportions of the 3D plot. See the plotly documentation site for details.
Maximum width of the hover text.
Maximum width of the label text.
Random seed to enable reproducibility.
Show node fill legend.
Print the plot after it's been generated.
Path to save interactive plot to as a self-contained HTML file.
Print messages.
A 3D interactive plotly object.
phenos <- make_phenos_dataframe(ancestor = "Neurodevelopmental delay")
#> ℹ All local files already up-to-date!
#> Reading cached RDS file: phenotype_to_genes.txt
#> + Version: v2023-10-09
#> Extracting data for 23 descendents.
#> Computing gene counts.
#> Getting absolute ontology level for 23 HPO IDs.
#> Computing ontology level / gene count ratio.
#> Adding term definitions.
#> ℹ All local files already up-to-date!
#> Adding level-3 ancestor to each HPO ID.
#> ℹ All local files already up-to-date!
g <- make_igraph_object(phenos = phenos)
#> Making phenotype network object.
#> Creating adjacency matrix for 23 term(s).
#> ℹ All local files already up-to-date!
#> Creating ggnetwork object.
#> Adding new_column='hpo_name'
#> Adding new_column='hpo_id'
#> Adding new_column='ontLvl'
#> Adding new_column='ontLvl_geneCount_ratio'
#> Adding new_column='definition'
#> Adding new_column='ancestor'
#> Adding new_column='ancestor_name'
#> Adding n_edges per node.
#> Creating igraph object.
plt <- network_3d(g=g, show_plot=FALSE)
#> Converting igraph to plotly data.
#> Warning: 'surface' objects don't have these attributes: 'marker'
#> Valid attributes include:
#> '_deprecated', 'autocolorscale', 'cauto', 'cmax', 'cmid', 'cmin', 'coloraxis', 'colorbar', 'colorscale', 'connectgaps', 'contours', 'customdata', 'customdatasrc', 'hidesurface', 'hoverinfo', 'hoverinfosrc', 'hoverlabel', 'hovertemplate', 'hovertemplatesrc', 'hovertext', 'hovertextsrc', 'ids', 'idssrc', 'legendgroup', 'legendgrouptitle', 'legendrank', 'lighting', 'lightposition', 'meta', 'metasrc', 'name', 'opacity', 'opacityscale', 'reversescale', 'scene', 'showlegend', 'showscale', 'stream', 'surfacecolor', 'surfacecolorsrc', 'text', 'textsrc', 'type', 'uid', 'uirevision', 'visible', 'x', 'xcalendar', 'xhoverformat', 'xsrc', 'y', 'ycalendar', 'yhoverformat', 'ysrc', 'z', 'zcalendar', 'zhoverformat', 'zsrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule', '_bbox'
#> Saving interactive plot --> /tmp/Rtmp7LnXkl/file680367f6bea4network_3d.html
#> Warning: 'surface' objects don't have these attributes: 'marker'
#> Valid attributes include:
#> '_deprecated', 'autocolorscale', 'cauto', 'cmax', 'cmid', 'cmin', 'coloraxis', 'colorbar', 'colorscale', 'connectgaps', 'contours', 'customdata', 'customdatasrc', 'hidesurface', 'hoverinfo', 'hoverinfosrc', 'hoverlabel', 'hovertemplate', 'hovertemplatesrc', 'hovertext', 'hovertextsrc', 'ids', 'idssrc', 'legendgroup', 'legendgrouptitle', 'legendrank', 'lighting', 'lightposition', 'meta', 'metasrc', 'name', 'opacity', 'opacityscale', 'reversescale', 'scene', 'showlegend', 'showscale', 'stream', 'surfacecolor', 'surfacecolorsrc', 'text', 'textsrc', 'type', 'uid', 'uirevision', 'visible', 'x', 'xcalendar', 'xhoverformat', 'xsrc', 'y', 'ycalendar', 'yhoverformat', 'ysrc', 'z', 'zcalendar', 'zhoverformat', 'zsrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule', '_bbox'