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

Requesting Assistance with CoolBox Visualization - Achieving A/B compartments #84

Open
wbszhu opened this issue Jun 30, 2023 · 2 comments

Comments

@wbszhu
Copy link
Collaborator

wbszhu commented Jun 30, 2023

I am currently using CoolBox for visualization purposes and I would like to achieve a visual effect similar to the provided image. I am seeking guidance on how to proceed and I was wondering if you could provide some example code to help me achieve this effect.
image
I will appreciate any help or insights you can provide to assist me in achieving the desired visual effect. Thank you in advance for your assistance!

@wbszhu wbszhu changed the title Requesting Assistance with Coolbox Visualization - Achieving A/B compartments Requesting Assistance with CoolBox Visualization - Achieving A/B compartments Jun 30, 2023
@zhqu1148980644
Copy link
Collaborator

To complete this task, you will need some knowledge of Python coding. You can subclass the Cool class to create a new class or track called Com that will display A/B compartment. You will need to implement the fetch_data method in the Com class to return the A/B compartment matrix.

Here is an example code:

class Com(Cool):
      def fetch_data(self, gr1, gr2):
          # 1. fetch compartment matrix for the entire chromosome range
          # 2. subrange the matrix in gr1 and gr2

You can refer to the source codes of Cool to learn how to extract raw matrix from a cooler file. You can find it here:
https://github.com/GangCaoLab/CoolBox/blob/36a86b20e032c6200d6f4077a5b241c0dbda2a78/coolbox/core/track/hicmat/cool.py#L37C1-L47C39

@wbszhu
Copy link
Collaborator Author

wbszhu commented Jul 2, 2023

Thanks for your reply, I'll try it out.

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

No branches or pull requests

2 participants