XiaoTaoWang / NeoLoopFinder

A computation framework for genome-wide detection of enhancer-hijacking events from chromatin interaction data in re-arranged genomes
Other
53 stars 16 forks source link

visualization of CNV normalization in higlass #33

Closed LuJiansen closed 1 year ago

LuJiansen commented 1 year ago

Hi, Xiaotao, thanks for your tools! I ran the CNV normalization pipeline as below: calculate-cnv -H K562-MboI-allReps-hg38.10K.cool --output K562_test.bedGraph segment-cnv --cnv-file K562_test.bedGraph --output K562_test.seg --binsize 10000 correct-cnv -H K562-MboI-allReps-hg38.10K.mcool::resolutions/10000 --cnv-file K562_test.seg

Those ran well, since the sweight column could be found in bins table. Then I want to use higlass to see the difference before and after CNV normalization, however I found visualized using weight was the same before and after normalization, and visualized using sweight was the same as raw contact matrix image (upleft: cooler default blance; upright: CNV normalized weight; bottomleft: raw; bottomright: sweight)

I'm not sure if I'm going the right way, could your give me some advices?

XiaoTaoWang commented 1 year ago

Hi, I think higlass has trouble reading the "sweight" column. One way to deal with this is to overwrite your "weight" column with the "sweight" column before you load your cool file into higlass. Or you may try other visualization software or even write a simple script your yourself according to cooler's official API (https://cooler.readthedocs.io/en/latest/api.html#cooler.Cooler.matrix, make sure you specify balance='sweight' when you extract matrix data).

LuJiansen commented 1 year ago

Many thanks!I have tried the visualization module of NeoLoopFinder, it works well for me

Suger0917 commented 1 year ago

Hi @XiaoTaoWang . Thanks for this awesome tool! I aslo want to show different normalization methods using HiGlass. Could you share the code how to change the weight to balance='sweight' and save the .mcool file? After overwrite the 'weight' column

clr = cooler.Cooler(f'{mcool_file}::{res}') clr <Cooler "K1_hg19.allValidPairs.mcool::/resolutions/25000"> clrs = clr clrs.bins()[:]['weight'] = clr.bins()[:]['sweight']

I don't know how to save clrs and merge different resolutions into one new .mcool file.

Hi, I think higlass has trouble reading the "sweight" column. One way to deal with this is to overwrite your "weight" column with the "sweight" column before you load your cool file into higlass. Or you may try other visualization software or even write a simple script your yourself according to cooler's official API (https://cooler.readthedocs.io/en/latest/api.html#cooler.Cooler.matrix, make sure you specify balance='sweight' when you extract matrix data).