Skip to content

Conversation

manzt
Copy link
Member

@manzt manzt commented Feb 11, 2025

Refactors tileset implementations by introducing thehiglass.tilesets.register decorator. When applied to a class
implementing TilesetProtocol, this decorator adds a track() method, enabling track creation while automatically registering the tileset instance in the global TilesetRegistry.

from clodius.tiles.cooler import tiles, tileset_info
from dataclasses import dataclass

@hg.tilesets.register
@dataclass
class MyCustomCoolerTileset:
    path: str
    datatype = "matrix"

    def tiles(self, tile_ids):
        return tiles(self.path, tile_ids)

    def info(self):
        return tileset_info(self.path)

ts = MyCustomCoolerTileset("test.mcool")
hg.view(ts.track())

Description

What was changed in this pull request?

Why is it necessary?

Fixes #___

Checklist

  • Clear PR title (used for generating release notes).
    • Prefer using prefixes like fix: or feat: to help organize auto-generated notes.
  • Unit tests added or updated.
  • Documentation added or updated.

Refactors tileset implementations by introducing the
`higlass.tilesets.register` decorator.  When applied to a class
implementing `TilesetProtocol`, this decorator adds a `track()`  method,
enabling track creation while automatically registering the tileset
instance  in the global `TilesetRegistry`.
@manzt manzt requested a review from nvictus February 11, 2025 22:22
@manzt manzt added the enhancement New feature or request label Feb 12, 2025
@manzt manzt merged commit bff6880 into main Feb 12, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant