Code Monkey home page Code Monkey logo

g3viz's Introduction

G3viz: an R package to interactively visualize genetic mutation data using a lollipop-diagram

Date: 2022-06-30

Build Status CRAN_version CRAN_monthly_download

Live demo

Introduction

Intuitively and effectively visualizing genetic mutation data can help researchers to better understand genomic data and validate findings. G3viz is an R package which provides an easy-to-use lollipop-diagram tool. It enables users to interactively visualize detailed translational effect of genetic mutations in RStudio or a web browser, without having to know any HTML5/JavaScript technologies.

The features of g3viz include

  • Interactive (zoom & pan, tooltip, brush selection tool, and interactive legend)
  • Highlight and label positional mutations
  • 8 ready-to-use chart themes
  • Highly customizable with over 50 chart options and over 35 color schemes
  • Save charts in PNG or high-quality SVG format
  • Built-in function to retrieve protein domain information and resolve gene isoforms
  • Built-in function to map genetic mutation type (a.k.a, variant classification) to mutation class

Install g3viz

Install from R repository

# install package
install.packages("g3viz", repos = "http://cran.us.r-project.org")

or install development version from github

# Check if "devtools" installed
if("devtools" %in% rownames(installed.packages()) == FALSE){ 
  install.packages("devtools")
}

# install from github
devtools::install_github("g3viz/g3viz")

Reference

Guo, X., et al. (2020). G3viz: an R package to interactively visualize genetic mutation data using a lollipop-diagram. Bioinformatics, 36(3), 928-929.

What's new

1.1.5

  • Updated getMutationsFromCbioportal (date: 2022-06-23)
  • Remove Dependency cgdsr; Add Dependency cBioPortalData (date: 2022-06-23)
  • Updated hgnc2pfam.df.rda (date: 2022-06-24)

g3viz's People

Contributors

phoeguo avatar zhangrener avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

g3viz's Issues

Pfam database is outdated

Hi,

Your "hgnc2pfam.rdb" is completely outdated, and so all lollipops mutations don't match correctly.
It would be nice to update it, or in a more reliable and sustainable way, permit the user to query his own database or directly the Pfam website.

Otherwise, you did a nice and beautiful job to build this library !

Hope this message will reach you.

A fellow researcher.

Is it possible to explicitly specify the color of a domain?

Hi, Dr. Guo,

thank you for your helpful package. We are using it a lot and really appreciate it!

I have one question regarding the domain color: is it possible to manually specify the color of domains? E.g. I would like to color each domain of a gene red.

If it is not possible in R directly, can I change some settings in g3lollipop.js to achieve this?

g3lollipops are stacked instead of replaced inside a Shiny g3LollipopOutput() element

HTML widgets don't get recycled when rendering g3viz plots inside a Shiny application. Please run the attached code snippet to verify its behaviour.

library(g3viz)

mutation.csv <- system.file("extdata", "ccle.csv", package = "g3viz")
selectize_values <- function(){
    return(levels(read.csv(mutation.csv, header = T)$Hugo_Symbol))
}


ui <- fluidPage(
    titlePanel("g3lollipop test"),
    sidebarLayout(
        sidebarPanel(
            selectizeInput("gene", "Elija un gen de la muestra", selectize_values())
        ),
        mainPanel(
            g3LollipopOutput("distPlot",width = "800px")
        )
    )
)

server <- function(input, output, session) {

    
    output$distPlot <- renderG3Lollipop({
    
        mutation.dat <- readMAF(mutation.csv,
                                gene.symbol.col = "Hugo_Symbol",
                                variant.class.col = "Variant_Classification",
                                protein.change.col = "amino_acid_change",
                                sep = ",")  # column-separator of csv file
        
        gene <- input$gene
        theme <- g3Lollipop.theme(theme.name = "cbioportal",
                         title.text = paste0(gene, " gene"),
                         y.axis.label = paste0("# of ", gene, " Mutations"))
        theme[['chartWidth']] <- "1600"
        
        g3Lollipop(mutation.dat,
                   gene.symbol = gene,
                   protein.change.col = "amino_acid_change",
                   plot.options = theme,
                   btn.style = "gray", 
                   output.filename = "customized_plot")
        
    })
}
shinyApp(ui = ui, server = server)

In this screenshot the unexpected behaviour is shown: after selecting two times a different gene, the second plot is created below the first one, instead of replacing it.

My current sessionInfo() is as follows:

R version 3.6.0 (2019-04-26)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 19.1

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=es_AR.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=es_AR.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=es_AR.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] g3viz_1.1.1 shiny_1.3.1

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.1        rstudioapi_0.10   magrittr_1.5      xtable_1.8-3      R6_2.4.0         
 [6] rlang_0.3.4       stringr_1.4.0     tools_3.6.0       packrat_0.5.0     R.oo_1.22.0      
[11] htmltools_0.3.6   yaml_2.2.0        digest_0.6.18     crayon_1.3.4      cgdsr_1.2.10     
[16] later_0.8.0       htmlwidgets_1.4   promises_1.0.1    mime_0.6          stringi_1.4.3    
[21] compiler_3.6.0    R.methodsS3_1.7.1 jsonlite_1.6      httpuv_1.5.1

Saving as .png or .pdf directly

Hello!

First of all, great tool! Very intuitive and easy to use. I have a quick naive question: Is it possible to save as a .png or other formats such as .pdf directly, without printing out rendered figures and having to click on the save buttons? I checked the introduction tutorial page, but I couldn't find the answer I was looking for.

Best,
Yuka

"auto" option for chart.width parameter

As, writen in the documation, g3viz::g3Lollipop.options(chart.width= 800) parameter can contain only numeric values that represent pixels. Would that be possible to add option for "auto", "full_width", "100%" or similar to automatically scale the chart size?

colors of mutation classes

Hi!
lovely package. Is it possible to make that across different genes, the colors for the mutation classes are the same? currently, I have for some genes, yellow for missense, red for truncating, and black for inframe, but sometimes black is truncating. I would like the legend to be consistent.
thanks

Adding variant classifications

Hello,

I am using readMAF to read in a csv file from the latest CCLE mutation files and noticed there were two classes that are not currently classified: Stop_Codon_Del, Stop_Codon_Ins (see warning message below).

Would it be possible to add these in the next release?

Warning message:
In mapMutationTypeToMutationClass(maf.df[, variant.class.col], mutation.type.to.class.df) :
  Unknown variant classification: Stop_Codon_Del, Stop_Codon_Ins, 

Best,
Yuka

Is G3viz sutible for non-human species?

I want to present my mutation list with G3viz. The input file is formated like example file "ccle.csv" and can be read by readMAF.

The program promotes "Error in hgnc2pfam(hgnc.symbol = gene.symbol, uniprot.id = uniprot.id) :
geneX has no uniprot mappings (wrong name or non-protein-coding gene)."

For non-human species, how can I adjust G3viz?

Help with background color

Hi guys, I am new to R programming. I have made my g3viz lollipop using the blue theme. I like everything about my lollipop except for the blue background. I was wondering if there is anyway to make the background white.

Thank you

Screen Shot 2021-04-20 at 3 35 03 PM

Set symbol/shape type for lollipops

Is there a way to set e.g. truncating variants to be circles (default shape) and missense to be squares, etc? It would be more friendly to color-blind people vs. relying on colors only.

About optimal presentation

Hi, Dr. Guo,

I just emailed you about the question several days ago. When I compared the lolllipop results from your nice tool, g3viz, and cBioPortal website, I found that the domain names on g3viz lollipop didn't appear as I put the mouse on them. I had saved the result plot as a html file, and used R 3.6.2 and g3viz 1.3.3.

Hope you can handle this as soon as posible to make the g3viz more user-friendly.

Fei Quan

Is there any way to plot y value as another value?

Hello, Dr.Guo
first, thanks for developing this useful package!

In my case, I want to use 'variant allele fraction' as a y value instead of '# of mutations in gene'
is there any way to change the y position in the recent version?

thanks to read!

Is there any example TSV data for testing the package?

I'm trying to use the guide to generate plots from a tsv file. The first command for reading tsv files read my file as an empty file, i.e.: "". I'm not sure what I'm doing wrong. Could you please provide a test tsv file so I can start from there and modify it to make my input? My tsv file contains three columns: Hugo_Symbol Variant_Classification amino_acid_change

The command I used: mutation.tsv <- system.file("extdata", "myfile.tsv", package = "g3viz")

Thank you!

g3Lollipop() not working - (R-3.6.1/R3.5.3 - Ubuntu18.04)

Hi!
Really useful package! but I can't make the g3Lollipop() function to work on a Linux-based system, (while I tried it on a MacOS based one and it works perfectly!)
The plottting area in Rstudio remains white, it only displays the buttons for saving the image, but no action happens when pressing these buttons and no error is raised at all
hgnc2pfam() on the other hand works perfectly

I've tried with R-3.6.1 and R-3.5.3, and had the same situation

Could you check what may be wrong?
Thank you very much!

This is my session info:

sessionInfo()
R version 3.5.3 (2019-03-11)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.3 LTS

Matrix products: default
BLAS: /opt/R/3.5.3/lib/R/lib/libRblas.so
LAPACK: /opt/R/3.5.3/lib/R/lib/libRlapack.so

locale:
[1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8
[5] LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 LC_PAPER=en_GB.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] knitr_1.26 kableExtra_1.1.0 g3viz_1.1.2

loaded via a namespace (and not attached):
[1] Rcpp_1.0.3 pillar_1.4.2 compiler_3.5.3 R.methodsS3_1.7.1 tools_3.5.3 zeallot_0.1.0
[7] digest_0.6.22 jsonlite_1.6 evaluate_0.14 tibble_2.1.3 viridisLite_0.3.0 pkgconfig_2.0.3
[13] rlang_0.4.1 rstudioapi_0.10 yaml_2.2.0 xfun_0.11 cgdsr_1.3.0 stringr_1.4.0
[19] httr_1.4.1 xml2_1.2.2 vctrs_0.2.0 htmlwidgets_1.5.1 hms_0.5.2 webshot_0.5.1
[25] glue_1.3.1 R6_2.4.0 rmarkdown_1.16 readr_1.3.1 magrittr_1.5 backports_1.1.5
[31] scales_1.0.0 htmltools_0.4.0 rvest_0.3.5 colorspace_1.4-1 stringi_1.4.3 munsell_0.5.0
[37] crayon_1.3.4 R.oo_1.23.0

cgdsr dependency

Hi -

This is Ino from the cBioPortal team. We are looking to retire cgdsr, but we see g3viz uses it quite a bit. How complex would it be to switch to using the new cBioPortalData package?

Option to use readMAF to parse data from a data frame instead of reading from a file

In some scenarios, the user may have a MAF already loaded into a data frame. This is the case for our workflows because MAF data is retrieved from a local database. I couldn't find an option to allow readMAF to process a data frame directly instead of relying on a file. I added this functionality but cannot create a pull request. I wonder if others might find this useful if added to the existing code:

@@ -46,24 +46,28 @@ readMAF <- function(maf.file,
                     mutation.type.to.class.df = NA,
                     sep = "\t",
                     quote = "",
+                    maf.df,
                     ...) {
-  if(missing(maf.file)){
-    stop("maf.file is missing")
+  if(missing(maf.file) & missing(maf.df)){
+    stop("maf.file and maf.dat are missing, you must provide one or the other")
   }
-
+
   # ===============================
   # TODO:
   # - check "Mutation_Status" as "Somatic"
   # ===============================
   # read data in
-  if(grepl(pattern = 'gz$', maf.file)){
-    suppressWarnings(
-      maf.df <- read.table(gzfile(description = maf.file), header = TRUE, sep = sep, quote = quote, ...)
-    )
-  } else {
-    maf.df <- read.table(maf.file, header = TRUE, sep = sep, quote = quote, ...)
+  if(missing(maf.df)){
+    if(grepl(pattern = 'gz$', maf.file)){
+      suppressWarnings(
+        maf.df <- read.table(gzfile(description = maf.file), header = TRUE, sep = sep, quote = quote, ...)
+      )
+    } else {
+      maf.df <- read.table(maf.file, header = TRUE, sep = sep, quote = quote, ...)
+    }
   }

+

"quote" argument should be made available to readMAF()

Hello, I am unable to load a MAF file from my customized pipeline that is quoted with "\"", because readMAF() doesn't allow me to specify the quote argument. Looking into the readMAF.R file, I can see that the argument is used by default with a value of "". This argument should be used as a default instead, allowing users to optionally specify it just like the sep argument.

Error: object ‘getDataByGenes’ is not exported by 'namespace:cBioPortalData'

Hi,

I was trying to install the package in RStudio and get an error (please see below). I have also attached my sessionInfo(). Is there anything else that I should be doing?

thanks!

==================

install.packages("g3viz")
Installing package into ‘/Users/pankajchopra/Library/R/4.0/library’
(as ‘lib’ is unspecified)

There is a binary version available but the source version is later:
binary source needs_compilation
g3viz 1.1.4 1.1.5 FALSE

installing the source package ‘g3viz’

trying URL 'https://cran.rstudio.com/src/contrib/g3viz_1.1.5.tar.gz'
Content type 'application/x-gzip' length 1879204 bytes (1.8 MB)

downloaded 1.8 MB

  • installing source package ‘g3viz’ ...
    ** package ‘g3viz’ successfully unpacked and MD5 sums checked
    ** using staged installation
    ** R
    ** data
    *** moving datasets to lazyload DB
    ** inst
    ** byte-compile and prepare package for lazy loading
    Error: object ‘getDataByGenes’ is not exported by 'namespace:cBioPortalData'
    Execution halted
    ERROR: lazy loading failed for package ‘g3viz’
  • removing ‘/Users/pankajchopra/Library/R/4.0/library/g3viz’
  • restoring previous ‘/Users/pankajchopra/Library/R/4.0/library/g3viz’
    Warning in install.packages :
    installation of package ‘g3viz’ had non-zero exit status

The downloaded source packages are in
‘/private/var/folders/wh/g8yjlv2j01xc6xs691xzt34h0000gn/T/RtmpoDQVgp/downloaded_packages’

sessionInfo()
R version 4.0.4 (2021-02-15)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS 12.6

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] bnlearn_4.8.3 processx_3.8.1 htmltools_0.5.5

loaded via a namespace (and not attached):
[1] BiocManager_1.30.20 compiler_4.0.4 fastmap_1.1.1 cli_3.6.1 parallel_4.0.4
[6] tools_4.0.4 rstudioapi_0.14 digest_0.6.31 ps_1.7.5 rlang_1.1.1

Highlighting a specific mutation & editing classification appearance

When loading CSV data is it possible to highlight specific mutations as a seperate categories within the lollipop plot.

See below for example:
image

Here I went into the html output manually & changed the Mutation_class attribute for this mutation specifically- however is there a way to do this programatically within g3viz?

Additionally- is there a way to configure the appearance of specific classifications? I.e. make the "Weee - Waa" classed variants a specific colour or slightly bigger?

Loving the tool & looking forward to expanding my understanding & usage of it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.