selkamand / ggoncoplot

Easily Create Interactive Oncoplots
https://selkamand.github.io/ggoncoplot/
Other
3 stars 0 forks source link

On click copy sample ID to clipboard #17

Closed selkamand closed 8 months ago

selkamand commented 2 years ago

ggiraph supports running javascript on click events (without shiny)

See below for details https://davidgohel.github.io/ggiraph/articles/offcran/using_ggiraph.html#using-onclick-1

One typically annoying thing about oncoplots is seeing interesting samples and having to copy out sample IDs. It would be more convenient to just click the id and automatically copy the sample name.

In javascript, you can write text to clipboard

navigator.clipboard.writeText('text')

Could fire this on an onclick event

selkamand commented 8 months ago

There are several things we might want to copy to clipboard on click

1) the full tooltip contents 2) the sample ID 3) the gene name 4) something custom

I think custom copying of something other than the tooltip will be a fairly rare use-case, so we should add an argument copy = c('sample', 'tooltip', 'gene', 'mutation_type', 'nothing') that allows users to choose what to write to clipboard