sciv 0.0.91__py3-none-any.whl → 0.0.93__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.
- sciv/plot/__init__.py +1 -0
- sciv/plot/_bar_.py +14 -6
- sciv/plot/_barcode_.py +9 -8
- sciv/plot/_box_.py +10 -4
- sciv/plot/_bubble_.py +3 -2
- sciv/plot/_core_.py +8 -4
- sciv/plot/_graph_.py +12 -9
- sciv/plot/_heat_map_.py +7 -4
- sciv/plot/_kde_.py +3 -2
- sciv/plot/_line_.py +3 -2
- sciv/plot/_pie_.py +8 -4
- sciv/plot/_radar_.py +5 -2
- sciv/plot/_scatter_.py +88 -10
- sciv/plot/_venn_.py +6 -4
- sciv/plot/_violin_.py +23 -21
- sciv/preprocessing/_scvi_.py +2 -2
- sciv/util/_core_.py +18 -10
- {sciv-0.0.91.dist-info → sciv-0.0.93.dist-info}/METADATA +1 -1
- sciv-0.0.93.dist-info/RECORD +39 -0
- sciv-0.0.91.dist-info/RECORD +0 -39
- {sciv-0.0.91.dist-info → sciv-0.0.93.dist-info}/WHEEL +0 -0
- {sciv-0.0.91.dist-info → sciv-0.0.93.dist-info}/licenses/LICENSE +0 -0
sciv/plot/__init__.py
CHANGED
sciv/plot/_bar_.py
CHANGED
|
@@ -32,10 +32,11 @@ def bar(
|
|
|
32
32
|
direction: Literal['vertical', 'horizontal'] = "vertical",
|
|
33
33
|
output: path = None,
|
|
34
34
|
show: bool = True,
|
|
35
|
+
close: bool = False,
|
|
35
36
|
**kwargs: Any
|
|
36
37
|
) -> None:
|
|
37
38
|
|
|
38
|
-
fig, ax = plot_start(
|
|
39
|
+
fig, ax = plot_start(width, height, bottom, output, show)
|
|
39
40
|
|
|
40
41
|
ax_x = np.array(ax_x).astype(str)
|
|
41
42
|
|
|
@@ -59,7 +60,7 @@ def bar(
|
|
|
59
60
|
color=text_color
|
|
60
61
|
)
|
|
61
62
|
|
|
62
|
-
plot_end(fig, output, show)
|
|
63
|
+
plot_end(fig, title, x_name, y_name, output, show, close)
|
|
63
64
|
|
|
64
65
|
|
|
65
66
|
def two_bar(
|
|
@@ -78,10 +79,11 @@ def two_bar(
|
|
|
78
79
|
title: str = None,
|
|
79
80
|
output: path = None,
|
|
80
81
|
show: bool = True,
|
|
82
|
+
close: bool = False,
|
|
81
83
|
**kwargs: Any
|
|
82
84
|
):
|
|
83
85
|
|
|
84
|
-
fig, ax = plot_start(
|
|
86
|
+
fig, ax = plot_start(width, height, bottom, output, show)
|
|
85
87
|
|
|
86
88
|
ax_x = np.array(ax_x).astype(str)
|
|
87
89
|
ax.bar(ax_x, ax_y[0], label=legend[0], color=color[0], **kwargs)
|
|
@@ -101,7 +103,7 @@ def two_bar(
|
|
|
101
103
|
color=text_color
|
|
102
104
|
)
|
|
103
105
|
|
|
104
|
-
plot_end(fig, output, show)
|
|
106
|
+
plot_end(fig, title, x_name, y_name, output, show, close)
|
|
105
107
|
|
|
106
108
|
|
|
107
109
|
def class_bar(
|
|
@@ -123,6 +125,7 @@ def class_bar(
|
|
|
123
125
|
text_left_move: float = 0.15,
|
|
124
126
|
output: path = None,
|
|
125
127
|
show: bool = True,
|
|
128
|
+
close: bool = False,
|
|
126
129
|
**kwargs: Any
|
|
127
130
|
):
|
|
128
131
|
|
|
@@ -159,6 +162,7 @@ def class_bar(
|
|
|
159
162
|
title=title,
|
|
160
163
|
output=output,
|
|
161
164
|
show=show,
|
|
165
|
+
close=close,
|
|
162
166
|
**kwargs
|
|
163
167
|
)
|
|
164
168
|
|
|
@@ -183,6 +187,7 @@ def bar_trait(
|
|
|
183
187
|
text_left_move: float = 0.15,
|
|
184
188
|
output: path = None,
|
|
185
189
|
show: bool = True,
|
|
190
|
+
close: bool = False,
|
|
186
191
|
**kwargs: Any
|
|
187
192
|
):
|
|
188
193
|
def trait_plot(trait_: str, cell_df_: DataFrame) -> None:
|
|
@@ -214,6 +219,7 @@ def bar_trait(
|
|
|
214
219
|
text_color=text_color,
|
|
215
220
|
output=os.path.join(output, f"cell_{trait_}_enrichment_bar.pdf") if output is not None else None,
|
|
216
221
|
show=show,
|
|
222
|
+
close=close,
|
|
217
223
|
**kwargs
|
|
218
224
|
)
|
|
219
225
|
|
|
@@ -272,6 +278,7 @@ def bar_significance(
|
|
|
272
278
|
title: str = None,
|
|
273
279
|
output: path = None,
|
|
274
280
|
show: bool = True,
|
|
281
|
+
close: bool = False,
|
|
275
282
|
**kwargs: Any
|
|
276
283
|
) -> None:
|
|
277
284
|
"""
|
|
@@ -311,10 +318,11 @@ def bar_significance(
|
|
|
311
318
|
:param title: Plot title
|
|
312
319
|
:param output: Path to save figure (optional)
|
|
313
320
|
:param show: Whether to display the plot
|
|
321
|
+
:param close:
|
|
314
322
|
:return: None
|
|
315
323
|
"""
|
|
316
324
|
|
|
317
|
-
fig, ax = plot_start(
|
|
325
|
+
fig, ax = plot_start(width, height, bottom, output, show)
|
|
318
326
|
|
|
319
327
|
if legend_list is not None:
|
|
320
328
|
new_data: DataFrame = df[df[hue].isin(legend_list)].copy()
|
|
@@ -432,4 +440,4 @@ def bar_significance(
|
|
|
432
440
|
|
|
433
441
|
plt.legend(loc='upper left', bbox_to_anchor=(0.0, legend_gap), ncol=2)
|
|
434
442
|
|
|
435
|
-
plot_end(fig, output, show)
|
|
443
|
+
plot_end(fig, title, x_name, y_name, output, show, close)
|
sciv/plot/_barcode_.py
CHANGED
|
@@ -29,7 +29,8 @@ def barcode_base(
|
|
|
29
29
|
colors: list = None,
|
|
30
30
|
ground_true: list = None,
|
|
31
31
|
output: path = None,
|
|
32
|
-
show: bool = True
|
|
32
|
+
show: bool = True,
|
|
33
|
+
close: bool = False
|
|
33
34
|
):
|
|
34
35
|
# sort
|
|
35
36
|
df_sort = df.sort_values([trait_column_name, sort_column], ascending=False)
|
|
@@ -58,9 +59,6 @@ def barcode_base(
|
|
|
58
59
|
|
|
59
60
|
plt.axis("off")
|
|
60
61
|
|
|
61
|
-
if title is not None:
|
|
62
|
-
plt.title(title)
|
|
63
|
-
|
|
64
62
|
gs = GridSpec(20, 20)
|
|
65
63
|
ax1 = fig.add_subplot(gs[:17, 11:14] if is_ticks else gs[:18, 11:14])
|
|
66
64
|
ax2 = fig.add_subplot(gs[:17, :8] if is_ticks else gs[:18, :8])
|
|
@@ -91,7 +89,7 @@ def barcode_base(
|
|
|
91
89
|
ticks = np.linspace(round(df_sort[sort_column].min(), 2), round(df_sort[sort_column].max() - 0.05, 2), 3)
|
|
92
90
|
color_bar.set_ticks(ticks if is_ticks else [])
|
|
93
91
|
|
|
94
|
-
plot_end(fig, output, show)
|
|
92
|
+
plot_end(fig, title, output=output, show=show, close=close)
|
|
95
93
|
|
|
96
94
|
|
|
97
95
|
def barcode_trait(
|
|
@@ -107,8 +105,10 @@ def barcode_trait(
|
|
|
107
105
|
colors: list = None,
|
|
108
106
|
ground_true: list = None,
|
|
109
107
|
title: str = None,
|
|
108
|
+
suffix: str = "pdf",
|
|
110
109
|
output: path = None,
|
|
111
|
-
show: bool = True
|
|
110
|
+
show: bool = True,
|
|
111
|
+
close: bool = False
|
|
112
112
|
):
|
|
113
113
|
data: DataFrame = trait_df.copy()
|
|
114
114
|
cluster_list = list(set(trait_df[clusters]))
|
|
@@ -137,8 +137,9 @@ def barcode_trait(
|
|
|
137
137
|
cmap=cmap,
|
|
138
138
|
ground_true=ground_true,
|
|
139
139
|
title=f"{title} {trait_}" if title is not None else title,
|
|
140
|
-
output=os.path.join(output, f"cell_{trait_}_score_rank.
|
|
141
|
-
show=show
|
|
140
|
+
output=os.path.join(output, f"cell_{trait_}_score_rank.{suffix}") if output is not None else None,
|
|
141
|
+
show=show,
|
|
142
|
+
close=close
|
|
142
143
|
)
|
|
143
144
|
|
|
144
145
|
# noinspection DuplicatedCode
|
sciv/plot/_box_.py
CHANGED
|
@@ -33,6 +33,7 @@ def box_base(
|
|
|
33
33
|
order_names: list = None,
|
|
34
34
|
output: path = None,
|
|
35
35
|
show: bool = True,
|
|
36
|
+
close: bool = False,
|
|
36
37
|
**kwargs: Any
|
|
37
38
|
) -> None:
|
|
38
39
|
|
|
@@ -43,7 +44,7 @@ def box_base(
|
|
|
43
44
|
ul.log(__name__).error(f"The `value` ({value}) parameter must be in the `df` parameter data column name ({df_columns})")
|
|
44
45
|
raise ValueError(f"The `value` ({value}) parameter must be in the `df` parameter data column name ({df_columns})")
|
|
45
46
|
|
|
46
|
-
fig, ax = plot_start(
|
|
47
|
+
fig, ax = plot_start(width, height, bottom, output, show)
|
|
47
48
|
|
|
48
49
|
group_columns = [clusters]
|
|
49
50
|
|
|
@@ -78,7 +79,7 @@ def box_base(
|
|
|
78
79
|
colors = new_df["color"]
|
|
79
80
|
|
|
80
81
|
# scatter
|
|
81
|
-
|
|
82
|
+
sns.boxplot(
|
|
82
83
|
data=df,
|
|
83
84
|
x=clusters,
|
|
84
85
|
y=value,
|
|
@@ -87,6 +88,7 @@ def box_base(
|
|
|
87
88
|
fliersize=marker_size,
|
|
88
89
|
orient=orient,
|
|
89
90
|
whis=whis,
|
|
91
|
+
ax=ax,
|
|
90
92
|
flierprops={'marker': 'o', 'markersize': marker_size},
|
|
91
93
|
boxprops={'linestyle': '-', 'linewidth': line_width},
|
|
92
94
|
whiskerprops={'linestyle': '-', 'linewidth': line_width},
|
|
@@ -95,7 +97,7 @@ def box_base(
|
|
|
95
97
|
**kwargs
|
|
96
98
|
)
|
|
97
99
|
|
|
98
|
-
lines =
|
|
100
|
+
lines = ax.lines
|
|
99
101
|
|
|
100
102
|
for line in lines:
|
|
101
103
|
line.set_linewidth(line_width)
|
|
@@ -107,7 +109,9 @@ def box_base(
|
|
|
107
109
|
ax.spines['left'].set_linewidth(line_width)
|
|
108
110
|
ax.spines['right'].set_linewidth(line_width)
|
|
109
111
|
|
|
110
|
-
|
|
112
|
+
ax.yaxis.grid(True, linestyle='-', linewidth=line_width)
|
|
113
|
+
|
|
114
|
+
plot_end(fig, title, x_name, y_name, output, show, close)
|
|
111
115
|
|
|
112
116
|
|
|
113
117
|
def box_trait(
|
|
@@ -133,6 +137,7 @@ def box_trait(
|
|
|
133
137
|
title: str = None,
|
|
134
138
|
output: path = None,
|
|
135
139
|
show: bool = True,
|
|
140
|
+
close: bool = False,
|
|
136
141
|
**kwargs: Any
|
|
137
142
|
) -> None:
|
|
138
143
|
|
|
@@ -170,6 +175,7 @@ def box_trait(
|
|
|
170
175
|
title=f"{title} {trait_}" if title is not None else title,
|
|
171
176
|
output=os.path.join(output, f"cell_{trait_}_score_box.pdf") if output is not None else None,
|
|
172
177
|
show=show,
|
|
178
|
+
close=close,
|
|
173
179
|
**kwargs
|
|
174
180
|
)
|
|
175
181
|
|
sciv/plot/_bubble_.py
CHANGED
|
@@ -25,10 +25,11 @@ def bubble(
|
|
|
25
25
|
bottom: float = 0,
|
|
26
26
|
output: path = None,
|
|
27
27
|
show: bool = True,
|
|
28
|
+
close: bool = False,
|
|
28
29
|
**kwargs: Any
|
|
29
30
|
):
|
|
30
31
|
|
|
31
|
-
fig, ax = plot_start(
|
|
32
|
+
fig, ax = plot_start(width, height, bottom, output, show)
|
|
32
33
|
|
|
33
34
|
if size is not None:
|
|
34
35
|
_size_ = df[size].values
|
|
@@ -49,4 +50,4 @@ def bubble(
|
|
|
49
50
|
**kwargs
|
|
50
51
|
)
|
|
51
52
|
|
|
52
|
-
plot_end(fig, output, show)
|
|
53
|
+
plot_end(fig, title, x_name, y_name, output, show, close)
|
sciv/plot/_core_.py
CHANGED
|
@@ -315,7 +315,8 @@ def rate_bar_plot(
|
|
|
315
315
|
title: str = None,
|
|
316
316
|
text_left_move: float = 0.15,
|
|
317
317
|
plot_output: path = None,
|
|
318
|
-
show: bool = True
|
|
318
|
+
show: bool = True,
|
|
319
|
+
close: bool = False
|
|
319
320
|
) -> None:
|
|
320
321
|
|
|
321
322
|
if dir_name is not None:
|
|
@@ -349,7 +350,8 @@ def rate_bar_plot(
|
|
|
349
350
|
rotation=rotation,
|
|
350
351
|
text_left_move=text_left_move,
|
|
351
352
|
output=new_path if plot_output is not None else None,
|
|
352
|
-
show=show
|
|
353
|
+
show=show,
|
|
354
|
+
close=close
|
|
353
355
|
)
|
|
354
356
|
|
|
355
357
|
|
|
@@ -373,7 +375,8 @@ def rate_circular_bar_plot(
|
|
|
373
375
|
y_limit: Tuple = (-0.5, 1),
|
|
374
376
|
y_axis_scale: Tuple = (0, 1),
|
|
375
377
|
plot_output: path = None,
|
|
376
|
-
show: bool = True
|
|
378
|
+
show: bool = True,
|
|
379
|
+
close: bool = False
|
|
377
380
|
) -> None:
|
|
378
381
|
|
|
379
382
|
if dir_name is not None:
|
|
@@ -412,7 +415,8 @@ def rate_circular_bar_plot(
|
|
|
412
415
|
y_limit=y_limit,
|
|
413
416
|
y_axis_scale=y_axis_scale,
|
|
414
417
|
output=new_path if plot_output is not None else None,
|
|
415
|
-
show=show
|
|
418
|
+
show=show,
|
|
419
|
+
close=close
|
|
416
420
|
)
|
|
417
421
|
|
|
418
422
|
|
sciv/plot/_graph_.py
CHANGED
|
@@ -41,15 +41,16 @@ def graph(
|
|
|
41
41
|
bottom: float = 0,
|
|
42
42
|
is_font: bool = False,
|
|
43
43
|
output: path = None,
|
|
44
|
-
show: bool = True
|
|
44
|
+
show: bool = True,
|
|
45
|
+
close: bool = False
|
|
45
46
|
) -> None:
|
|
46
47
|
if output is None and not show:
|
|
47
48
|
ul.log(__name__).error(f"At least one of the `output` and `show` parameters is required")
|
|
48
49
|
raise ValueError(f"At least one of the `output` and `show` parameters is required")
|
|
49
50
|
|
|
50
|
-
plt.figure(figsize=(width, height), dpi=
|
|
51
|
+
plt.figure(figsize=(width, height), dpi=300)
|
|
51
52
|
|
|
52
|
-
fig, ax = plot_start(
|
|
53
|
+
fig, ax = plot_start(width, height, bottom, output, show)
|
|
53
54
|
|
|
54
55
|
# Determine whether it is a square array
|
|
55
56
|
if data.shape[0] != data.shape[1]:
|
|
@@ -94,7 +95,7 @@ def graph(
|
|
|
94
95
|
else:
|
|
95
96
|
nx.draw(gr, pos=pos, labels={}, **options)
|
|
96
97
|
|
|
97
|
-
plot_end(fig, output, show)
|
|
98
|
+
plot_end(fig, title, x_name, y_name, output, show, close)
|
|
98
99
|
|
|
99
100
|
|
|
100
101
|
def communities_graph(
|
|
@@ -113,7 +114,8 @@ def communities_graph(
|
|
|
113
114
|
start_color_index: int = 0,
|
|
114
115
|
color_step_size: int = 0,
|
|
115
116
|
output: path = None,
|
|
116
|
-
show: bool = True
|
|
117
|
+
show: bool = True,
|
|
118
|
+
close: bool = False
|
|
117
119
|
):
|
|
118
120
|
if output is None and not show:
|
|
119
121
|
ul.log(__name__).error(f"At least one of the `output` and `show` parameters is required")
|
|
@@ -133,7 +135,7 @@ def communities_graph(
|
|
|
133
135
|
|
|
134
136
|
type_colors = type_20_colors if len(__hue_order__) <= 20 else type_50_colors
|
|
135
137
|
|
|
136
|
-
fig, ax = plot_start(
|
|
138
|
+
fig, ax = plot_start(width, height, bottom, output, show)
|
|
137
139
|
|
|
138
140
|
ul.log(__name__).info("Get position")
|
|
139
141
|
color_index = 0
|
|
@@ -170,7 +172,7 @@ def communities_graph(
|
|
|
170
172
|
width=line_widths
|
|
171
173
|
)
|
|
172
174
|
|
|
173
|
-
plot_end(fig, output, show)
|
|
175
|
+
plot_end(fig, title, x_name, y_name, output, show, close)
|
|
174
176
|
|
|
175
177
|
|
|
176
178
|
def network_two_types(
|
|
@@ -197,7 +199,8 @@ def network_two_types(
|
|
|
197
199
|
is_fluctuate: bool = True,
|
|
198
200
|
layout_type: str = 'spring',
|
|
199
201
|
output: path = None,
|
|
200
|
-
show: bool = True
|
|
202
|
+
show: bool = True,
|
|
203
|
+
close: bool = False
|
|
201
204
|
):
|
|
202
205
|
if output is None and not show:
|
|
203
206
|
ul.log(__name__).error(f"At least one of the `output` and `show` parameters is required")
|
|
@@ -375,4 +378,4 @@ def network_two_types(
|
|
|
375
378
|
|
|
376
379
|
plt.axis('off')
|
|
377
380
|
|
|
378
|
-
plot_end(fig, output, show)
|
|
381
|
+
plot_end(fig, output=output, show=show, close=close)
|
sciv/plot/_heat_map_.py
CHANGED
|
@@ -68,6 +68,7 @@ def heatmap_annotation(
|
|
|
68
68
|
cmap: str = "Oranges",
|
|
69
69
|
is_sort: bool = True,
|
|
70
70
|
show: bool = True,
|
|
71
|
+
close: bool = False,
|
|
71
72
|
output: path = None,
|
|
72
73
|
**kwargs
|
|
73
74
|
) -> None:
|
|
@@ -130,12 +131,13 @@ def heatmap_annotation(
|
|
|
130
131
|
:param cmap: Display color themes for heat maps;
|
|
131
132
|
:param is_sort: If set to true, when displaying the heatmap, the row and column names are sorted and displayed;
|
|
132
133
|
:param show: If true, display the image;
|
|
134
|
+
:param close: If true, close the image;
|
|
133
135
|
:param output: Output file for image saving;
|
|
134
136
|
:return: Display of image or saved file.
|
|
135
137
|
"""
|
|
136
138
|
|
|
137
139
|
ul.log(__name__).info("Start plotting the heatmap")
|
|
138
|
-
fig, ax = plot_start(
|
|
140
|
+
fig, ax = plot_start(width, height, bottom, output, show)
|
|
139
141
|
|
|
140
142
|
data = adata.copy()
|
|
141
143
|
|
|
@@ -287,7 +289,7 @@ def heatmap_annotation(
|
|
|
287
289
|
**kwargs
|
|
288
290
|
)
|
|
289
291
|
|
|
290
|
-
plot_end(fig, output, show)
|
|
292
|
+
plot_end(fig, title, x_name, y_name, output, show, close)
|
|
291
293
|
|
|
292
294
|
|
|
293
295
|
def heatmap(
|
|
@@ -308,9 +310,10 @@ def heatmap(
|
|
|
308
310
|
y_name: str = None,
|
|
309
311
|
output: path = None,
|
|
310
312
|
show: bool = True,
|
|
313
|
+
close: bool = False,
|
|
311
314
|
**kwargs: Any
|
|
312
315
|
) -> None:
|
|
313
|
-
fig, ax = plot_start(
|
|
316
|
+
fig, ax = plot_start(width, height, bottom, output, show)
|
|
314
317
|
|
|
315
318
|
data = adata.copy()
|
|
316
319
|
|
|
@@ -337,4 +340,4 @@ def heatmap(
|
|
|
337
340
|
# noinspection PyUnresolvedReferences
|
|
338
341
|
plt.setp(heat_map.ax_heatmap.get_xticklabels(), rotation=rotation)
|
|
339
342
|
|
|
340
|
-
plot_end(fig, output, show)
|
|
343
|
+
plot_end(fig, title, x_name, y_name, output, show, close)
|
sciv/plot/_kde_.py
CHANGED
|
@@ -28,11 +28,12 @@ def kde(
|
|
|
28
28
|
is_legend: bool = True,
|
|
29
29
|
output: path = None,
|
|
30
30
|
show: bool = True,
|
|
31
|
+
close: bool = False,
|
|
31
32
|
**kwargs: Any
|
|
32
33
|
) -> None:
|
|
33
34
|
ul.log(__name__).info("Start plotting the Kernel density estimation chart")
|
|
34
35
|
|
|
35
|
-
fig, ax = plot_start(
|
|
36
|
+
fig, ax = plot_start(width, height, bottom, output, show)
|
|
36
37
|
|
|
37
38
|
data = check_adata_get(adata, layer=layer, is_dense=True, is_matrix=False)
|
|
38
39
|
|
|
@@ -72,4 +73,4 @@ def kde(
|
|
|
72
73
|
if is_legend:
|
|
73
74
|
ax.legend(list(adata.obs.index))
|
|
74
75
|
|
|
75
|
-
plot_end(fig, output, show)
|
|
76
|
+
plot_end(fig, title, x_name, y_name, output, show, close)
|
sciv/plot/_line_.py
CHANGED
|
@@ -40,10 +40,11 @@ def stability_line(
|
|
|
40
40
|
output: Optional[path] = None,
|
|
41
41
|
is_str: bool = True,
|
|
42
42
|
show: bool = True,
|
|
43
|
+
close: bool = False,
|
|
43
44
|
**kwargs: Any
|
|
44
45
|
) -> None:
|
|
45
46
|
|
|
46
|
-
fig, ax = plot_start(
|
|
47
|
+
fig, ax = plot_start(width, height, bottom, output, show)
|
|
47
48
|
|
|
48
49
|
new_data = data.copy()
|
|
49
50
|
|
|
@@ -122,4 +123,4 @@ def stability_line(
|
|
|
122
123
|
else:
|
|
123
124
|
plt.xticks(x_ticks, rotation=x_name_rotation)
|
|
124
125
|
|
|
125
|
-
plot_end(fig, output, show)
|
|
126
|
+
plot_end(fig, title, x_name, y_name, output, show, close)
|
sciv/plot/_pie_.py
CHANGED
|
@@ -27,9 +27,10 @@ def base_pie(
|
|
|
27
27
|
autopct: str = '%1.2f%%',
|
|
28
28
|
output: path = None,
|
|
29
29
|
show: bool = True,
|
|
30
|
+
close: bool = False,
|
|
30
31
|
**kwargs: Any
|
|
31
32
|
) -> None:
|
|
32
|
-
fig, ax = plot_start(
|
|
33
|
+
fig, ax = plot_start(width, height, bottom, output, show)
|
|
33
34
|
|
|
34
35
|
size = len(values)
|
|
35
36
|
|
|
@@ -54,7 +55,7 @@ def base_pie(
|
|
|
54
55
|
|
|
55
56
|
ax.axis('off')
|
|
56
57
|
|
|
57
|
-
plot_end(fig, output, show)
|
|
58
|
+
plot_end(fig, title, x_name, y_name, output, show, close)
|
|
58
59
|
|
|
59
60
|
|
|
60
61
|
def pie_label(
|
|
@@ -75,9 +76,10 @@ def pie_label(
|
|
|
75
76
|
colors: list = None,
|
|
76
77
|
output: path = None,
|
|
77
78
|
show: bool = True,
|
|
79
|
+
close: bool = False,
|
|
78
80
|
**kwargs: Any
|
|
79
81
|
) -> None:
|
|
80
|
-
fig, ax = plot_start(
|
|
82
|
+
fig, ax = plot_start(width, height, bottom, output, show)
|
|
81
83
|
|
|
82
84
|
# judge
|
|
83
85
|
df_columns = list(df.columns)
|
|
@@ -128,7 +130,7 @@ def pie_label(
|
|
|
128
130
|
|
|
129
131
|
ax.axis('off')
|
|
130
132
|
|
|
131
|
-
plot_end(fig, output, show)
|
|
133
|
+
plot_end(fig, title, x_name, y_name, output, show, close)
|
|
132
134
|
|
|
133
135
|
|
|
134
136
|
def pie_trait(
|
|
@@ -150,6 +152,7 @@ def pie_trait(
|
|
|
150
152
|
colors: list = None,
|
|
151
153
|
output: path = None,
|
|
152
154
|
show: bool = True,
|
|
155
|
+
close: bool = False,
|
|
153
156
|
**kwargs: Any
|
|
154
157
|
) -> None:
|
|
155
158
|
trait_cluster_map_key_list = list(trait_cluster_map.keys())
|
|
@@ -191,6 +194,7 @@ def pie_trait(
|
|
|
191
194
|
title=f"{title} {trait_}" if title is not None else title,
|
|
192
195
|
output=os.path.join(output, f"cell_{trait_}_score_pie.pdf") if output is not None else None,
|
|
193
196
|
show=show,
|
|
197
|
+
close=close,
|
|
194
198
|
**kwargs
|
|
195
199
|
)
|
|
196
200
|
|
sciv/plot/_radar_.py
CHANGED
|
@@ -35,10 +35,11 @@ def radar(
|
|
|
35
35
|
y_axis_scale: Tuple = (0, 1),
|
|
36
36
|
output: path = None,
|
|
37
37
|
show: bool = True,
|
|
38
|
+
close: bool = False,
|
|
38
39
|
**kwargs: Any
|
|
39
40
|
):
|
|
40
41
|
|
|
41
|
-
fig, ax = plot_start(
|
|
42
|
+
fig, ax = plot_start(width, height, bottom, output, show)
|
|
42
43
|
|
|
43
44
|
ax_x = list(ax_x)
|
|
44
45
|
ax_y = list(ax_y)
|
|
@@ -96,7 +97,7 @@ def radar(
|
|
|
96
97
|
# Adjust the layout to prevent label overlap
|
|
97
98
|
plt.tight_layout()
|
|
98
99
|
|
|
99
|
-
plot_end(fig, output, show)
|
|
100
|
+
plot_end(fig, title, x_name, y_name, output, show, close)
|
|
100
101
|
|
|
101
102
|
|
|
102
103
|
def radar_trait(
|
|
@@ -119,6 +120,7 @@ def radar_trait(
|
|
|
119
120
|
y_axis_scale: Tuple = (0, 1),
|
|
120
121
|
output: path = None,
|
|
121
122
|
show: bool = True,
|
|
123
|
+
close: bool = False,
|
|
122
124
|
**kwargs: Any
|
|
123
125
|
):
|
|
124
126
|
|
|
@@ -166,6 +168,7 @@ def radar_trait(
|
|
|
166
168
|
center_text=trait_,
|
|
167
169
|
output=os.path.join(output, f"{trait_}_enrichment_radar.pdf") if output is not None else None,
|
|
168
170
|
show=show,
|
|
171
|
+
close=close,
|
|
169
172
|
**kwargs
|
|
170
173
|
)
|
|
171
174
|
|
sciv/plot/_scatter_.py
CHANGED
|
@@ -5,6 +5,7 @@ from typing import Union, Tuple, Optional, Any
|
|
|
5
5
|
|
|
6
6
|
import matplotlib
|
|
7
7
|
import numpy as np
|
|
8
|
+
import pandas as pd
|
|
8
9
|
from anndata import AnnData
|
|
9
10
|
from matplotlib import pyplot as plt
|
|
10
11
|
from pandas import DataFrame
|
|
@@ -45,9 +46,10 @@ def scatter_base(
|
|
|
45
46
|
is_text: bool = False,
|
|
46
47
|
output: path = None,
|
|
47
48
|
show: bool = True,
|
|
49
|
+
close: bool = False,
|
|
48
50
|
**kwargs: Any
|
|
49
51
|
) -> None:
|
|
50
|
-
fig, ax = plot_start(
|
|
52
|
+
fig, ax = plot_start(width, height, bottom, output, show)
|
|
51
53
|
|
|
52
54
|
# scatter
|
|
53
55
|
if number:
|
|
@@ -82,7 +84,8 @@ def scatter_base(
|
|
|
82
84
|
if legend is not None:
|
|
83
85
|
df.loc[df[df["__hue__"] == elem].index, "__hue__"] = legend[elem]
|
|
84
86
|
colors.update(
|
|
85
|
-
{legend[elem]: type_colors[start_color_index + i * color_step_size + __hue_order__.index(elem)]}
|
|
87
|
+
{legend[elem]: type_colors[start_color_index + i * color_step_size + __hue_order__.index(elem)]}
|
|
88
|
+
)
|
|
86
89
|
else:
|
|
87
90
|
colors.update(
|
|
88
91
|
{
|
|
@@ -147,7 +150,76 @@ def scatter_base(
|
|
|
147
150
|
ax.spines['bottom'].set_visible(False)
|
|
148
151
|
ax.spines['left'].set_visible(False)
|
|
149
152
|
|
|
150
|
-
plot_end(fig, output, show)
|
|
153
|
+
plot_end(fig, title, x_name, y_name, output, show, close)
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def scatter_3d(
|
|
157
|
+
df: DataFrame,
|
|
158
|
+
x: str,
|
|
159
|
+
y: str,
|
|
160
|
+
z: str,
|
|
161
|
+
hue: str = None,
|
|
162
|
+
x_name: str = None,
|
|
163
|
+
y_name: str = None,
|
|
164
|
+
z_name: str = None,
|
|
165
|
+
title: str = None,
|
|
166
|
+
width: float = 2,
|
|
167
|
+
height: float = 2,
|
|
168
|
+
bottom: float = 0,
|
|
169
|
+
edge_color: str = None,
|
|
170
|
+
size: Union[float, collection] = 1.0,
|
|
171
|
+
legend_name: str = None,
|
|
172
|
+
output: path = None,
|
|
173
|
+
show: bool = True,
|
|
174
|
+
close: bool = False,
|
|
175
|
+
**kwargs: Any
|
|
176
|
+
):
|
|
177
|
+
if output is None and not show:
|
|
178
|
+
ul.log(__name__).error(f"At least one of the `output` and `show` parameters is required")
|
|
179
|
+
raise ValueError(f"At least one of the `output` and `show` parameters is required")
|
|
180
|
+
|
|
181
|
+
fig, ax = plt.subplots(figsize=(width, height))
|
|
182
|
+
fig.subplots_adjust(bottom=bottom, projection='3d')
|
|
183
|
+
|
|
184
|
+
hue_cat = pd.Categorical(df[hue])
|
|
185
|
+
|
|
186
|
+
scatter = ax.scatter(
|
|
187
|
+
df[x],
|
|
188
|
+
df[y],
|
|
189
|
+
df[z],
|
|
190
|
+
c=hue_cat.codes,
|
|
191
|
+
cmap='tab20',
|
|
192
|
+
s=size,
|
|
193
|
+
edgecolors=edge_color,
|
|
194
|
+
**kwargs
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
# 设置坐标轴标签和标题
|
|
198
|
+
|
|
199
|
+
if x_name is not None:
|
|
200
|
+
ax.set_xlabel(x_name)
|
|
201
|
+
|
|
202
|
+
if y_name is not None:
|
|
203
|
+
ax.set_ylabel(y_name)
|
|
204
|
+
|
|
205
|
+
if z_name is not None:
|
|
206
|
+
ax.set_zlabel(z_name)
|
|
207
|
+
|
|
208
|
+
if title is not None:
|
|
209
|
+
ax.set_title(title)
|
|
210
|
+
|
|
211
|
+
unique_types = hue_cat.categories
|
|
212
|
+
legend_elements = [
|
|
213
|
+
plt.Line2D(
|
|
214
|
+
[0], [0], marker='o', color='w', label=type_,
|
|
215
|
+
markerfacecolor=scatter.cmap(scatter.norm(i))
|
|
216
|
+
)
|
|
217
|
+
for i, type_ in enumerate(unique_types)
|
|
218
|
+
]
|
|
219
|
+
|
|
220
|
+
ax.legend(handles=legend_elements, title=legend_name, bbox_to_anchor=(1.05, 1), loc='upper left')
|
|
221
|
+
|
|
222
|
+
plot_end(fig, None, None, None, output, show, close)
|
|
151
223
|
|
|
152
224
|
|
|
153
225
|
def scatter_atac(
|
|
@@ -169,6 +241,7 @@ def scatter_atac(
|
|
|
169
241
|
is_text: bool = False,
|
|
170
242
|
output: path = None,
|
|
171
243
|
show: bool = True,
|
|
244
|
+
close: bool = False,
|
|
172
245
|
**kwargs: Any
|
|
173
246
|
) -> None:
|
|
174
247
|
# DataFrame
|
|
@@ -195,6 +268,7 @@ def scatter_atac(
|
|
|
195
268
|
legend_fontsize=legend_fontsize,
|
|
196
269
|
output=output,
|
|
197
270
|
show=show,
|
|
271
|
+
close=close,
|
|
198
272
|
right=0.75,
|
|
199
273
|
**kwargs
|
|
200
274
|
)
|
|
@@ -225,6 +299,7 @@ def scatter_trait(
|
|
|
225
299
|
legend: dict = None,
|
|
226
300
|
output: path = None,
|
|
227
301
|
show: bool = True,
|
|
302
|
+
close: bool = False,
|
|
228
303
|
**kwargs: Any
|
|
229
304
|
) -> None:
|
|
230
305
|
data: AnnData = trait_adata.copy()
|
|
@@ -285,6 +360,7 @@ def scatter_trait(
|
|
|
285
360
|
output, f"cell_{trait_}_score_{layer_}.pdf" if layer_ is not None else f"cell_{trait_}_score.pdf"
|
|
286
361
|
) if output is not None else None,
|
|
287
362
|
show=show,
|
|
363
|
+
close=close,
|
|
288
364
|
**kwargs
|
|
289
365
|
)
|
|
290
366
|
|
|
@@ -336,9 +412,10 @@ def volcano_base(
|
|
|
336
412
|
y_name: Optional[str] = None,
|
|
337
413
|
output: path = None,
|
|
338
414
|
show: bool = True,
|
|
415
|
+
close: bool = False,
|
|
339
416
|
**kwargs: Any
|
|
340
417
|
):
|
|
341
|
-
fig, ax = plot_start(
|
|
418
|
+
fig, ax = plot_start(width, height, bottom, output, show)
|
|
342
419
|
|
|
343
420
|
if palette is None:
|
|
344
421
|
palette = ["#01c5c4", "#686d76", "#ff414d"]
|
|
@@ -352,7 +429,7 @@ def volcano_base(
|
|
|
352
429
|
plt.axvline(axv_left_value, color='grey', linestyle='--')
|
|
353
430
|
plt.axvline(axv_right_value, color='grey', linestyle='--')
|
|
354
431
|
|
|
355
|
-
plot_end(fig, output, show)
|
|
432
|
+
plot_end(fig, title, x_name, y_name, output, show, close)
|
|
356
433
|
|
|
357
434
|
|
|
358
435
|
def manhattan_causal_variant(
|
|
@@ -375,9 +452,9 @@ def manhattan_causal_variant(
|
|
|
375
452
|
y_limit: Tuple[float, float] = (0, 1),
|
|
376
453
|
output: path = None,
|
|
377
454
|
show: bool = True,
|
|
455
|
+
close: bool = False,
|
|
378
456
|
**kwargs: Any
|
|
379
457
|
):
|
|
380
|
-
|
|
381
458
|
df[chr_name] = df[chr_name].astype(chrtype)
|
|
382
459
|
|
|
383
460
|
if is_sort:
|
|
@@ -390,7 +467,7 @@ def manhattan_causal_variant(
|
|
|
390
467
|
colors = type_20_colors.copy()
|
|
391
468
|
colors.extend(type_set_colors)
|
|
392
469
|
|
|
393
|
-
fig, ax = plot_start(
|
|
470
|
+
fig, ax = plot_start(width, height, bottom, output, show)
|
|
394
471
|
|
|
395
472
|
x_labels = []
|
|
396
473
|
x_labels_pos = []
|
|
@@ -434,7 +511,7 @@ def manhattan_causal_variant(
|
|
|
434
511
|
ax.set_xlim([0, len(df)])
|
|
435
512
|
ax.set_ylim(y_limit)
|
|
436
513
|
|
|
437
|
-
plot_end(fig, output, show)
|
|
514
|
+
plot_end(fig, title, x_name, y_name, output, show, close)
|
|
438
515
|
|
|
439
516
|
|
|
440
517
|
def pseudo_time_score(
|
|
@@ -454,11 +531,12 @@ def pseudo_time_score(
|
|
|
454
531
|
size: Union[float, collection] = 1.0,
|
|
455
532
|
output: path = None,
|
|
456
533
|
show: bool = True,
|
|
534
|
+
close: bool = False,
|
|
457
535
|
**kwargs: Any
|
|
458
536
|
):
|
|
459
537
|
from scipy.signal import savgol_filter
|
|
460
538
|
|
|
461
|
-
fig, ax = plot_start(
|
|
539
|
+
fig, ax = plot_start(width, height, bottom, output, show)
|
|
462
540
|
|
|
463
541
|
pseudo_times = df[x].values
|
|
464
542
|
scores = df[y].values
|
|
@@ -482,4 +560,4 @@ def pseudo_time_score(
|
|
|
482
560
|
|
|
483
561
|
plt.tight_layout()
|
|
484
562
|
|
|
485
|
-
plot_end(fig, output, show)
|
|
563
|
+
plot_end(fig, title, x_name, y_name, output, show, close)
|
sciv/plot/_venn_.py
CHANGED
|
@@ -26,9 +26,10 @@ def three_venn(
|
|
|
26
26
|
title: str = None,
|
|
27
27
|
output: path = None,
|
|
28
28
|
show: bool = True,
|
|
29
|
+
close: bool = False,
|
|
29
30
|
**kwargs: Any
|
|
30
31
|
) -> None:
|
|
31
|
-
fig, ax = plot_start(
|
|
32
|
+
fig, ax = plot_start(width, height, bottom, output, show)
|
|
32
33
|
|
|
33
34
|
if colors is None:
|
|
34
35
|
colors = type_set_colors[:3]
|
|
@@ -54,7 +55,7 @@ def three_venn(
|
|
|
54
55
|
|
|
55
56
|
ax.axis('off')
|
|
56
57
|
|
|
57
|
-
plot_end(fig, output, show)
|
|
58
|
+
plot_end(fig, title, x_name, y_name, output, show, close)
|
|
58
59
|
|
|
59
60
|
|
|
60
61
|
def two_venn(
|
|
@@ -71,9 +72,10 @@ def two_venn(
|
|
|
71
72
|
title: str = None,
|
|
72
73
|
output: path = None,
|
|
73
74
|
show: bool = True,
|
|
75
|
+
close: bool = False,
|
|
74
76
|
**kwargs: Any
|
|
75
77
|
) -> None:
|
|
76
|
-
fig, ax = plot_start(
|
|
78
|
+
fig, ax = plot_start(width, height, bottom, output, show)
|
|
77
79
|
|
|
78
80
|
if colors is None:
|
|
79
81
|
colors = type_set_colors[:2]
|
|
@@ -96,4 +98,4 @@ def two_venn(
|
|
|
96
98
|
|
|
97
99
|
ax.axis('off')
|
|
98
100
|
|
|
99
|
-
plot_end(fig, output, show)
|
|
101
|
+
plot_end(fig, title, x_name, y_name, output, show, close)
|
sciv/plot/_violin_.py
CHANGED
|
@@ -29,11 +29,12 @@ def violin_base(
|
|
|
29
29
|
rotation: float = 65,
|
|
30
30
|
line_width: float = 0.5,
|
|
31
31
|
title: str = None,
|
|
32
|
-
split: bool =
|
|
32
|
+
split: bool = False,
|
|
33
33
|
is_sort: bool = True,
|
|
34
34
|
order_names: list = None,
|
|
35
35
|
output: path = None,
|
|
36
36
|
show: bool = True,
|
|
37
|
+
close: bool = False,
|
|
37
38
|
**kwargs: Any
|
|
38
39
|
) -> None:
|
|
39
40
|
# judge
|
|
@@ -50,7 +51,7 @@ def violin_base(
|
|
|
50
51
|
f"The `hue` ({hue}) parameter must be in the `df` parameter data column name ({df_columns})")
|
|
51
52
|
raise ValueError(f"The `hue` ({hue}) parameter must be in the `df` parameter data column name ({df_columns})")
|
|
52
53
|
|
|
53
|
-
fig, ax = plot_start(
|
|
54
|
+
fig, ax = plot_start(width, height, bottom, output, show)
|
|
54
55
|
|
|
55
56
|
group_columns = [clusters]
|
|
56
57
|
|
|
@@ -98,15 +99,15 @@ def violin_base(
|
|
|
98
99
|
)
|
|
99
100
|
|
|
100
101
|
# set coordinate
|
|
101
|
-
for
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
102
|
+
for _ax_ in g.axes.flat:
|
|
103
|
+
_ax_.spines['top'].set_linewidth(line_width)
|
|
104
|
+
_ax_.spines['right'].set_linewidth(line_width)
|
|
105
|
+
_ax_.spines['bottom'].set_linewidth(line_width)
|
|
106
|
+
_ax_.spines['left'].set_linewidth(line_width)
|
|
106
107
|
# Set the rotation angle of the x-axis labels
|
|
107
|
-
|
|
108
|
+
_ax_.tick_params(axis='x', rotation=rotation)
|
|
108
109
|
|
|
109
|
-
plot_end(fig, output, show)
|
|
110
|
+
plot_end(fig, title, x_name, y_name, output, show, close)
|
|
110
111
|
|
|
111
112
|
|
|
112
113
|
def violin_trait(
|
|
@@ -124,30 +125,29 @@ def violin_trait(
|
|
|
124
125
|
rotation: float = 65,
|
|
125
126
|
line_width: float = 0.1,
|
|
126
127
|
bottom: float = 0.3,
|
|
127
|
-
split: bool =
|
|
128
|
+
split: bool = False,
|
|
128
129
|
is_sort: bool = True,
|
|
129
130
|
order_names: list = None,
|
|
130
131
|
title: str = None,
|
|
131
132
|
output: path = None,
|
|
132
133
|
show: bool = True,
|
|
134
|
+
close: bool = False,
|
|
133
135
|
**kwargs: Any
|
|
134
136
|
) -> None:
|
|
135
137
|
|
|
136
138
|
data: DataFrame = trait_df.copy()
|
|
137
139
|
|
|
138
|
-
def trait_plot(
|
|
140
|
+
def trait_plot(_trait_: Union[str, list], _cell_df_: DataFrame) -> None:
|
|
139
141
|
"""
|
|
140
142
|
show plot
|
|
141
|
-
:param
|
|
142
|
-
:param
|
|
143
|
+
:param _trait_: trait name
|
|
144
|
+
:param _cell_df_:
|
|
143
145
|
:return: None
|
|
144
146
|
"""
|
|
145
|
-
ul.log(__name__).info("Plotting box {}".format(
|
|
147
|
+
ul.log(__name__).info("Plotting box {}".format(_trait_))
|
|
146
148
|
# get gene score
|
|
147
|
-
_filename_: str =
|
|
148
|
-
trait_score =
|
|
149
|
-
atac_cell_df_[trait_column_name] == trait_ if isinstance(trait_, str) else atac_cell_df_[
|
|
150
|
-
trait_column_name].isin(trait_)]
|
|
149
|
+
_filename_: str = _trait_
|
|
150
|
+
trait_score = _cell_df_[_cell_df_[trait_column_name] == _trait_]
|
|
151
151
|
# Sort gene scores from small to large
|
|
152
152
|
violin_base(
|
|
153
153
|
df=trait_score,
|
|
@@ -169,6 +169,7 @@ def violin_trait(
|
|
|
169
169
|
title=f"{title} {_filename_}" if title is not None else title,
|
|
170
170
|
output=os.path.join(output, f"cell_{_filename_}_score_cat_{kind}.pdf") if output is not None else None,
|
|
171
171
|
show=show,
|
|
172
|
+
close=close,
|
|
172
173
|
**kwargs
|
|
173
174
|
)
|
|
174
175
|
|
|
@@ -176,9 +177,10 @@ def violin_trait(
|
|
|
176
177
|
trait_list = list(set(data[trait_column_name]))
|
|
177
178
|
# judge trait
|
|
178
179
|
if trait_name != "All":
|
|
179
|
-
if isinstance(trait_name, str)
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
if isinstance(trait_name, str):
|
|
181
|
+
if trait_name not in trait_list:
|
|
182
|
+
ul.log(__name__).error(f"The {trait_name} trait/disease is not in the trait/disease list {trait_list}.")
|
|
183
|
+
raise ValueError(f"The {trait_name} trait/disease is not in the trait/disease list {trait_list}.")
|
|
182
184
|
else:
|
|
183
185
|
for tn in trait_name:
|
|
184
186
|
if tn not in trait_list:
|
sciv/preprocessing/_scvi_.py
CHANGED
|
@@ -8,7 +8,7 @@ import numpy as np
|
|
|
8
8
|
import pandas as pd
|
|
9
9
|
|
|
10
10
|
from anndata import AnnData
|
|
11
|
-
from torch import OutOfMemoryError
|
|
11
|
+
from torch.cuda import OutOfMemoryError
|
|
12
12
|
|
|
13
13
|
from .. import util as ul
|
|
14
14
|
from ..tool import umap, tsne
|
|
@@ -134,7 +134,7 @@ def poisson_vi(
|
|
|
134
134
|
ul.log(__name__).warning(f"GPU failed to run, try to switch to CPU running.\n {ome}")
|
|
135
135
|
|
|
136
136
|
try:
|
|
137
|
-
model = scvi.external.POISSONVI.load(model_dir, adata=adata, accelerator="cpu",
|
|
137
|
+
model = scvi.external.POISSONVI.load(model_dir, adata=adata, accelerator="cpu", device="cpu")
|
|
138
138
|
except Exception as e:
|
|
139
139
|
ul.log(__name__).error(f"File `model.pt` failed to load, you can execute `Poisson VI` again by deleting file `model.pt` ({model_dir}/model.pt).\n {e}")
|
|
140
140
|
raise ValueError(f"File `model.pt` failed to load, you can execute `Poisson VI` again by deleting file `model.pt` ({model_dir}/model.pt).")
|
sciv/util/_core_.py
CHANGED
|
@@ -415,9 +415,6 @@ def check_gpu_availability(verbose: bool = True) -> bool:
|
|
|
415
415
|
|
|
416
416
|
|
|
417
417
|
def plot_start(
|
|
418
|
-
title: str = None,
|
|
419
|
-
x_name: str = None,
|
|
420
|
-
y_name: str = None,
|
|
421
418
|
width: float = 2,
|
|
422
419
|
height: float = 2,
|
|
423
420
|
bottom: float = 0,
|
|
@@ -431,6 +428,20 @@ def plot_start(
|
|
|
431
428
|
fig, ax = plt.subplots(figsize=(width, height))
|
|
432
429
|
fig.subplots_adjust(bottom=bottom)
|
|
433
430
|
|
|
431
|
+
return fig, ax
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
def plot_end(
|
|
435
|
+
fig,
|
|
436
|
+
title: str = None,
|
|
437
|
+
x_name: str = None,
|
|
438
|
+
y_name: str = None,
|
|
439
|
+
output: str = None,
|
|
440
|
+
show: bool = True,
|
|
441
|
+
close: bool = False,
|
|
442
|
+
dpi: float = 300
|
|
443
|
+
):
|
|
444
|
+
|
|
434
445
|
if title is not None:
|
|
435
446
|
plt.title(title)
|
|
436
447
|
|
|
@@ -438,12 +449,8 @@ def plot_start(
|
|
|
438
449
|
plt.xlabel(x_name, rotation=0)
|
|
439
450
|
|
|
440
451
|
if y_name is not None:
|
|
441
|
-
plt.
|
|
442
|
-
|
|
443
|
-
return fig, ax
|
|
444
|
-
|
|
452
|
+
plt.ylabel(y_name, rotation=90)
|
|
445
453
|
|
|
446
|
-
def plot_end(fig, output: str, show: bool, dpi: float = 300):
|
|
447
454
|
if output is not None:
|
|
448
455
|
|
|
449
456
|
if output.endswith(".pdf"):
|
|
@@ -451,7 +458,7 @@ def plot_end(fig, output: str, show: bool, dpi: float = 300):
|
|
|
451
458
|
with PdfPages(output) as pdf:
|
|
452
459
|
pdf.savefig(fig)
|
|
453
460
|
|
|
454
|
-
elif output.endswith(".png") or output.endswith(".jpg"):
|
|
461
|
+
elif output.endswith(".png") or output.endswith(".jpg") or output.endswith(".svg"):
|
|
455
462
|
plt.savefig(output, dpi=dpi)
|
|
456
463
|
else:
|
|
457
464
|
plt.savefig(f"{output}.png", dpi=dpi)
|
|
@@ -459,7 +466,8 @@ def plot_end(fig, output: str, show: bool, dpi: float = 300):
|
|
|
459
466
|
if show:
|
|
460
467
|
plt.show()
|
|
461
468
|
|
|
462
|
-
|
|
469
|
+
if close:
|
|
470
|
+
plt.close('all')
|
|
463
471
|
|
|
464
472
|
|
|
465
473
|
def generate_hex_colors(num_colors):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sciv
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.93
|
|
4
4
|
Summary: Unveiling the pivotal cell types involved in variant function regulation at a single-cell resolution
|
|
5
5
|
Project-URL: github, https://github.com/YuZhengM/sciv
|
|
6
6
|
Author-email: Zheng-Min Yu <yuzmbio@163.com>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
sciv/__init__.py,sha256=COyPt3XWQk1gNSxY5bzNCNl0KSdD2QSlvzdw4dw7Z_Y,387
|
|
2
|
+
sciv/file/__init__.py,sha256=8cYLG0S0nilblmyX46CWFrbLr-rmLbO1EEO477pZ-gk,520
|
|
3
|
+
sciv/file/_read_.py,sha256=UZJpN3_5hBiTjzEYO6YXORcE_dqA8HmLpV80nqTLNSo,30554
|
|
4
|
+
sciv/file/_write_.py,sha256=W3M9CmPi7BuKAffz1fdi-vA5DzAFZ7wmcggp33N9Xtg,7848
|
|
5
|
+
sciv/model/__init__.py,sha256=k8SO9FpJaGn2ANqJyaz3HXMas7jH9toPVtpw703kOqg,149
|
|
6
|
+
sciv/model/_core_.py,sha256=qGnBPBqnoEeemPm9WLedwgqb0SmbLe5QVk9fOmFMo_k,52840
|
|
7
|
+
sciv/plot/__init__.py,sha256=2tRNT6TZNz9r38lnna712RGsH7OJ2QkGa37XKgzejHQ,1865
|
|
8
|
+
sciv/plot/_bar_.py,sha256=XgRl8kZvMxnErMdJDu3TfhLAYZH8-YX0YuRP17Q2OU4,14345
|
|
9
|
+
sciv/plot/_barcode_.py,sha256=RDOedQ8ZtXWFyJ2c772RDfqO4TMIpHMvcMZMAVqky90,5073
|
|
10
|
+
sciv/plot/_box_.py,sha256=485YNmSBj2IB7JlRHaKHMVj0yr0Pz02B3-r57SJqtMk,6009
|
|
11
|
+
sciv/plot/_bubble_.py,sha256=vwBs-voOdkBfyMho5w4Rt68b8_Dw1C3NClLdauonC4U,1066
|
|
12
|
+
sciv/plot/_core_.py,sha256=kM3Ym0sZYl0AsfndJ6m9hOlvoMYvii-e8ukcF_USXiA,22222
|
|
13
|
+
sciv/plot/_graph_.py,sha256=h5sI7p4Y1YKplR9e-bfKrvtaWN_LB0SoIndqH-2qZ7I,12613
|
|
14
|
+
sciv/plot/_heat_map_.py,sha256=pne4DSydBg0sc4KT88N5A_7QkDnvvmGUwyqZ7-WWtcM,14896
|
|
15
|
+
sciv/plot/_kde_.py,sha256=9VC6DKHbQAzKenz4DoiL5LgUzEJBtAWXXPCLxOV74kY,2459
|
|
16
|
+
sciv/plot/_line_.py,sha256=P944YoGxSocHncjtme4n_iIPK9sghNW3-Xee6Tyy4HE,3850
|
|
17
|
+
sciv/plot/_pie_.py,sha256=OVPv85MdjkjABh-uP5Y-KVk1VygFIzz87QT3OE1hZjU,6399
|
|
18
|
+
sciv/plot/_radar_.py,sha256=g_abzmzibJIR6it59TendUI236inbzYl0IzzdoA3Uuc,6304
|
|
19
|
+
sciv/plot/_scatter_.py,sha256=ZRP2-nRMygrZtj6tQlOqp8n5_FsWRe9cx9d80DhoezQ,16708
|
|
20
|
+
sciv/plot/_venn_.py,sha256=TfNTuxog2pT7sicKBEEMtleoHXwnenbl3CMWJu9c2vs,2675
|
|
21
|
+
sciv/plot/_violin_.py,sha256=40LYeHFYyNL1XbKHTjmwLT0zzh7o5emqN9Gl2sbl-DA,6458
|
|
22
|
+
sciv/preprocessing/__init__.py,sha256=56RgDai5I3sZ4hl3aaV80ogOeUscYsU3nJUWE80jZ-k,742
|
|
23
|
+
sciv/preprocessing/_anndata_.py,sha256=3d1cHFs1YA9UZkIPE089nZHFi-DjK-c1fRyi2shfSh4,6302
|
|
24
|
+
sciv/preprocessing/_gencode_.py,sha256=HKhRgK76khGepdv4FaKiOvTys1uJTbvIyrKUta5W0K8,2108
|
|
25
|
+
sciv/preprocessing/_gsea_.py,sha256=AH_PpUNfMN7WkF0pqAuUhEC6qZwKrtQm6VaaYu6JLfI,3803
|
|
26
|
+
sciv/preprocessing/_scanpy_.py,sha256=flC10W5YPgJE5Ccxt5hP8qW3Q3cOi8DZ36Z1j9D3oNA,11481
|
|
27
|
+
sciv/preprocessing/_scvi_.py,sha256=Og-o9JGQ4qyT9GKvR_uOroRgv4a0T9wA20kByHuaptY,10664
|
|
28
|
+
sciv/preprocessing/_snapatac_.py,sha256=Dq8CHF7Psl3CQszaEokQYO56Oe2uzyWOy_cGlaOywfc,27798
|
|
29
|
+
sciv/tool/__init__.py,sha256=WXzHkWt6RgBC3qqD-98nR5wQmt6oC850ox_VpMrapSU,2468
|
|
30
|
+
sciv/tool/_algorithm_.py,sha256=yTImeGMWK6Y2gxygR90bqRF1vkvU857l5M9A_Q_VoZI,49839
|
|
31
|
+
sciv/tool/_matrix_.py,sha256=O1EAhA9wxh06P_eOxEBesK7kO7IExKlhH6uJzGh1HBM,24322
|
|
32
|
+
sciv/tool/_random_walk_.py,sha256=lnMiJyDuqDB75l9IkFLr7bIgKYhWxlBdIcExSErpQNw,48374
|
|
33
|
+
sciv/util/__init__.py,sha256=nOxZ8if27X7AUJ6hZwTwxOJwIBJb0obWlHjqCzjg_Gc,1964
|
|
34
|
+
sciv/util/_constant_.py,sha256=w0wKQd8guLd1ZTW24_5aECrWsIWDiNQmEpLsWlHar1A,3000
|
|
35
|
+
sciv/util/_core_.py,sha256=hF33ybPcoVlapZsm-2Etem-p_rQUqXlsdaQgZv5jD7w,14867
|
|
36
|
+
sciv-0.0.93.dist-info/METADATA,sha256=CBRawJaX69GIAtLlTBO_dylZ60jF1Z8euWcDEcQNdYU,3465
|
|
37
|
+
sciv-0.0.93.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
38
|
+
sciv-0.0.93.dist-info/licenses/LICENSE,sha256=4UvHVf3qCOZjHLs4LkYz8u96XRpXnZrpTKrkUQPs5_A,1075
|
|
39
|
+
sciv-0.0.93.dist-info/RECORD,,
|
sciv-0.0.91.dist-info/RECORD
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
sciv/__init__.py,sha256=COyPt3XWQk1gNSxY5bzNCNl0KSdD2QSlvzdw4dw7Z_Y,387
|
|
2
|
-
sciv/file/__init__.py,sha256=8cYLG0S0nilblmyX46CWFrbLr-rmLbO1EEO477pZ-gk,520
|
|
3
|
-
sciv/file/_read_.py,sha256=UZJpN3_5hBiTjzEYO6YXORcE_dqA8HmLpV80nqTLNSo,30554
|
|
4
|
-
sciv/file/_write_.py,sha256=W3M9CmPi7BuKAffz1fdi-vA5DzAFZ7wmcggp33N9Xtg,7848
|
|
5
|
-
sciv/model/__init__.py,sha256=k8SO9FpJaGn2ANqJyaz3HXMas7jH9toPVtpw703kOqg,149
|
|
6
|
-
sciv/model/_core_.py,sha256=qGnBPBqnoEeemPm9WLedwgqb0SmbLe5QVk9fOmFMo_k,52840
|
|
7
|
-
sciv/plot/__init__.py,sha256=xmOc5KdyDY6oTLo3ORnh0Z1WQsczTZX87Ot0-_a_gR4,1848
|
|
8
|
-
sciv/plot/_bar_.py,sha256=qKtZOvcuiBeBeF-9J80GNWjhf9bAPyItMZ-7Y5KQhBY,14127
|
|
9
|
-
sciv/plot/_barcode_.py,sha256=oDrjysZbO3KikYd9b5uS7B484Hs6HPk_9ESjw-CtyYY,4987
|
|
10
|
-
sciv/plot/_box_.py,sha256=i1HFlYVCfATYIl0d2qwNuDrlAuTk2Jnihr3GOb5OhBE,5851
|
|
11
|
-
sciv/plot/_bubble_.py,sha256=tQ3uPzND6Ljxk-YvRuiQ5juO_Lljsf2vrxDVW-nuKGU,1033
|
|
12
|
-
sciv/plot/_core_.py,sha256=ea6qv12knqazewExBbFXU-dgEreKMUrNOuG2aAUwbn0,22126
|
|
13
|
-
sciv/plot/_graph_.py,sha256=aN7AuBOqZQ7KQq2GHBHTv-F7DESz_qKsy1iUGW5zHBQ,12496
|
|
14
|
-
sciv/plot/_heat_map_.py,sha256=vx6zGvFdpiJBYT8I3rKiNWIjZJmZ5vKLq9njJaFIW70,14785
|
|
15
|
-
sciv/plot/_kde_.py,sha256=pKnJkW_js7TRe_ypsRVPYgcr7wcFn_t2M1RVmSXcXvo,2426
|
|
16
|
-
sciv/plot/_line_.py,sha256=aE38LzfAjuVdXBrKWNbUhltkAbPB3TeyZH8F-jk4bpM,3817
|
|
17
|
-
sciv/plot/_pie_.py,sha256=Qs59LENC5XLgWsuxWc7qQ8ToIrzV2VCAr_QFExCN_lo,6281
|
|
18
|
-
sciv/plot/_radar_.py,sha256=qAkyKz_0i4el_Ejk7ou63xLXpAi_2qtHERxFi2ENSfs,6219
|
|
19
|
-
sciv/plot/_scatter_.py,sha256=ksEfxnkt2w4NxdIN4AJJ7Y1zs0R3WQsyoXVCjvI7bVo,14666
|
|
20
|
-
sciv/plot/_venn_.py,sha256=46rfbEI1TKDXu9941PtqLGjff-cGoYeCeJjT8ZnxiL0,2609
|
|
21
|
-
sciv/plot/_violin_.py,sha256=iq85VrNm1v4i_4bcr2BdfiMGIiUelC4-ffwzatM9U28,6519
|
|
22
|
-
sciv/preprocessing/__init__.py,sha256=56RgDai5I3sZ4hl3aaV80ogOeUscYsU3nJUWE80jZ-k,742
|
|
23
|
-
sciv/preprocessing/_anndata_.py,sha256=3d1cHFs1YA9UZkIPE089nZHFi-DjK-c1fRyi2shfSh4,6302
|
|
24
|
-
sciv/preprocessing/_gencode_.py,sha256=HKhRgK76khGepdv4FaKiOvTys1uJTbvIyrKUta5W0K8,2108
|
|
25
|
-
sciv/preprocessing/_gsea_.py,sha256=AH_PpUNfMN7WkF0pqAuUhEC6qZwKrtQm6VaaYu6JLfI,3803
|
|
26
|
-
sciv/preprocessing/_scanpy_.py,sha256=flC10W5YPgJE5Ccxt5hP8qW3Q3cOi8DZ36Z1j9D3oNA,11481
|
|
27
|
-
sciv/preprocessing/_scvi_.py,sha256=FcRdQRkQulnKakldJ1y8HsGB9kJK3BNO-HbE7A92Bhc,10660
|
|
28
|
-
sciv/preprocessing/_snapatac_.py,sha256=Dq8CHF7Psl3CQszaEokQYO56Oe2uzyWOy_cGlaOywfc,27798
|
|
29
|
-
sciv/tool/__init__.py,sha256=WXzHkWt6RgBC3qqD-98nR5wQmt6oC850ox_VpMrapSU,2468
|
|
30
|
-
sciv/tool/_algorithm_.py,sha256=yTImeGMWK6Y2gxygR90bqRF1vkvU857l5M9A_Q_VoZI,49839
|
|
31
|
-
sciv/tool/_matrix_.py,sha256=O1EAhA9wxh06P_eOxEBesK7kO7IExKlhH6uJzGh1HBM,24322
|
|
32
|
-
sciv/tool/_random_walk_.py,sha256=lnMiJyDuqDB75l9IkFLr7bIgKYhWxlBdIcExSErpQNw,48374
|
|
33
|
-
sciv/util/__init__.py,sha256=nOxZ8if27X7AUJ6hZwTwxOJwIBJb0obWlHjqCzjg_Gc,1964
|
|
34
|
-
sciv/util/_constant_.py,sha256=w0wKQd8guLd1ZTW24_5aECrWsIWDiNQmEpLsWlHar1A,3000
|
|
35
|
-
sciv/util/_core_.py,sha256=ZD2uSnEBHVu0i9TmXWzri_3bXZzYKnIZk818gW3zadE,14751
|
|
36
|
-
sciv-0.0.91.dist-info/METADATA,sha256=sCohu-lYE2ZeRrPcU9zYsKnrY9WrjC5l1St-aYQZUxM,3465
|
|
37
|
-
sciv-0.0.91.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
38
|
-
sciv-0.0.91.dist-info/licenses/LICENSE,sha256=4UvHVf3qCOZjHLs4LkYz8u96XRpXnZrpTKrkUQPs5_A,1075
|
|
39
|
-
sciv-0.0.91.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|