Skip to content

Commit

Permalink
Refactor BigXXX patch class more simply
Browse files Browse the repository at this point in the history
  • Loading branch information
moshi4 committed Sep 8, 2024
1 parent fde67b8 commit 734d143
Showing 1 changed file with 5 additions and 68 deletions.
73 changes: 5 additions & 68 deletions src/pygenomeviz/patches.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import annotations

from functools import partial

from matplotlib.patches import FancyArrow, PathPatch
from matplotlib.path import Path

Expand Down Expand Up @@ -85,32 +87,7 @@ def __init__(
)


class BigArrow(Arrow):
"""BigArrow Patch Class"""

def __init__(
self,
start: int,
end: int,
strand: int,
*,
max_size: int,
show_head: bool = True,
shaft_ratio: float = 0.5,
ylim: tuple[float, float] = (-1, 1),
**kwargs,
) -> None:
super().__init__(
start,
end,
strand,
max_size=max_size,
bigstyle=True,
show_head=show_head,
shaft_ratio=shaft_ratio,
ylim=ylim,
**kwargs,
)
BigArrow = partial(Arrow, bigstyle=True)


class Box(PathPatch):
Expand Down Expand Up @@ -165,26 +142,7 @@ def __init__(
super().__init__(box, **kwargs)


class BigBox(Box):
"""BigBox Patch Class"""

def __init__(
self,
start: int,
end: int,
strand: int,
*,
ylim: tuple[float, float] = (-1, 1),
**kwargs,
) -> None:
super().__init__(
start,
end,
strand,
bigstyle=True,
ylim=ylim,
**kwargs,
)
BigBox = partial(Box, bigstyle=True)


class RoundBox(PathPatch):
Expand Down Expand Up @@ -255,28 +213,7 @@ def __init__(
super().__init__(Path(verts, codes), **kwargs)


class BigRoundBox(RoundBox):
"""BigRoundBox Patch Class"""

def __init__(
self,
start: int,
end: int,
strand: int,
*,
max_size: int,
ylim: tuple[float, float] = (-1, 1),
**kwargs,
) -> None:
super().__init__(
start,
end,
strand,
bigstyle=True,
max_size=max_size,
ylim=ylim,
**kwargs,
)
BigRoundBox = partial(RoundBox, bigstyle=True)


class Intron(PathPatch):
Expand Down

0 comments on commit 734d143

Please sign in to comment.