broadinstitute / dig-diabetes-portal

Diabetes portal for the Medical Population Genetics department at the Broad Institute
type2diabetesgenetics.org
5 stars 5 forks source link

[bugfix] Some dataset tooltips do not render to values #166

Closed abought closed 4 years ago

abought commented 6 years ago

Summary

Some portal dataset tooltips show code rather than values- see example. screen shot 2018-10-03 at 5 19 48 pm

This most often happens for phenotypes that contain special characters, like hyphens.

Details

When multiple datasets are in use, the plot uses namespaces to locate the correct data. LocusZoom has certain rules for syntax, and only allows limited sets of characters to be used for namespaces. (see regex, alphanumeric + underscores).

Speculative fix

I do not have a running instance, but the following may help:

Change the portal datasource creation code to remove special characters.

var source_name = phenotype.replace(/[^A-Za-z0-9_]/g, "")
dataSources.add(source_name, new broadAssociationSource(geneGetLZ, rawPhenotype,dataSetName,propertyName,makeDynamic));

You will then need to update layouts to reference the new namespace name correctly (lines of the form {namespace: { thing1: thing2 }}- here is one; there are probably others).

benralexander commented 6 years ago

Seems like a good idea, Andy. We will explore further.

On Wed, Oct 3, 2018 at 5:40 PM Andy Boughton notifications@github.com wrote:

Summary

Some portal dataset tooltips show code rather than values- see example. [image: screen shot 2018-10-03 at 5 19 48 pm] https://user-images.githubusercontent.com/2957073/46440157-8d6eb300-c730-11e8-8dc6-81300f33fa1e.png

This most often happens for phenotypes that contain special characters, like hyphens. Details

When multiple datasets are in use, the plot uses namespaces to locate the correct data. LocusZoom has certain rules for syntax, and only allows limited sets of characters to be used for namespaces. (see regex https://github.com/statgen/locuszoom/blob/c4b0be2d5f36416536739b8bcdc322d8f67cf78c/assets/js/app/Layouts.js#L64, alphanumeric + underscores). Speculative fix

I do not have a running instance, but the following may help:

Change the portal datasource creation https://github.com/broadinstitute/dig-diabetes-portal/blob/c2b8dcffa7977b42e072e8efdf4d0850e5e5b355/web-app/js/lib/dport/locusZoomPlot.js#L1690 code to remove special characters.

var sourcename = phenotype.replace(/[^A-Za-z0-9]/g, "") dataSources.add(source_name, new broadAssociationSource(geneGetLZ, rawPhenotype,dataSetName,propertyName,makeDynamic));

You will then need to update layouts to reference the new namespace name correctly (lines of the form {namespace: { thing1: thing2 }}- here is one https://github.com/broadinstitute/dig-diabetes-portal/blob/c2b8dcffa7977b42e072e8efdf4d0850e5e5b355/web-app/js/lib/dport/locusZoomPlot.js#L1199; there are probably others).

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/broadinstitute/dig-diabetes-portal/issues/166, or mute the thread https://github.com/notifications/unsubscribe-auth/AA_6eiLo4b3w9gG2FzNSvSRg57Ef_uhKks5uhS7TgaJpZM4XG_Sm .

abought commented 6 years ago

Thanks, Ben.

To make things easier, the next LZ.js release will add a warning message for situations like this: https://github.com/statgen/locuszoom/commit/82c4422c675e822f2416bd3051e30c39475f9abc

For now we will only warn, in order to avoid breaking sites like the portal. In later versions I would expect LZ.js to throw an error instead.