Skip to content

Load local bed file #136

@smitkadvani

Description

@smitkadvani

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions