Skip to content

Fixed some bugs in Manhattan plotting - #47

Open
li-liwen wants to merge 1 commit into
reneshbedre:masterfrom
li-liwen:master
Open

Fixed some bugs in Manhattan plotting#47
li-liwen wants to merge 1 commit into
reneshbedre:masterfrom
li-liwen:master

Conversation

@li-liwen

Copy link
Copy Markdown
  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 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
Comment thread bioinfokit/visuz.py
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())):

Copy link
Copy Markdown
Author

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.

Comment thread bioinfokit/visuz.py
# 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]

Copy link
Copy Markdown
Author

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.

Comment thread bioinfokit/visuz.py
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)

Copy link
Copy Markdown
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant