plotly / dash-bio

Open-source bioinformatics components for Dash
https://dash-gallery.plotly.host/Portal/?search=Bioinformatics
MIT License
529 stars 194 forks source link

Small bug in dash-bio/dash_bio/component_factory/_manhattan.py #720

Open jonpey opened 1 year ago

jonpey commented 1 year ago

Dear all,

I would like to report a small bug in the "dash-bio/dash_bio/component_factory/_manhattan.py" function:

In particular, the non-highlighted genes show some inconsistencies in the hovers (e.g.the printed name). A very direct way to spot this error is by checking the hover of the first gene of each chromosome, if this is not "highlighted", it will always be the same, from the example in https://plotly.com/python/manhattan-plot/

Chromosome 1: image

Chromosome 3:

image

As far as I can see, there might be a small bug in the code. Particularly, lines 568-573 includes the following code, it looks like the "data" should be indeed substituted by "tmp":

hover_text = _get_hover_text( data, snpname=self.snpName, genename=self.geneName, annotationname=self.annotationName )

My proposal here is to replace data by tmp, as shown when defining the hover for highlighted genes (lines 470-475):

highlight_hover_text = _get_hover_text( tmp, snpname=self.snpName, genename=self.geneName, annotationname=self.annotationName )

Thanks in advance,

martian-yan commented 1 year ago

I noticed this bug as well. It seems all the non-highlighted plots are showing the hover text from the data in CHR 1. Thanks for the solution!