ay-lab / dcHiC

dcHiC: Differential compartment analysis for Hi-C datasets
MIT License
57 stars 10 forks source link

% variance explained by PC1 #24

Closed esebesty closed 2 years ago

esebesty commented 2 years ago

Hi, is it possible to get the % variance explained value for PC1 or PC2 using dcHiC results? A bit lost between the different intermediate files that dcHiC produces. Trying to produce a plot similar to 4B here. If not, what would you recommend? Just run a regular R prcomp() + summary() on the normalized HiC counts and check the results? Thanks for any pointers!

ay-lab commented 2 years ago

Hi There! Thank you for using our tool and sorry about the late reply. There is a deprecated feature in our current release that will allow you to do this (see commented section at bottom of Hier.R).

You may also wait a bit—we will have a large update, including some substantial improvements (resolution, differential calling, etc) and methodology changes, coming next week, that will have this output. It would be great if you could try that as well!

esebesty commented 2 years ago

Thanks, I'll give it a try and check the deprecated feature first. Also looking forward to the new software version!

ay-lab commented 2 years ago

Hello—we just launched the latest version. It would be great if you could check it out!

For this particular question in this update, you will see that each replicate or sample will produce a chromosome wise .rds file inside the _pca folder. Then one can use that to calculate the variance like the following:

r <- readRDS("../../ES_NPC_100Kb_Comparison/ES_4_100Kb_pca/intra_pca/ES_4_100Kb_mat/chr9.svd.rds")
variance.explained <- prop.table(r$d^2)
variance.explained
[1] 0.95060248 0.04939752