wiggleplotr icon indicating copy to clipboard operation
wiggleplotr copied to clipboard

Coloring exons

Open mikelove opened this issue 9 months ago • 2 comments

Hi Kaur,

In the lab, we are finding this package to be just what we need for some project.

Would you consider a PR where we add the ability to color individual exons, or all exons of a transcript, with a custom color?

Maybe we can have a short call where you give some pointers and we can give it a shot.

thanks! Mike

mikelove avatar Apr 26 '25 12:04 mikelove

Hi Mike,

Thanks for reaching out! I'm a bit reluctant to add new functionality to the official wiggleplotr package as I am worried about additional maintenance burden (this package has been very low maintenace for the past couple of years, which is probably the main reason why it has not dropped out of Bioconductor yet). Furthermore, the plotting code in wiggleplotr is basically just vanilla ggplot2 and I think the most sustanable way to make custom visualisations is to replace the ggplot2 code directly rather than adding additional parameters to the wiggplotr functions.

That being said, in the most recent refactoring I tried to separate the data munging code from the plotting code to make it easier to build custom visualisations.

The main plotCoverage function (https://github.com/kauralasoo/wiggleplotr/blob/master/R/wiggleplotr.R#L147C1-L148C1) is a wrapper around extractCoverageData and plotCoverageData, both of which are exported from wiggleplotr.

plotCoverageData (https://github.com/kauralasoo/wiggleplotr/blob/master/R/wiggleplotr.R#L369) is further a wrapper function around prepareTranscriptStructureForPlotting, plotTranscriptStructure and makeCoveragePlot. These three functions are currently not exported, but if they where, then perhaps you could re-use the existing extractCoverageData function to prepare the data and then write a custom version of the plotCoverageData function to modify what you need? I think you would probably only need to overload the plotTranscriptStructure function.

How does this sound? Best, Kaur

kauralasoo avatar May 06 '25 18:05 kauralasoo

Understand 100% about maintenance burden. And thanks for putting the package together and keeping it going.

Got it. We will take a look and see if we can do this all with exported functions or if adding prepareTranscriptStructureForPlotting, plotTranscriptStructure, makeCoveragePlot to exports would be required.

@beamimc

mikelove avatar May 06 '25 18:05 mikelove