I'm trying to generate ManhattanPlot using Dash-plotly library for python: https://dash.plotly.com/dash-bio/manhattanplot
I have SNP results data for plants like wheat which have chromosome names with letters e.g. 3A, 3B, 3D.
Is is possible to handle such identifiers (with letter suffixes) in plotly/python?
In the documentation there is the following remark about chromosome id:
chrm (string; default 'CHR'): A string denoting the column name for the chromosome. This column must be float or integer. Minimum number of chromosomes required is 1. If you have X, Y, or MT chromosomes, be sure to renumber these 23, 24, 25, etc.
I have data for many plant genomes which contain letters in chromosome names. It seems that CHR column can't have string values which is strange from the user perspective.
This looks like an unfortunate case where the developer of the
dashbio.ManhattanPlot
object made an assumption about thechrm
parameter.Looking through
_manhattan.py
in thedash-bio
repository, you can start by commenting out these lines so that theCHRM
column isn't required to be numerical.EDIT: the other changes were updating
self.ticksLabels
to be strings instead of integers, and increasing the threshold from 10 to 20 ticks when deciding when to display every other ticklabel instead of all ticklabels. I've included my local version of_manhattan.py
file below:Then, I modified the plotly-dash example here to use a modified
df
where the"CHR"
column has string values like"1A","1B",..."9A","9B"
instead of integers, and tested that the Dash app renders these strings correctly.