Fixed some bugs in Manhattan plotting - #47
Open
li-liwen wants to merge 1 commit into
Open
Conversation
li-liwen
commented
Apr 17, 2022
- Sorting problem when 'chr' column cannot be converted into numbers;
- Unable to change font name and size of tick labels;
- Unable to annotate all the dots higher than 'gwasp' when 'markernames' are set True
1. Sorting problem when chr column cannot be converted into numbers; 2. Unable to change font name and size of tick labels; 3. Unable to annote all the dots higher than gwasp when markernames=True
li-liwen
commented
Apr 17, 2022
| xycoords='data', xytext=(5, -15), textcoords='offset points', size=6, | ||
| bbox=dict(boxstyle="round", alpha=0.2), | ||
| arrowprops=dict(arrowstyle="wedge,tail_width=0.5", alpha=0.2, relpos=(0, 0))) | ||
| for j in range(len(df[chr].unique())): |
Author
There was a problem hiding this comment.
This for-loop enables the annotator iterates all the chromosome, so that it won't only mark the first chromosome.
li-liwen
commented
Apr 17, 2022
| # df = df.sort_values(chr) | ||
| # if the column contains numeric strings | ||
| df = df.loc[pd.to_numeric(df[chr], errors='coerce').sort_values().index] | ||
| df = df.loc[pd.to_numeric(df[chr], errors='ignore').sort_values().index] |
Author
There was a problem hiding this comment.
'coerce' will produce nan if not convertible, while ignore will maintain the input. This change from makes the column still sortable even if it cannot be converted to numbers. If the column isn't sorted, it will result in color problem in the plot.
li-liwen
commented
Apr 17, 2022
| ylm = np.arange(0, max(df['tpval']+1), 1) | ||
| ax.set_yticks(ylm) | ||
| ax.set_xticklabels(xlabels, rotation=ar) | ||
| ax.set_xticklabels(xlabels, fontsize=axtickfontsize, fontproperties=axtickfontname, rotation=ar) |
Author
There was a problem hiding this comment.
This enables the caller to change font name and font size of tick labels, which is especially useful when the labels is in another language.
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.