Skip to content

Commit d9e4756

Browse files
authored
Merge pull request #76 from moshi4/develop
Bump to v1.7.1
2 parents ce31361 + 23bfe7f commit d9e4756

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

src/pycirclize/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from pycirclize.circos import Circos
22

3-
__version__ = "1.7.0"
3+
__version__ = "1.7.1"
44

55
__all__ = [
66
"Circos",

src/pycirclize/circos.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ def initialize_from_matrix(
426426
colors = utils.ColorCycler.get_color_list(len(names))
427427
name2color = dict(zip(names, colors))
428428
else:
429-
if type(cmap) == defaultdict:
429+
if isinstance(cmap, defaultdict):
430430
name2color = cmap
431431
else:
432432
name2color: dict[str, str] = defaultdict(lambda: "grey")
@@ -444,10 +444,10 @@ def initialize_from_matrix(
444444
outer_track.xticks_by_interval(ticks_interval, **ticks_kws)
445445

446446
# Plot links
447-
fromto_label2color = {f"{t[0]}{t[1]}": t[2] for t in link_cmap}
447+
fromto_label2color = {f"{t[0]}--->{t[1]}": t[2] for t in link_cmap}
448448
for link in matrix.to_links():
449449
from_label, to_label = link[0][0], link[1][0]
450-
fromto_label = f"{from_label}{to_label}"
450+
fromto_label = f"{from_label}--->{to_label}"
451451
# Set link color
452452
if fromto_label in fromto_label2color:
453453
color = fromto_label2color[fromto_label]
@@ -1061,7 +1061,7 @@ def plotfig(
10611061
for plot_func in self._get_all_plot_funcs():
10621062
plot_func(ax)
10631063

1064-
return fig
1064+
return fig # type: ignore
10651065

10661066
def savefig(
10671067
self,
@@ -1164,7 +1164,7 @@ def _initialize_figure(
11641164
"""
11651165
fig = plt.figure(figsize=figsize, dpi=dpi, tight_layout=True)
11661166
ax = fig.add_subplot(projection="polar")
1167-
return fig, ax
1167+
return fig, ax # type: ignore
11681168

11691169
def _initialize_polar_axes(self, ax: PolarAxes) -> None:
11701170
"""Initialize polar axes params

src/pycirclize/parser/matrix.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def parse_fromto_table(
103103
for row in fromto_table.itertuples():
104104
from_label, to_label, value = str(row[1]), str(row[2]), row[3]
105105
if float(value) > 0:
106-
fromto = f"{from_label}{to_label}"
106+
fromto = f"{from_label}-->{to_label}"
107107
fromto2value[fromto] = value
108108
label2value_sum[from_label] += value
109109
label2value_sum[to_label] += value
@@ -134,7 +134,7 @@ def parse_fromto_table(
134134
for row_label in all_labels:
135135
row_data = []
136136
for col_label in all_labels:
137-
row_data.append(fromto2value[f"{row_label}{col_label}"])
137+
row_data.append(fromto2value[f"{row_label}-->{col_label}"])
138138
matrix_data.append(row_data)
139139
matrix_df = pd.DataFrame(matrix_data, index=all_labels, columns=all_labels)
140140

src/pycirclize/patches.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def __init__(
241241

242242
def arc_paths(
243243
rad1: float, rad2: float, r: float
244-
) -> list[tuple[Path.code_type, tuple[float, float]]]:
244+
) -> list[tuple[np.uint8, tuple[float, float]]]:
245245
# If rad1 == rad2, return blank list
246246
arc_paths = []
247247
step = config.ARC_RADIAN_STEP if rad1 <= rad2 else -config.ARC_RADIAN_STEP
@@ -251,7 +251,7 @@ def arc_paths(
251251

252252
def arrow_paths(
253253
rad1: float, rad2: float, r_side: float, r_top: float
254-
) -> list[tuple[Path.code_type, tuple[float, float]]]:
254+
) -> list[tuple[np.uint8, tuple[float, float]]]:
255255
return [
256256
(Path.LINETO, (rad1, r_side)),
257257
(Path.LINETO, ((rad1 + rad2) / 2, r_top)),
@@ -260,7 +260,7 @@ def arrow_paths(
260260

261261
def bezier_paths(
262262
rad1: float, rad2: float, r1: float, r2: float, height_ratio: float = 0.5
263-
) -> list[tuple[Path.code_type, tuple[float, float]]]:
263+
) -> list[tuple[np.uint8, tuple[float, float]]]:
264264
if height_ratio >= 0.5:
265265
# Example1: height_ratio: 0.50 => r_ctl_pos: 0
266266
# Example2: height_ratio: 0.75 => r_ctl_pos: 25
@@ -389,7 +389,7 @@ def bezier_paths(
389389
r1: float,
390390
r2: float,
391391
height_ratio: float = 0.5,
392-
) -> list[tuple[Path.code_type, tuple[float, float]]]:
392+
) -> list[tuple[np.uint8, tuple[float, float]]]:
393393
if height_ratio >= 0.5:
394394
# Example1: height_ratio: 0.50 => r_ctl_pos: 0
395395
# Example2: height_ratio: 0.75 => r_ctl_pos: 25
@@ -412,7 +412,7 @@ def arrow_line_paths(
412412
r_pos: float,
413413
arrow_rad_width: float,
414414
arrow_r_height: float,
415-
) -> list[tuple[Path.code_type, tuple[float, float]]]:
415+
) -> list[tuple[np.uint8, tuple[float, float]]]:
416416
arrow_r_pos = r_pos - arrow_r_height
417417
return [
418418
(Path.MOVETO, (rad_pos + (arrow_rad_width / 2), arrow_r_pos)),
@@ -421,7 +421,7 @@ def arrow_line_paths(
421421
]
422422

423423
arrow_rad_width = np.radians(arrow_width)
424-
path_data: list[tuple[Path.code_type, tuple[float, float]]] = []
424+
path_data: list[tuple[np.uint8, tuple[float, float]]] = []
425425
if direction in (config.Direction.REVERSE, config.Direction.BIDIRECTIONAL):
426426
path_data.extend(arrow_line_paths(rad1, r1, arrow_rad_width, arrow_height))
427427
path_data.append((Path.MOVETO, (rad1, r1)))

src/pycirclize/sector.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,8 @@ def raster(
449449

450450
# Calculate x, y image set position
451451
max_r_lim = config.MAX_R + config.R_PLOT_MARGIN
452-
im_x = np.cos((np.pi / 2) - rad) * (r / max_r_lim)
453-
im_y = np.sin((np.pi / 2) - rad) * (r / max_r_lim)
452+
im_x: float = np.cos((np.pi / 2) - rad) * (r / max_r_lim)
453+
im_y: float = np.sin((np.pi / 2) - rad) * (r / max_r_lim)
454454
# Normalize (-1, 1) to (0, 1) axis range
455455
im_x = (im_x + 1) / 2
456456
im_y = (im_y + 1) / 2
@@ -463,7 +463,7 @@ def raster(
463463

464464
def plot_raster(ax: PolarAxes) -> None:
465465
# Set inset axes & plot raster image
466-
bounds = [im_x - (size / 2), im_y - (size / 2), size, size]
466+
bounds = (im_x - (size / 2), im_y - (size / 2), size, size)
467467
axin = ax.inset_axes(bounds, transform=ax.transAxes)
468468
axin.axis("off")
469469
axin.imshow(im, **imshow_kws) # type: ignore

0 commit comments

Comments
 (0)