Skip to content

selkamand/ggoncoplot

Repository files navigation

ggoncoplot

Lifecycle: experimental CRAN status Codecov test coverage R-CMD-check GitHub Issues or Pull Requests GitHub last commit

ggoncoplot creates interactive oncoplots from mutation level datasets

Installation

You can install the development version of ggoncoplot like so:

remotes::install_github('selkamand/ggoncoplot')

Usage

For complete usage, see manual

Input

The input for ggoncoplot is a data.frame with 1 row per mutation in cohort and columns describing the following:

  • Gene Symbol

  • Sample Identifier

  • (optional) mutation type

  • (optional) tooltip (character string: what we show on mouse hover over a particular mutation)

These columns can be in any order, and named anything. You define the mapping of your input dataset columns to the required features in the call to ggoncoplot

Basic Example

library(ggoncoplot)

# TCGA GBM dataset from TCGAmuations package
gbm_csv <- system.file(package='ggoncoplot', "testdata/GBM_tcgamutations_mc3_maf.csv.gz")
gbm_df <- read.csv(file = gbm_csv, header=TRUE)

gbm_df |> 
  ggoncoplot(
    col_genes = 'Hugo_Symbol', 
    col_samples = 'Tumor_Sample_Barcode', 
    col_mutation_type = 'Variant_Classification', 
    topn = 10, 
    interactive = FALSE
  )
#> 
#> ── Identify Class ──
#> 
#> ℹ Found 7 unique mutation types in input set
#> ℹ 0/7 mutation types were valid PAVE terms
#> ℹ 0/7 mutation types were valid SO terms
#> ℹ 7/7 mutation types were valid MAF terms
#> ✔ Mutation Types are described using valid MAF terms ... using MAF palete

Add marginal plots

gbm_df |> 
  ggoncoplot(
    col_genes = 'Hugo_Symbol', 
    col_samples = 'Tumor_Sample_Barcode', 
    col_mutation_type = 'Variant_Classification', 
    topn = 10, 
    draw_gene_barplot = TRUE, 
    draw_tmb_barplot = TRUE,
    interactive = FALSE
  )
#> 
#> ── Identify Class ──
#> 
#> ℹ Found 7 unique mutation types in input set
#> ℹ 0/7 mutation types were valid PAVE terms
#> ℹ 0/7 mutation types were valid SO terms
#> ℹ 7/7 mutation types were valid MAF terms
#> ✔ Mutation Types are described using valid MAF terms ... using MAF palete
#> ! TMB plot: Ignoring `col_mutation_type` since `log10_transform = TRUE`.
#> This is because you cannot accurately plot stacked bars on a logarithmic scale

Add clinical metadata

gbm_clinical_csv <- system.file(package = "ggoncoplot", "testdata/GBM_tcgamutations_mc3_clinical.csv")
gbm_clinical_df <- read.csv(file = gbm_clinical_csv, header = TRUE)

gbm_df |> 
  ggoncoplot(
   col_genes = "Hugo_Symbol",
   col_samples = "Tumor_Sample_Barcode",
   col_mutation_type = "Variant_Classification",
   metadata = gbm_clinical_df,
   cols_to_plot_metadata = c('gender', 'histological_type', 'prior_glioma', 'tumor_tissue_site'),
   draw_tmb_barplot = TRUE, 
   draw_gene_barplot = TRUE, 
   show_all_samples = TRUE,
   interactive = FALSE
  )
#> ℹ 2 samples with metadata have no mutations. Fitering these out
#> ℹ To keep these samples, set `metadata_require_mutations = FALSE`. To view them in the oncoplot ensure you additionally set `show_all_samples = TRUE`
#> → TCGA-06-0165-01
#> → TCGA-06-0167-01
#> 
#> ── Identify Class ──
#> 
#> ℹ Found 7 unique mutation types in input set
#> ℹ 0/7 mutation types were valid PAVE terms
#> ℹ 0/7 mutation types were valid SO terms
#> ℹ 7/7 mutation types were valid MAF terms
#> ✔ Mutation Types are described using valid MAF terms ... using MAF palete
#> ! TMB plot: Ignoring `col_mutation_type` since `log10_transform = TRUE`.
#> This is because you cannot accurately plot stacked bars on a logarithmic scale
#> 
#> ── Plotting Sample Metadata ────────────────────────────────────────────────────
#> ! Categorical columns must have <= 6 unique values to be visualised. Columns with too many unique values:  (20),  (388), and  (388)
#> 
#> ── Sorting
#> ℹ Sorting X axis by: Order of appearance
#> 
#> ── Generating Plot
#> ℹ Found 4 plottable columns in data

Acknowledgements

We acknowledge the developers and contributors whose packages and efforts were integral to the development of ggoncoplot:

  • David Gohel for the ggiraph package, which enables the interactivity of ggoncoplot.
  • Thomas Lin Pedersen for his contributions to the patchwork package and the maintenance of ggplot2.
  • Hadley Wickham and all contributors to the ggplot2 package, which provides a robust foundation for data visualization in R.

Additionally, we thank Dr. Marion Mateos for her insightful feedback during the early stages of ggoncoplot development.

Community Contributions

Contribute to the Software

There are many ways to contribute to ggoncoplot.

  1. Request features you would like to by creating new issues on github
  2. Make your visualisation packages ggoncoplot-compatible
  3. Directly contribute to the ggoncoplot codebase

Make your visualisation packages ggoncoplot-compatible

If your package produces ggplots that you would like to interactively link with ggoncoplot, consider converting your geoms to their ggiraph interactive equivalents and adding a data_id based on a sample identifier column in the dataset. That way end-users can create a data-linked oncoplot composed with your packages plots using patchwork (example)

Directly contribute to the ggoncoplot codebase

We welcome contributions from the community to enhance and expand the functionality of ggoncoplot. Whether you want to fix a bug, add new features, improve documentation, or optimize performance, your efforts are highly valued. To get started:

  1. Fork the Repository: Click on the ‘Fork’ button at the top right of this page to create a copy of the repository in your GitHub account.

  2. Clone the Repository: Use git clone to clone your forked repository to your local machine.

    git clone https://github.com/selkamand/ggoncoplot.git
  3. Create a Branch

    git checkout -b feature-name
  4. Make Changes: Implement your changes in the new branch

  5. Commit and Push: Commit your changes and push the branch to your forked repository.

  6. Create a Pull Request: Go to the original repository and open a pull request from your branch. Please provide a clear description of your changes and any relevant issues or discussions.

Report Issues or Problems with the Software

If you encounter any issues, bugs, or have suggestions for improvements, please report them using the GitHub Issues Tab.

Seek Support

For any questions or support regarding the use of ggoncoplot you can:

  • Check the Documentation: Comprehensive documentation is available here.

  • Create a new issue with your query.

  • Browse Existing Issues: Check the Issues page to see if your query has been addressed.

  • Contact Us: If you need direct assistance, please contact the maintainers directly

About

Easily Create Interactive Oncoplots

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published