higlass / higlass/higlass-python

Load local bed file

Open
#136 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
66
Forks
11
PR merge metrics
No merged PRs in 30d

Description

**Description:**

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

```python
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](https://github.com/higlass/clodius/blob/de67e9df2cd296d3681dcf438c0895638de672e4/clodius/cli/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](https://github.com/higlass/clodius/blob/de67e9df2cd296d3681dcf438c0895638de672e4/clodius/cli/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](http://hgdownload.cse.ucsc.edu/goldenpath/mm10/bigZips/mm10.chrom.sizes).

Contributor guide

Open the contributing guide

Research direction

Start with clodius/tiles/bed2ddb.py, especially get_1d_tiles, and compare its query with the schema produced by clodius/cli/aggregate.py around line 346. Reproduce the failure using the supplied BED example and aggregate command. Done means the resulting beddb loads through hg.bed2ddb and can render the listed tracks without the fromX error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sqlite
Domain
data, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.