marsilea 0.5.0rc1__py3-none-any.whl → 0.5.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- marsilea/__init__.py +1 -1
- marsilea/base.py +0 -136
- marsilea/plotter/_utils.py +2 -2
- marsilea/upset.py +8 -3
- {marsilea-0.5.0rc1.dist-info → marsilea-0.5.2.dist-info}/METADATA +11 -4
- {marsilea-0.5.0rc1.dist-info → marsilea-0.5.2.dist-info}/RECORD +8 -8
- {marsilea-0.5.0rc1.dist-info → marsilea-0.5.2.dist-info}/licenses/LICENSE +1 -1
- {marsilea-0.5.0rc1.dist-info → marsilea-0.5.2.dist-info}/WHEEL +0 -0
marsilea/__init__.py
CHANGED
marsilea/base.py
CHANGED
|
@@ -1142,142 +1142,6 @@ class ClusterBoard(WhiteBoard):
|
|
|
1142
1142
|
rasterized=rasterized,
|
|
1143
1143
|
)
|
|
1144
1144
|
|
|
1145
|
-
def hsplit(self, cut=None, labels=None, order=None, spacing=0.01):
|
|
1146
|
-
"""Split the main canvas horizontally
|
|
1147
|
-
|
|
1148
|
-
.. deprecated:: 0.5.0
|
|
1149
|
-
Use :meth:`~marsilea.base.ClusterBoard.cut_rows` \
|
|
1150
|
-
or :meth:`~marsilea.base.ClusterBoard.group_rows` instead
|
|
1151
|
-
|
|
1152
|
-
Parameters
|
|
1153
|
-
----------
|
|
1154
|
-
cut : array-like, optional
|
|
1155
|
-
The index of your data to specify where to split the canvas
|
|
1156
|
-
labels : array-like, optional
|
|
1157
|
-
The labels of your data, must be the same length as the data
|
|
1158
|
-
order : array-like, optional
|
|
1159
|
-
The order of the unique labels
|
|
1160
|
-
spacing : float, optional
|
|
1161
|
-
The spacing between each split chunks, default is 0.01
|
|
1162
|
-
|
|
1163
|
-
Examples
|
|
1164
|
-
--------
|
|
1165
|
-
Split the canvas by the unique labels
|
|
1166
|
-
|
|
1167
|
-
.. plot::
|
|
1168
|
-
:context: close-figs
|
|
1169
|
-
|
|
1170
|
-
>>> data = np.random.rand(10, 11)
|
|
1171
|
-
>>> import marsilea as ma
|
|
1172
|
-
>>> h = ma.Heatmap(data)
|
|
1173
|
-
>>> labels = ["A", "B", "C", "A", "B", "C", "A", "B", "C", "A"]
|
|
1174
|
-
>>> h.hsplit(labels=labels, order=["A", "B", "C"])
|
|
1175
|
-
>>> h.add_left(ma.plotter.Labels(labels), pad=.1)
|
|
1176
|
-
>>> h.render()
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
Split the canvas by the index
|
|
1180
|
-
|
|
1181
|
-
.. plot::
|
|
1182
|
-
:context: close-figs
|
|
1183
|
-
|
|
1184
|
-
>>> h = ma.Heatmap(data)
|
|
1185
|
-
>>> h.hsplit(cut=[4, 8])
|
|
1186
|
-
>>> h.render()
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
"""
|
|
1190
|
-
warnings.warn(
|
|
1191
|
-
DeprecationWarning(
|
|
1192
|
-
"`hsplit` will be deprecated in v0.5.0, use `cut_rows` or `group_rows` instead"
|
|
1193
|
-
),
|
|
1194
|
-
stacklevel=2,
|
|
1195
|
-
)
|
|
1196
|
-
if self._split_row:
|
|
1197
|
-
raise SplitTwice(axis="horizontally")
|
|
1198
|
-
self._split_row = True
|
|
1199
|
-
|
|
1200
|
-
deform = self.get_deform()
|
|
1201
|
-
deform.hspace = spacing
|
|
1202
|
-
if cut is not None:
|
|
1203
|
-
deform.set_split_row(breakpoints=cut)
|
|
1204
|
-
else:
|
|
1205
|
-
labels = np.asarray(labels)
|
|
1206
|
-
|
|
1207
|
-
reindex, order = reorder_index(labels, order=order)
|
|
1208
|
-
deform.set_data_row_reindex(reindex)
|
|
1209
|
-
|
|
1210
|
-
breakpoints = get_breakpoints(labels[reindex])
|
|
1211
|
-
deform.set_split_row(breakpoints=breakpoints, order=order)
|
|
1212
|
-
|
|
1213
|
-
def vsplit(self, cut=None, labels=None, order=None, spacing=0.01):
|
|
1214
|
-
"""Split the main canvas vertically
|
|
1215
|
-
|
|
1216
|
-
.. deprecated:: 0.5.0
|
|
1217
|
-
Use :meth:`~marsilea.base.ClusterBoard.cut_cols` \
|
|
1218
|
-
or :meth:`~marsilea.base.ClusterBoard.group_cols` instead
|
|
1219
|
-
|
|
1220
|
-
Parameters
|
|
1221
|
-
----------
|
|
1222
|
-
cut : array-like, optional
|
|
1223
|
-
The index of your data to specify where to split the canvas
|
|
1224
|
-
labels : array-like, optional
|
|
1225
|
-
The labels of your data, must be the same length as the data
|
|
1226
|
-
order : array-like, optional
|
|
1227
|
-
The order of the unique labels
|
|
1228
|
-
spacing : float, optional
|
|
1229
|
-
The spacing between each split chunks, default is 0.01
|
|
1230
|
-
|
|
1231
|
-
Examples
|
|
1232
|
-
--------
|
|
1233
|
-
Split the canvas by the unique labels
|
|
1234
|
-
|
|
1235
|
-
.. plot::
|
|
1236
|
-
:context: close-figs
|
|
1237
|
-
|
|
1238
|
-
>>> data = np.random.rand(10, 11)
|
|
1239
|
-
>>> import marsilea as ma
|
|
1240
|
-
>>> h = ma.Heatmap(data)
|
|
1241
|
-
>>> labels = ["A", "B", "C", "A", "B", "C", "A", "B", "C", "A", "B"]
|
|
1242
|
-
>>> h.vsplit(labels=labels, order=["A", "B", "C"])
|
|
1243
|
-
>>> h.add_top(ma.plotter.Labels(labels), pad=.1)
|
|
1244
|
-
>>> h.render()
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
Split the canvas by the index
|
|
1248
|
-
|
|
1249
|
-
.. plot::
|
|
1250
|
-
:context: close-figs
|
|
1251
|
-
|
|
1252
|
-
>>> h = ma.Heatmap(data)
|
|
1253
|
-
>>> h.vsplit(cut=[4, 8])
|
|
1254
|
-
>>> h.render()
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
"""
|
|
1258
|
-
warnings.warn(
|
|
1259
|
-
DeprecationWarning(
|
|
1260
|
-
"`vsplit` will be deprecated in v0.5.0, use `cut_cols` or `group_cols` instead"
|
|
1261
|
-
),
|
|
1262
|
-
stacklevel=2,
|
|
1263
|
-
)
|
|
1264
|
-
if self._split_col:
|
|
1265
|
-
raise SplitTwice(axis="vertically")
|
|
1266
|
-
self._split_col = True
|
|
1267
|
-
|
|
1268
|
-
deform = self.get_deform()
|
|
1269
|
-
deform.wspace = spacing
|
|
1270
|
-
if cut is not None:
|
|
1271
|
-
deform.set_split_col(breakpoints=cut)
|
|
1272
|
-
else:
|
|
1273
|
-
labels = np.asarray(labels)
|
|
1274
|
-
|
|
1275
|
-
reindex, order = reorder_index(labels, order=order)
|
|
1276
|
-
deform.set_data_col_reindex(reindex)
|
|
1277
|
-
|
|
1278
|
-
breakpoints = get_breakpoints(labels[reindex])
|
|
1279
|
-
deform.set_split_col(breakpoints=breakpoints, order=order)
|
|
1280
|
-
|
|
1281
1145
|
def group_rows(self, group, order=None, spacing=0.01):
|
|
1282
1146
|
"""Group rows into chunks
|
|
1283
1147
|
|
marsilea/plotter/_utils.py
CHANGED
|
@@ -10,12 +10,12 @@ def _format_labels(labels, fmt):
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
def _format_label(a, fmt):
|
|
13
|
-
if np.isnan(a):
|
|
14
|
-
a = ""
|
|
15
13
|
if isinstance(fmt, str):
|
|
16
14
|
label = _auto_format_str(fmt, a)
|
|
17
15
|
elif callable(fmt):
|
|
18
16
|
label = fmt(a)
|
|
17
|
+
elif np.isnan(a):
|
|
18
|
+
a = ""
|
|
19
19
|
else:
|
|
20
20
|
raise TypeError("fmt must be a str or callable")
|
|
21
21
|
return label
|
marsilea/upset.py
CHANGED
|
@@ -239,8 +239,8 @@ class UpsetData:
|
|
|
239
239
|
marks = marks & (sets_table["cardinality"] <= max_cardinality)
|
|
240
240
|
if min_degree is not None:
|
|
241
241
|
marks = marks & (sets_table["degree"] >= min_degree)
|
|
242
|
-
if
|
|
243
|
-
marks = marks & (sets_table["degree"]
|
|
242
|
+
if max_degree is not None:
|
|
243
|
+
marks = marks & (sets_table["degree"] <= max_degree)
|
|
244
244
|
return marks
|
|
245
245
|
|
|
246
246
|
def reset(self):
|
|
@@ -561,6 +561,7 @@ class Upset(WhiteBoard):
|
|
|
561
561
|
self._legend_entries = []
|
|
562
562
|
self._add_intersections = add_intersections
|
|
563
563
|
self._intersection_bar = None
|
|
564
|
+
self._intersection_bar_side = None
|
|
564
565
|
self._sets_size_bar = None
|
|
565
566
|
|
|
566
567
|
if orient not in ["h", "v"]:
|
|
@@ -732,6 +733,7 @@ class Upset(WhiteBoard):
|
|
|
732
733
|
)
|
|
733
734
|
data = self.data.cardinality()
|
|
734
735
|
self._intersection_bar = Numbers(data, color=self.color)
|
|
736
|
+
self._intersection_bar_side = side
|
|
735
737
|
self.add_plot(side, self._intersection_bar, size=size, pad=pad)
|
|
736
738
|
|
|
737
739
|
def add_sets_size(self, side, pad=0.1, size=1.0, **props):
|
|
@@ -956,7 +958,10 @@ class Upset(WhiteBoard):
|
|
|
956
958
|
self._render_matrix(main_ax)
|
|
957
959
|
# apply highlight style to bar
|
|
958
960
|
if self._add_intersections:
|
|
959
|
-
|
|
961
|
+
bars = self._intersection_bar.bars
|
|
962
|
+
if self._intersection_bar_side in {"left", "right"}:
|
|
963
|
+
bars = bars[::-1]
|
|
964
|
+
for ix, rect in enumerate(bars):
|
|
960
965
|
bar_style = self._subset_styles.get(ix)
|
|
961
966
|
if bar_style is not None:
|
|
962
967
|
rect.set(**bar_style)
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: marsilea
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.2
|
|
4
4
|
Summary: Declarative creation of composable visualizations
|
|
5
5
|
Project-URL: Home, https://github.com/Marsilea-viz/marsilea
|
|
6
6
|
Project-URL: Documentation, https://marsilea.readthedocs.io
|
|
7
|
-
Author: Zhihang Zheng
|
|
8
|
-
Author-email: Yimin Zheng <yzheng@cemm.at>
|
|
7
|
+
Author-email: Yimin Zheng <yzheng@cemm.at>, Zhihang Zheng <zhihang.zheng@connect.polyu.hk>
|
|
9
8
|
License: The MIT License (MIT)
|
|
10
9
|
|
|
11
|
-
Copyright (c)
|
|
10
|
+
Copyright (c) 2025 Yimin Zheng
|
|
12
11
|
|
|
13
12
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
13
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -57,6 +56,8 @@ Description-Content-Type: text/markdown
|
|
|
57
56
|

|
|
58
57
|
[](https://doi.org/10.1186/s13059-024-03469-3)
|
|
59
58
|
|
|
59
|
+
[](https://app.gitter.im/#/room/#Marsilea:gitter.im)
|
|
60
|
+
|
|
60
61
|
# Marsilea: Declarative creation of composable visualization!
|
|
61
62
|
|
|
62
63
|
---
|
|
@@ -104,6 +105,12 @@ If you use Marsilea in your research, please cite the following:
|
|
|
104
105
|
>
|
|
105
106
|
> _Genome Biology_ 2025 Jan 06. DOI: [10.1186/s13059-017-1382-0](https://doi.org/10.1186/s13059-024-03469-3)
|
|
106
107
|
|
|
108
|
+
## Get helps
|
|
109
|
+
|
|
110
|
+
1. Open an issue
|
|
111
|
+
2. Join us on [Gitter](https://app.gitter.im/#/room/#Marsilea:gitter.im)
|
|
112
|
+
|
|
113
|
+
|
|
107
114
|
## Examples
|
|
108
115
|
|
|
109
116
|
<table>
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
marsilea/__init__.py,sha256=
|
|
1
|
+
marsilea/__init__.py,sha256=0fpp21uDy2gLto0wOvlbShNTZS-1M9twBFuFumSwwlw,595
|
|
2
2
|
marsilea/_api.py,sha256=tymWZHfjhx8-0NNd9762znfdIu36NrARRweEIr5L1mA,283
|
|
3
3
|
marsilea/_deform.py,sha256=QRz4OGXMsQzbiIkC3ASzZayMPhHhoFsEK38oBzSeQG8,14440
|
|
4
|
-
marsilea/base.py,sha256=
|
|
4
|
+
marsilea/base.py,sha256=CmzuwFu0JzgkNpPdI1SqAnkUxINShjT73hrJpksKjhE,46872
|
|
5
5
|
marsilea/dataset.py,sha256=Qh8k1DhTiwP_Me709CkpNwRaYLDzlenRTIk0U6D58_g,4631
|
|
6
6
|
marsilea/dendrogram.py,sha256=Ung43zseybZKzTEvH5P_ge3WGfsr7i7qsX7YEVDlC74,15590
|
|
7
7
|
marsilea/exceptions.py,sha256=wN5ElUZxuaJKSnnwWdkNx6P-Oc16dzSuaRPbRKWIBEM,1046
|
|
8
8
|
marsilea/heatmap.py,sha256=8Wo1NxFTBp1a7NOISmer0yQYWWgf51Xsvjav1h1vTYk,4316
|
|
9
9
|
marsilea/layers.py,sha256=puXLlGGpEqAzaTqadpgpsYmIDPH33WyyHIuysRSqFZQ,12163
|
|
10
10
|
marsilea/layout.py,sha256=yNuGvIDfWjbCksQZO-4aUWSA78LJwBBKF5Z5cthC6fM,39741
|
|
11
|
-
marsilea/upset.py,sha256=
|
|
11
|
+
marsilea/upset.py,sha256=9m4Los-yVvVZOEHg6X-yfOdLA9eUBQdK1A_BkOaLIMA,30602
|
|
12
12
|
marsilea/utils.py,sha256=y_KYs4ToiuKEsiBdmcIVtmxMXFpD4wKiJ0k7iBa11z8,2854
|
|
13
13
|
marsilea/plotter/__init__.py,sha256=la30o20zYiHWN2RzElhS8MMCbGKbDDEe0WHXakq9OBQ,806
|
|
14
14
|
marsilea/plotter/_seaborn.py,sha256=Ahy5id35KV-PZ50rI5lmEpA4Oov51u8w6VVQzVZH6hM,8330
|
|
15
|
-
marsilea/plotter/_utils.py,sha256=
|
|
15
|
+
marsilea/plotter/_utils.py,sha256=vRnG7kKddwVgDzAqLB8r5EQrLBG9znOw74wh4GdJBX4,712
|
|
16
16
|
marsilea/plotter/arc.py,sha256=44BKVGvDc_OpghfgEvaiVCovZe7_OwZiM20iepaRMFw,8139
|
|
17
17
|
marsilea/plotter/area.py,sha256=zjjAhvgKHYe9rqzcseqZqhwfpgvzm0w2FRJ_vr9Fxm4,2650
|
|
18
18
|
marsilea/plotter/bar.py,sha256=RWDsNbyCUKbybpsBOgbl43lVZc_ynZmTOevE-CtJ5KE,12354
|
|
@@ -25,7 +25,7 @@ marsilea/plotter/text.py,sha256=6S4mnAxLJLMkduKiyor03lPd86oTOJ5TojVREA9oU6s,3746
|
|
|
25
25
|
oncoprinter/__init__.py,sha256=efshcAD1h9s-NVJj4HLU9-hXc_LtTeIrNYqLHl-sm_g,106
|
|
26
26
|
oncoprinter/core.py,sha256=5KPnKW5ivlxPp14uJd0OtfTv-pXV2UEym8EbII2VCcw,11846
|
|
27
27
|
oncoprinter/preset.py,sha256=mBk2tFCqoTj_1ZZKRYuv4j2I3NTBa6Swc9wjzbmxRVw,8238
|
|
28
|
-
marsilea-0.5.
|
|
29
|
-
marsilea-0.5.
|
|
30
|
-
marsilea-0.5.
|
|
31
|
-
marsilea-0.5.
|
|
28
|
+
marsilea-0.5.2.dist-info/METADATA,sha256=ItfPnIgJLjJRHgNax36iPM48Wwb7DHUvg-P-UZkyMS8,7265
|
|
29
|
+
marsilea-0.5.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
30
|
+
marsilea-0.5.2.dist-info/licenses/LICENSE,sha256=RhHHDuP61qzKmfHtOQUVLZfCgMkKx9PXzxzkLtmAjHo,1078
|
|
31
|
+
marsilea-0.5.2.dist-info/RECORD,,
|
|
File without changes
|