vaquerizaslab / fanc

FAN-C: Framework for the ANalysis of C-like data
GNU General Public License v3.0
107 stars 14 forks source link

Virtual4CPlot #143

Open zmbiolab opened 1 year ago

zmbiolab commented 1 year ago

this my script:

import fanc
import fanc.plotting as fancplot
hic_datasets = ["/media/juicer/bd.allValidPairs.hic@100kb", "/media/juicer/ld.allValidPairs.hic@100kb"]
hic_plots = [fancplot.Virtual4CPlot(h, viewpoint="2:120400000-120430000") for h in hic_datasets]
gfig = fancplot.GenomicFigure(hic_plots)
regions = "2:129000000-122000000"
fig, axes = gfig.plot(regions)
fig.savefig("plot_region_{}.png")

error is that:

File "/home/qd/miniconda3/envs/cooltools/lib/python3.9/site-packages/fanc/plotting/plotter.py", line 1722, in _plot
    submatrix = self.hic.matrix((self.viewpoint, region), norm=self.norm, oe=self.oe,

AttributeError: 'str' object has no attribute 'matrix'
kaukrise commented 1 year ago

You need to load the matrices in hic_datasets:

import fanc
import fanc.plotting as fancplot
hic_datasets = [
    fanc.load(file_name) for file_name in [
        "/media/juicer/bd.allValidPairs.hic@100kb", 
        "/media/juicer/ld.allValidPairs.hic@100kb"
    ]
]
zmbiolab commented 1 year ago

Thank you very much for your timely response