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

Is that possible to add option of barplot number annotation for oncoplots #77

Open
Alexander17Z opened this issue Feb 3, 2025 · 3 comments
Labels
enhancement New feature or request

Comments

@Alexander17Z
Copy link

Hello guys,

The library you made is really awesome and ready to use. But I really wonder is it possible to add a parameter for controlling the number of genes on plot_genes or other plotting functions, which I am manually doing now.

Image

Best regards

@sbslee
Copy link
Owner

sbslee commented Feb 3, 2025

@Alexander17Z,

I'm glad to hear that you find pypgx helpful. As for your question, most of the methods of pymaf.MafFrame, including pymaf.MafFrame.plot_genes, have an argument to control the number of the displayed genes (e.g., count). See this documentation as an example.

@Alexander17Z
Copy link
Author

Thank you for replying to my issue! I may not have explained my question very well. Actually, I meant the number annotation on barplot circle by red now. Because I previously tried the classic ax.container method for the returned ax object

for i, bar in enumerate(ax.containers[0]): # Get the x position of the bar x = bar.get_x() + bar.get_width() / 2 # Calculate the total height (sum) of the stacked bars at this position total = sum([c[i].get_height() for c in ax.containers]) # Place the annotation ax.text(x, total + 0.25, f'{total}', fontsize=12)

But this looks pretty weird, so I had to annotate them manually using for loop as the bar width is 1 according to my observation, which is OK for me but not that great. So I would like to ask, is it possible to add this parameter for controlling the number annotation of barplots?

Image

Best regards

@sbslee
Copy link
Owner

sbslee commented Feb 15, 2025

Hi @Alexander17Z,

Thank you for your clarification, and my apologies for the delayed response. I now understand what you're asking. However, to be honest, I currently don't have the capacity to work on this feature. That said, I hope this doesn't stop you from adding it!

I encourage you to check out the source code for the pymaf.MafFrame.plot_genes method and see if you can modify it to display the number of genes. I'd be more than happy to review your code if you submit a pull request.

@sbslee sbslee added the enhancement New feature or request label Feb 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants