-
Notifications
You must be signed in to change notification settings - Fork 76
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
Fixed some bugs in Manhattan plotting #47
base: master
Are you sure you want to change the base?
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
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())): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This for-loop enables the annotator iterates all the chromosome, so that it won't only mark the first chromosome.
@@ -631,7 +634,7 @@ def mhat(df="dataframe", chr=None, pv=None, log_scale=True, color=None, dim=(6,4 | |||
df['tpval'] = df[pv] | |||
# 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] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'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.
@@ -681,7 +682,7 @@ def mhat(df="dataframe", chr=None, pv=None, log_scale=True, color=None, dim=(6,4 | |||
else: | |||
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.