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

hicComparments question #635

Closed
joachimwolff opened this issue Nov 26, 2020 · 5 comments
Closed

hicComparments question #635

joachimwolff opened this issue Nov 26, 2020 · 5 comments

Comments

@joachimwolff
Copy link
Collaborator

joachimwolff commented Nov 26, 2020

// edit: Moved this question to its own new issue. @GregZs Please do not write in old issues, especially if they are already a year closed. Thanks.

Hi,
I am using hicexplorer 3.6 and I am trying to use the hiccompartmentalization tool:
hicCompartmentalization --obsexp_matrices hic_OE_adj_res100000.h5 --pca pca1.bedgraph -o global_signal.png --outputMatrix output_cs
Here is the output that I obtained:
global_signal 2

Does the x-axis represents the bins ordered from the A compartment on the left to the B compartment on the right ?

Because I tried to sort the pca1.bedgraph according to the pca scores and then run again hicCompartmentalization and I obtained a different output:
global_signal

Also I tried to plot the output matrix to obtain a saddle plot but the values do not correspond
Unknown

Can the tool be run genome wide or it has to be done by chromosome ?
Why sorting the bedgraph by the pca score changes the output ?
How can I get the values used for the plot from the npz object ?

Thanks in advance

Originally posted by @GregZs in #473 (comment)

@LeilyR
Copy link
Collaborator

LeilyR commented Nov 26, 2020

X-axis shows the bins of the matrix which you have plotted it yourself as a heatmap.
Ordering your bed graph should not affect the result. Although from the figure it seems as if you swap your compartments by maybe swapping the positive and negative values in your bed graph? You may want to explain more details of what you have done there.
The values on the output graph are not the matrix values. For each quantile they are calculated in a way to show the strength of compartment separation. This is done by comparing the A and B compartment with elsewhere. If you are interested in the formula you can find it here
Basically it sums the top left corner and the bottom right, then divide it to the top right + the bottom left.
Since the matrix values are ordered based on the pc1 values , top left is where pc values are negative (usually the B compartment) and bottom right is where pc1 values are positive (usually A)

@GregZs
Copy link

GregZs commented Nov 27, 2020

Thanks for your quick reply !
The bedgraph used to generate the plots are identical, but one was sorted by chromosome and the other by pc1 values.
Since the tools reorder the bin according to the the pc1 quantile the graph should be identical.
So the nb 1 of the x axis represent all the bins corresponding to the first quartile of the Pc1 (meaning the lowest values of the pc1 so B compartment) ?
And the y value associated represents the nb of interaction within the bins of the 1st quartile / nb of interactions with other bins ?
Could you provide an example of the plot generated from public HiC data ?
Thanks

@LeilyR
Copy link
Collaborator

LeilyR commented Nov 27, 2020

test data:
matrix : https://github.com/deeptools/HiCExplorer/blob/master/hicexplorer/test/test_data/hicPCA/obsexp_norm.h5
bed graph: https://github.com/deeptools/HiCExplorer/blob/master/hicexplorer/test/test_data/hicCompartmentalization/pca1.bedgraph
it is interesting the re-ordering the bedgraph change the figure, it should not have happened. I will test it.
x axis: is just the number of the quantile so if you have 30 , you will see 1, ... 30
y axis: as I said before for each quantile sums the A + B and decides it by elsewhere. So imagine you have 5 quintiles. then at 1 it sums the first top left cell of the matrix with the most bottom right cell and divide this by the sum of to other corners. As it goes further on the x axis , it sums more cells and divide by a more cells too. Also as I have mentioned before the idea is to show the strength of A and B compartments. I have sent you the for loop in the code that does this job. so if A and B are well formed the value should be bigger than 1, however, as it goes over bigger sub-matrices this value drops.

@LeilyR LeilyR mentioned this issue Nov 30, 2020
@LeilyR
Copy link
Collaborator

LeilyR commented Nov 30, 2020

Hi @GregZs, I found a bug in calling the right indices on the obs_exp matrix and fixed it. So now it should work no matter what your bedgraph order is. Feel free to try the hicCompartmentalization from fix_635 branch and let us know if there is still any issue left.

@GregZs
Copy link

GregZs commented Dec 2, 2020

Thanks !!

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

No branches or pull requests

3 participants