Closed aminakur closed 1 year ago
Hello, I am trying to plot a decay curve using the example from the documentation: https://gangcaolab.github.io/CoolBox/_gallery/decay.html
My code:
#Plot a decay curve of chr9: import matplotlib.pyplot as plt plt.rcParams['font.size'] = 18 cool_file = "/scratch/ak8725/az_mrg/az_mrg.mcool" cool = Cool(cool_file, balance=False) gr1 = "chr9:4000000-5000000" gr2 = "chr9:5000000-6000000" mat1 = Cool.fetch_data(gr1,gr2) # any genome region decay1 = Cool.diagonal_mean(mat1) mat2 = Cool.fetch_data(gr2) decay2 = Cool.diagonal_mean(mat2) binsize = cool.fetched_binsize # plot fig, ax = plt.subplots(figsize=(10, 5)) ax.plot(decay1, label=gr1) #ax.plot(decay2, label=gr2) plt.yscale('log') # log scale on y-axis plt.xlabel(f"Distance(bins, binsize={binsize})") plt.ylabel("Mean contacts") plt.xlim(0, 150) plt.ylim(1e-1, 1e5) plt.legend()
The error message:
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-28-cb0cc812cd10> in <module> 9 gr2 = "chr9:5000000-6000000" 10 ---> 11 mat1 = Cool.fetch_data(gr1,gr2) # any genome region 12 decay1 = Cool.diagonal_mean(mat1) 13 mat2 = Cool.fetch_data(gr2) /opt/conda/lib/python3.8/site-packages/coolbox-0.3.8-py3.8.egg/coolbox/core/track/hicmat/cool.py in fetch_data(self, gr, **kwargs) 38 from coolbox.utilities.hic.wrap import CoolerWrap 39 ---> 40 path = self.properties['file'] 41 binsize = kwargs.get('resolution', self.properties.get('resolution', 'auto')) 42 wrap = CoolerWrap(path, balance=self.balance, binsize=binsize) AttributeError: 'str' object has no attribute 'properties'
What is the issue?
Fix this line: Cool -> cool
mat1 = cool.fetch_data(gr1,gr2) # any genome region
Thank you!
Hello, I am trying to plot a decay curve using the example from the documentation: https://gangcaolab.github.io/CoolBox/_gallery/decay.html
My code:
The error message:
What is the issue?