Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporary hack to load GFAs containing more than 256 paths #1

Merged
merged 1 commit into from
Jul 25, 2023

Conversation

blinard-BIOINFO
Copy link

@blinard-BIOINFO blinard-BIOINFO commented Jul 24, 2023

@Tharos-ux : bug observed by Daria.

Using  get_palette() from mathplotlib_tools.py generates a crash when trying to load a GFA with more than 256 paths.

Indeed, this function returns a palette bounded by :

number_of_colors = min(colormap.N, number_of_colors)

Problem: N=256 by default in the colormap constructor, which is instantiated before this line via an eval function. As a results, the min is always 256 and GFAs with more than 256 paths will crash the gfagraphs GFA parser.

Temporary fix in this PR: a manual instanciationof a Colormap is followed by the build of the palette, reproducing a few lines from get_palette().

Long term fix? : the GFA parser mixes concepts of parsing and visualisation. The latter should probably be separated and plotting operations should be split from file related operations. (mathplotlib should not be involved when only trying to load GFAs).

@dubssieg dubssieg added the bug Something isn't working label Jul 25, 2023
@dubssieg
Copy link
Owner

The problem here is the NetworkX structure was originaly purely intended as the backbone for visualisation. With that in mind, GFA parser and visualisation are already not connected.
However, this will be worked on, and separation will me made clearer in a near future.

Thanks for contributing.
Merge request will be accepted until I can work on it.

@dubssieg dubssieg merged commit 2874703 into dubssieg:gfagraphs Jul 25, 2023
@dubssieg dubssieg self-assigned this Jul 25, 2023
@dubssieg
Copy link
Owner

Specific issue with palette fixed with commit dubssieg/tharos-pytools@1ae094c. Long-term fix will be kept in mind as developpment goes on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants