Bug when anndata with non string values in obs used to initialize wgcna object#137
Open
JShermanK1 wants to merge 10 commits intomortazavilab:mainfrom
Open
Bug when anndata with non string values in obs used to initialize wgcna object#137JShermanK1 wants to merge 10 commits intomortazavilab:mainfrom
JShermanK1 wants to merge 10 commits intomortazavilab:mainfrom
Conversation
…str coercion" This reverts commit ffd2aff.
…olor is a list of RGB values and n is a numpy numeric
…in index simplified creation of df and cat in barplot changed instances of pallet to palette to match other instances
reintroduce sorting df by "all" column instansiate xdot and ydot directly and remove intermediate dataframe use cat["all"] directly for ind
…ith text clipping
Contributor
|
A lot of changes here, I did not clone the entire fork. But I copied the primary changes and the changes work for me. I tested the following that worked:
|
This was referenced Aug 21, 2025
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.
Hello,
Thank you for all the effort in making the PyWGCNA package, I frequently find it useful. That said, I encountered an error when including a column of integer values (timepoint) in the anndata.obs that I used to initialize the WGCNA object. When
WGCNA.analyzeWGCNA()is called I get an error:I found that this occurs because the use of
color = np.where(color == n, self.metadataColors[m][n], color).colorstarts as a numpy array of int, but when some of the values are replaced with the string values of the colors frommetadataColors, the entire array is coerced to str type, which causes subsequent comparisons ton(an integer) to all be false.I also hit a snag with
elif type(colorBar) == dict:which causes allmetadataColorsto be treated as aScalarMappable, but once I fixed that and cleaned up a few other things, I believe I was able to get everything working the way I expect, so I made this pull request. I don't have much experience with public pull requests, so if I'm missing anything please let me know.Best regards,
John Sherman