Repository navigation
feat(manhattan): support string chromosome columns ('X', 'Y', 'MT') - #782
Open
thanvish21 wants to merge 1 commit into
Open
thanvish21 wants to merge 1 commit into
thanvish21 wants to merge 1 commit into
Conversation
Closes plotly#772. Previously ManhattanPlot raised TypeError when the chrm column had a non-numeric dtype, forcing users to manually recode 'X', 'Y', and 'MT' chromosomes to integers. This change: - Removes the TypeError that rejected string chrm columns. - Adds canonical genomic sort order (1–22, X, Y, MT) for string chromosome labels via _CHR_SORT_ORDER and a stable sort key, so x-axis ticks always appear in biological order regardless of the order rows appear in the dataframe. - Keeps INDEX as int regardless of chrm dtype so positional arithmetic works correctly for string chrm columns. - Fixes crowded-label suppression (>10 chromosomes) which previously called int(t) on each label—crashing for string chromosomes—replaced with an index-based modulo check. - Fixes trace name formatting (%i → scalar element) in both the single-chromosome and multi-chromosome figure paths. - Updates docstrings to reflect that string chrm columns are supported. - Adds tests/unit/test_manhattan_plot.py with 7 unit tests covering the new behaviour and numeric-chromosome regression. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Thanks for the PR! This repo needs some work before we can even review this. It's in progress, but this will have to remain open and unreviewed until we get the infrastructure for CI working again. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #772.
Currently
ManhattanPlotraisesTypeErrorwhen thechrmcolumn is non-numeric, forcing users to manually recode'X','Y', and'MT'chromosomes to integers. This matters for:2L,2R,3L,3R)Changes
TypeErrorthat rejected stringchrmcolumns — string columns are now first-class citizens.1–22, X, Y, MT) is applied to string chromosome labels via_CHR_SORT_ORDERand a stable sort key so x-axis ticks always appear in biological order.INDEXcolumn kept asintregardless ofchrmdtype, so positional arithmetic works correctly for string columns (previously it was cast back to the original dtype, which broke positional sums for strings).int(t), which crashed for string labels.%i→ scalar element extracted with[0]).tests/unit/test_manhattan_plot.pycovering:Before / After
🤖 Generated with Claude Code