Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to load bed file using higlass-python #136

Open
smitkadvani opened this issue Sep 13, 2023 · 0 comments
Open

how to load bed file using higlass-python #136

smitkadvani opened this issue Sep 13, 2023 · 0 comments

Comments

@smitkadvani
Copy link
Contributor

smitkadvani commented Sep 13, 2023

Description:

When I try to load a bedfile using the following code:

import higlass as hg
ts3 = hg.bed2ddb('Regular/H3K27ac_EA92-97_peaks.xls.bed.beddb')

hg.view(
    hg.track("top-axis"),
    ts3.track("chromosome-labels"),
    ts3.track("horizontal-bar"),
)

File "/Users/smit/anaconda3/envs/3dfolding/lib/python3.11/site-packages/higlass/tilesets.py", line 46, in tiles
return self._tiles(tile_ids)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/smit/anaconda3/envs/3dfolding/lib/python3.11/site-packages/clodius/tiles/bed2ddb.py", line 41, in tiles
return tiles_1d(filepath, tile_ids)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/smit/anaconda3/envs/3dfolding/lib/python3.11/site-packages/clodius/tiles/bed2ddb.py", line 64, in tiles_1d
to_return += [(tile_id, get_1d_tiles(filepath, int(z), int(x))[int(x)])]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/smit/anaconda3/envs/3dfolding/lib/python3.11/site-packages/clodius/tiles/bed2ddb.py", line 117, in get_1d_tiles
rows = c.execute(query).fetchall()
^^^^^^^^^^^^^^^^
sqlite3.OperationalError: no such column: fromX

While debugging, I reviewed the clodius repository in the aggregate.py file and found out that the _bedpe format uses the fromX column. As a result, my beddb file doesn't have this column information.

Direct reference:
aggregate.py#L346

However, hg.bed2ddb is expecting the 'fromX' column name.

Supporting Information:

Bed file format

chr1	3062508	3062700	H3K27ac_EA92-97_peak_1	1.50105
chr1	3671399	3672083	H3K27ac_EA92-97_peak_2	2.19707
chr1	4491709	4492214	H3K27ac_EA92-97_peak_3	2.94584
chr1	4493155	4493533	H3K27ac_EA92-97_peak_4	3.21493
chr1	4571589	4571963	H3K27ac_EA92-97_peak_5	1.64992
chr1	4653954	4654123	H3K27ac_EA92-97_peak_6	1.64383

Command to convert bed file to bed2d format:

clodius aggregate bedfile --chromsizes-filename ../CUT-Tag_NIPBL/CUT-Tag_NIPBL-FKBP-EA18.1/mm10.size.txt Regular/H3K27ac_EA92-97_peaks.xls.bed
mm10.size.txt was retrieved from this link.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant