GangCaoLab / CoolBox

Jupyter notebook based genomic data visualization toolkit.
https://gangcaolab.github.io/CoolBox/index.html
GNU General Public License v3.0
224 stars 37 forks source link

Is there a way to go directly from a pd.Dataframe version of a Bed file? #89

Open haleybianchi opened 10 months ago

haleybianchi commented 10 months ago

Basically the title, I am doing an analysis of various bed file like dataframes, and am wondering if I can convert them into a Frame object for plotting. I have only seen the file I/O operations using BED(), which is currently not working for me. Regardless, converting a pd.Df to a frame object would be usefule.

----> 9 BED(f"{BED_DIR}v_genes.bed") + Title("mouse IghV") + \ 10 BigWig(f"{BW_DIR}B6_K27ac.bw") + Title("Pro-b K27ac") + \ 11 prob + Title("Pro-b HiC") 13 frame.plot(TEST_RANGE)

File /data/bianchiah/mymamba/envs/mambamatrix2/lib/python3.8/site-packages/coolbox/core/track/bed/bed.py:36, in BED.init(self, file, kwargs) 31 properties.update({ 32 'file': file, 33 kwargs 34 }) 35 super().init(**properties) ---> 36 self.bgz_file = build_bed_index(file)

File /data/bianchiah/mymamba/envs/mambamatrix2/lib/python3.8/site-packages/coolbox/utilities/bed.py:406, in build_bed_index(file) 404 bgz_file = file + '.bgz' 405 log.info(f"Bgzip bed file, save to {bgz_file}") --> 406 bgz_bed(file, bgz_file) ... 363 cmd = popenargs[0] --> 364 raise CalledProcessError(retcode, cmd) 365 return 0