Skip to contents

Installation

You can install the development version of sunburst like so:

# install.packages("remotes")
remotes::install_github("selkamand/sunburst")

Usage

Build Microbial Sunbursts

Want to visualise microbial composition? See microbial sunbursts vignette

General usage

Load library

Load data

Input data is a character vector of ‘lineages’. The segment size of sunburst is related to the frequency of each lineage in the input vector.


lineages <- c(
  "Cancer Cohort>HM>BALL", "Cancer Cohort>HM>BALL", "Cancer Cohort>HM>BALL",
  "Cancer Cohort>HM>TALL", "Cancer Cohort>HM>TALL", "Cancer Cohort>HM>AML",
  "Cancer Cohort>HM>AML>CBF", "Cancer Cohort>HM>AML>CBF", "Cancer Cohort>HM>AML>M7-AML",
  "Cancer Cohort>ST>NBL", "Cancer Cohort>ST>NBL", "Cancer Cohort>ST>NBL",
  "Cancer Cohort>ST>NBL", "Cancer Cohort>ST>NBL", "Cancer Cohort>ST>NBL",
  "Cancer Cohort>ST>NBL", "Cancer Cohort>ST>NBL", "Cancer Cohort>ST>WLM", 
  "Cancer Cohort>ST>WLM", "Cancer Cohort>ST>WLM", "Cancer Cohort>ST>WLM",
  "Cancer Cohort>ST>OS", "Cancer Cohort>ST>OS", "Cancer Cohort>ST>EWS",
  "Cancer Cohort>ST>EWS", "Cancer Cohort>BT>MB","Cancer Cohort>BT>MB",
  "Cancer Cohort>BT>MB", "Cancer Cohort>BT>MB", "Cancer Cohort>BT>MB>G4",
  "Cancer Cohort>BT>MB>G3","Cancer Cohort>BT>MB>HGG"
)

Build sunburst plot

Sunburst from network style dataframe

Data Input

Instead of building your sunburst from lineage strings, you might want something more congruent with you’re network-analysis compatible dataframes.

You can build a sunburst from a dataframe you explicitly list every label-parent pair and the value associate (dictates sunburst segment size). For example the same sunburst as above can be produced using the following table

data=data.frame(
  Label = c(
    "ST", "HM", "NBL", "BT", "MB", "AML", 
    "WLM", "BALL", "CBF", "EWS", "OS", 
    "TALL", "G3", "G4", "HGG", "M7-AML"
    ),
  Parent = c(
    "Cancer Cohort", "Cancer Cohort", "ST", "Cancer Cohort", 
     "BT", "HM", "ST", "HM", "AML", "ST", "ST", "HM", "MB", 
    "MB", "MB", "AML"
    ),
  Value = c(16, 9, 8, 7, 7, 4, 4, 3, 2, 2, 2, 2, 1, 1, 1, 1)
)

Build Sunburst

sunburst(data = data)

Acknowledgements

The engine driving the functionality of this package is plotly packages. A big thanks to all involved in the creation and maintenance of these packages.