py2ls 0.2.4.1__py3-none-any.whl → 0.2.4.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.
- py2ls/bio.py +272 -0
- py2ls/data/usages_pd copy.json +1105 -0
- py2ls/data/usages_pd.json +1413 -52
- py2ls/fetch_update.py +45 -27
- py2ls/ips.py +362 -99
- py2ls/plot.py +71 -64
- {py2ls-0.2.4.1.dist-info → py2ls-0.2.4.2.dist-info}/METADATA +1 -1
- {py2ls-0.2.4.1.dist-info → py2ls-0.2.4.2.dist-info}/RECORD +9 -7
- {py2ls-0.2.4.1.dist-info → py2ls-0.2.4.2.dist-info}/WHEEL +0 -0
py2ls/plot.py
CHANGED
@@ -10,8 +10,8 @@ from cycler import cycler
|
|
10
10
|
import logging
|
11
11
|
import os
|
12
12
|
import re
|
13
|
-
from typing import
|
14
|
-
from .ips import fsave, fload, mkdir, listdir, figsave, strcmp, unique, get_os, ssplit
|
13
|
+
from typing import Union
|
14
|
+
from .ips import fsave, fload, mkdir, listdir, figsave, strcmp, unique, get_os, ssplit,plt_font
|
15
15
|
from .stats import *
|
16
16
|
from .netfinder import get_soup, fetch
|
17
17
|
|
@@ -1862,8 +1862,10 @@ def figsets(*args, **kwargs):
|
|
1862
1862
|
matplotlib.rc("text", usetex=False)
|
1863
1863
|
|
1864
1864
|
fig = plt.gcf()
|
1865
|
-
fontsize = 11
|
1866
|
-
|
1865
|
+
fontsize = kwargs.get("fontsize",11)
|
1866
|
+
plt.rcParams["font.size"]=fontsize
|
1867
|
+
fontname = kwargs.pop("fontname","Arial")
|
1868
|
+
fontname=plt_font(fontname) # 显示中文
|
1867
1869
|
sns_themes = ["white", "whitegrid", "dark", "darkgrid", "ticks"]
|
1868
1870
|
sns_contexts = ["notebook", "talk", "poster"] # now available "paper"
|
1869
1871
|
scienceplots_styles = [
|
@@ -1889,6 +1891,7 @@ def figsets(*args, **kwargs):
|
|
1889
1891
|
]
|
1890
1892
|
|
1891
1893
|
def set_step_1(ax, key, value):
|
1894
|
+
nonlocal fontsize, fontname
|
1892
1895
|
if ("fo" in key) and (("size" in key) or ("sz" in key)):
|
1893
1896
|
fontsize = value
|
1894
1897
|
plt.rcParams.update({"font.size": fontsize})
|
@@ -1931,15 +1934,15 @@ def figsets(*args, **kwargs):
|
|
1931
1934
|
if ("x" in key.lower()) and (
|
1932
1935
|
"tic" not in key.lower() and "tk" not in key.lower()
|
1933
1936
|
):
|
1934
|
-
ax.set_xlabel(value, fontname=fontname)
|
1937
|
+
ax.set_xlabel(value, fontname=fontname,fontsize=fontsize)
|
1935
1938
|
if ("y" in key.lower()) and (
|
1936
1939
|
"tic" not in key.lower() and "tk" not in key.lower()
|
1937
1940
|
):
|
1938
|
-
ax.set_ylabel(value, fontname=fontname)
|
1941
|
+
ax.set_ylabel(value, fontname=fontname,fontsize=fontsize)
|
1939
1942
|
if ("z" in key.lower()) and (
|
1940
1943
|
"tic" not in key.lower() and "tk" not in key.lower()
|
1941
1944
|
):
|
1942
|
-
ax.set_zlabel(value, fontname=fontname)
|
1945
|
+
ax.set_zlabel(value, fontname=fontname,fontsize=fontsize)
|
1943
1946
|
if key == "xlabel" and isinstance(value, dict):
|
1944
1947
|
ax.set_xlabel(**value)
|
1945
1948
|
if key == "ylabel" and isinstance(value, dict):
|
@@ -2142,6 +2145,7 @@ def figsets(*args, **kwargs):
|
|
2142
2145
|
plt.set_cmap(value)
|
2143
2146
|
|
2144
2147
|
def set_step_2(ax, key, value):
|
2148
|
+
nonlocal fontsize, fontname
|
2145
2149
|
if key == "figsize":
|
2146
2150
|
pass
|
2147
2151
|
if "xlim" in key.lower():
|
@@ -2181,9 +2185,9 @@ def figsets(*args, **kwargs):
|
|
2181
2185
|
ax.grid(visible=False)
|
2182
2186
|
if "tit" in key.lower():
|
2183
2187
|
if "sup" in key.lower():
|
2184
|
-
plt.suptitle(value)
|
2188
|
+
plt.suptitle(value,fontname=fontname,fontsize=fontsize)
|
2185
2189
|
else:
|
2186
|
-
ax.set_title(value)
|
2190
|
+
ax.set_title(value,fontname=fontname,fontsize=fontsize)
|
2187
2191
|
if key.lower() in ["spine", "adjust", "ad", "sp", "spi", "adj", "spines"]:
|
2188
2192
|
if isinstance(value, bool) or (value in ["go", "do", "ja", "yes"]):
|
2189
2193
|
if value:
|
@@ -2919,7 +2923,7 @@ def plot_xy(
|
|
2919
2923
|
x=None,
|
2920
2924
|
y=None,
|
2921
2925
|
ax=None,
|
2922
|
-
kind: Union
|
2926
|
+
kind: Union[str, list] = None, # Specify the kind of plot
|
2923
2927
|
verbose=False,
|
2924
2928
|
**kwargs,
|
2925
2929
|
):
|
@@ -2933,7 +2937,7 @@ def plotxy(
|
|
2933
2937
|
x=None,
|
2934
2938
|
y=None,
|
2935
2939
|
ax=None,
|
2936
|
-
kind: Union
|
2940
|
+
kind: Union[str, list] = None, # Specify the kind of plot
|
2937
2941
|
verbose=False,
|
2938
2942
|
**kwargs,
|
2939
2943
|
):
|
@@ -3111,6 +3115,8 @@ def plotxy(
|
|
3111
3115
|
ax = sns.barplot(data=data, x=x, y=y, ax=ax, **kws_bar)
|
3112
3116
|
elif k == "countplot":
|
3113
3117
|
kws_count = kwargs.pop("kws_count", kwargs)
|
3118
|
+
if not kws_count.get("hue",None):
|
3119
|
+
kws_count.pop("palette",None)
|
3114
3120
|
ax = sns.countplot(data=data, x=x, ax=ax, **kws_count)
|
3115
3121
|
elif k == "regplot":
|
3116
3122
|
kws_reg = kwargs.pop("kws_reg", kwargs)
|
@@ -3123,6 +3129,7 @@ def plotxy(
|
|
3123
3129
|
ax = sns.lineplot(ax=ax, data=data, x=x, y=y, **kws_line)
|
3124
3130
|
|
3125
3131
|
figsets(ax=ax, **kws_figsets)
|
3132
|
+
print(kws_add_text)
|
3126
3133
|
add_text(ax=ax, **kws_add_text) if kws_add_text else None
|
3127
3134
|
print(k, " ⤵ ")
|
3128
3135
|
print(default_settings[k])
|
@@ -3138,14 +3145,14 @@ def plotxy(
|
|
3138
3145
|
|
3139
3146
|
|
3140
3147
|
def volcano(
|
3141
|
-
data,
|
3142
|
-
x,
|
3143
|
-
y,
|
3148
|
+
data:pd.DataFrame,
|
3149
|
+
x:str,
|
3150
|
+
y:str,
|
3144
3151
|
gene_col=None,
|
3145
3152
|
top_genes=5,
|
3146
3153
|
thr_x=np.log2(1.5),
|
3147
3154
|
thr_y=-np.log10(0.05),
|
3148
|
-
colors=("#
|
3155
|
+
colors=("#00BFFF", "#9d9a9a", "#FF3030"),
|
3149
3156
|
s=20,
|
3150
3157
|
fill=True, # plot filled scatter
|
3151
3158
|
facecolor="none",
|
@@ -3155,8 +3162,8 @@ def volcano(
|
|
3155
3162
|
legend=False,
|
3156
3163
|
ax=None,
|
3157
3164
|
verbose=False,
|
3158
|
-
|
3159
|
-
|
3165
|
+
kws_text=dict(fontsize=10, color="k"),
|
3166
|
+
kws_arrow=dict(style="-", color="k", lw=0.5),
|
3160
3167
|
**kwargs,
|
3161
3168
|
):
|
3162
3169
|
"""
|
@@ -3281,55 +3288,55 @@ def volcano(
|
|
3281
3288
|
fontname = kws_text.pop("fontname", "Arial")
|
3282
3289
|
textcolor = kws_text.pop("color", "k")
|
3283
3290
|
fontsize = kws_text.pop("fontsize", 10)
|
3284
|
-
|
3285
|
-
|
3286
|
-
|
3287
|
-
|
3288
|
-
|
3289
|
-
|
3290
|
-
|
3291
|
-
|
3292
|
-
|
3293
|
-
|
3294
|
-
|
3295
|
-
|
3296
|
-
|
3291
|
+
for i in range(sele_gene.shape[0]):
|
3292
|
+
if isinstance(textcolor, list): # be consistant with dots's color
|
3293
|
+
textcolor = colors[0] if sele_gene[x].iloc[i] > 0 else colors[1]
|
3294
|
+
texts.append(
|
3295
|
+
plt.text(
|
3296
|
+
x=sele_gene[x].iloc[i],
|
3297
|
+
y=sele_gene[y].iloc[i],
|
3298
|
+
s=sele_gene[gene_col].iloc[i],
|
3299
|
+
fontdict={
|
3300
|
+
"fontsize": fontsize,
|
3301
|
+
"color": textcolor,
|
3302
|
+
"fontname": fontname,
|
3303
|
+
},
|
3304
|
+
)
|
3297
3305
|
)
|
3298
|
-
)
|
3299
3306
|
|
3300
|
-
|
3301
|
-
|
3302
|
-
|
3303
|
-
|
3304
|
-
|
3305
|
-
|
3306
|
-
|
3307
|
-
|
3308
|
-
|
3309
|
-
|
3310
|
-
|
3311
|
-
|
3312
|
-
|
3313
|
-
|
3314
|
-
|
3315
|
-
|
3316
|
-
|
3317
|
-
|
3318
|
-
|
3319
|
-
|
3320
|
-
|
3321
|
-
|
3322
|
-
|
3323
|
-
|
3324
|
-
|
3325
|
-
|
3326
|
-
|
3327
|
-
|
3328
|
-
|
3329
|
-
|
3330
|
-
|
3331
|
-
|
3332
|
-
|
3307
|
+
arrowstyles = [
|
3308
|
+
"-",
|
3309
|
+
"->",
|
3310
|
+
"-[",
|
3311
|
+
"|->",
|
3312
|
+
"<-",
|
3313
|
+
"<->",
|
3314
|
+
"<|-",
|
3315
|
+
"<|-|>",
|
3316
|
+
"-|>",
|
3317
|
+
"-[ ",
|
3318
|
+
"fancy",
|
3319
|
+
"simple",
|
3320
|
+
"wedge",
|
3321
|
+
]
|
3322
|
+
arrowstyle = kws_arrow.pop("style", "-")
|
3323
|
+
arrowcolor = kws_arrow.pop("color", "0.5")
|
3324
|
+
arrowlinewidth = kws_arrow.pop("lw", 0.5)
|
3325
|
+
shrinkA = kws_arrow.pop("shrinkA", 5)
|
3326
|
+
shrinkB = kws_arrow.pop("shrinkB", 5)
|
3327
|
+
arrowstyle = strcmp(arrowstyle, arrowstyles)[0]
|
3328
|
+
adjust_text(
|
3329
|
+
texts,
|
3330
|
+
expand_text=(1.05, 1.2),
|
3331
|
+
arrowprops=dict(
|
3332
|
+
arrowstyle=arrowstyle,
|
3333
|
+
color=arrowcolor,
|
3334
|
+
lw=arrowlinewidth,
|
3335
|
+
shrinkA=shrinkA,
|
3336
|
+
shrinkB=shrinkB,
|
3337
|
+
**kws_arrow,
|
3338
|
+
),
|
3339
|
+
)
|
3333
3340
|
|
3334
3341
|
figsets(**kws_figsets)
|
3335
3342
|
|
@@ -173,6 +173,7 @@ py2ls/LICENSE,sha256=UOZ1F5fFDe3XXvG4oNnkL1-Ecun7zpHzRxjp-XsMeAo,11324
|
|
173
173
|
py2ls/README.md,sha256=CwvJWAnSXnCnrVHlnEbrxxi6MbjbE_MT6DH2D53S818,11572
|
174
174
|
py2ls/__init__.py,sha256=Nn8jTIvySX7t7DMJ8VNRVctTStgXGjHldOIdZ35PdW8,165
|
175
175
|
py2ls/batman.py,sha256=E7gYofbDzN7S5oCmO_dd5Z1bxxhoYMJSD6s-VaF388E,11398
|
176
|
+
py2ls/bio.py,sha256=5q7T_LXmDg0MJoKXwO0kWnfbpshXNvUR5kCnYyLqm2w,10711
|
176
177
|
py2ls/brain_atlas.py,sha256=w1o5EelRjq89zuFJUNSz4Da8HnTCwAwDAZ4NU4a-bAY,5486
|
177
178
|
py2ls/chat.py,sha256=Yr22GoIvoWhpV3m4fdwV_I0Mn77La346_ymSinR-ORA,3793
|
178
179
|
py2ls/correlators.py,sha256=RbOaJIPLCHJtUm5SFi_4dCJ7VFUPWR0PErfK3K26ad4,18243
|
@@ -203,23 +204,24 @@ py2ls/data/styles/style6.json,sha256=tu-MYOT9x5Rorc-2IK6sy-J-frmz0RNdm65XAsDQKX4
|
|
203
204
|
py2ls/data/styles/style7.json,sha256=StdUFwIVrS7T_6CDrADHMorzc0WZFWBM7IyYdO1TPHg,4447
|
204
205
|
py2ls/data/styles/style8.json,sha256=8XUgkZtew8ebvjbAHlDHCSWUqNra3ktDvMCO4vNh-CM,4456
|
205
206
|
py2ls/data/styles/style9.json,sha256=PLxvntbH_kfzZlnCTtCEAUVBGi5m6Lngb9C01rArQog,4769
|
206
|
-
py2ls/data/usages_pd.json,sha256=
|
207
|
+
py2ls/data/usages_pd copy.json,sha256=cS2fYSKvSC274uAw1l6eMPGzLMvZt184dfbcuUiErmw,197313
|
208
|
+
py2ls/data/usages_pd.json,sha256=4DgbPahF4G5Hd6G0TQurb6dBRVey67lpKdgK6A01Tww,266818
|
207
209
|
py2ls/data/usages_sns.json,sha256=3OTu6T7n9HbQaFkz-UPMJ_9-Ug6Xjf7q5aDIvZ_6cHk,9246
|
208
210
|
py2ls/db2ls.py,sha256=MMfFX47aIPIyu7fU9aPvX9lbPRPYOpJ_VXwlnWk-8qo,13615
|
209
211
|
py2ls/doc.py,sha256=xN3g1OWfoaGUhikbJ0NqbN5eKy1VZVvWwRlhHMgyVEc,4243
|
210
212
|
py2ls/export_requirements.py,sha256=x2WgUF0jYKz9GfA1MVKN-MdsM-oQ8yUeC6Ua8oCymio,2325
|
211
|
-
py2ls/fetch_update.py,sha256=
|
213
|
+
py2ls/fetch_update.py,sha256=9LXj661GpCEFII2wx_99aINYctDiHni6DOruDs_fdt8,4752
|
212
214
|
py2ls/freqanalysis.py,sha256=F4218VSPbgL5tnngh6xNCYuNnfR-F_QjECUUxrPYZss,32594
|
213
215
|
py2ls/ich2ls.py,sha256=3E9R8oVpyYZXH5PiIQgT3CN5NxLe4Dwtm2LwaeacE6I,21381
|
214
|
-
py2ls/ips.py,sha256=
|
216
|
+
py2ls/ips.py,sha256=46nrt6RRl8Lc-tMh03dRqxF4nUlLfMElnETE1ipu-DM,210309
|
215
217
|
py2ls/netfinder.py,sha256=LwBkGITB_4BTNtY6RlKdEZVFW6epzMWlnqy2g03KtyU,56117
|
216
218
|
py2ls/ocr.py,sha256=5lhUbJufIKRSOL6wAWVLEo8TqMYSjoI_Q-IO-_4u3DE,31419
|
217
|
-
py2ls/plot.py,sha256=
|
219
|
+
py2ls/plot.py,sha256=A4NiRDItVyrc80qPtLgT1mpzvebU_iMVVownjsu_YFc,135976
|
218
220
|
py2ls/setuptools-70.1.0-py3-none-any.whl,sha256=2bi3cUVal8ip86s0SOvgspteEF8SKLukECi-EWmFomc,882588
|
219
221
|
py2ls/sleep_events_detectors.py,sha256=bQA3HJqv5qnYKJJEIhCyhlDtkXQfIzqksnD0YRXso68,52145
|
220
222
|
py2ls/stats.py,sha256=DMoJd8Z5YV9T1wB-4P52F5K5scfVK55DT8UP4Twcebo,38627
|
221
223
|
py2ls/translator.py,sha256=zBeq4pYZeroqw3DT-5g7uHfVqKd-EQptT6LJ-Adi8JY,34244
|
222
224
|
py2ls/wb_detector.py,sha256=7y6TmBUj9exCZeIgBAJ_9hwuhkDh1x_-yg4dvNY1_GQ,6284
|
223
|
-
py2ls-0.2.4.
|
224
|
-
py2ls-0.2.4.
|
225
|
-
py2ls-0.2.4.
|
225
|
+
py2ls-0.2.4.2.dist-info/METADATA,sha256=_YQg86nAdjPWqkaIrH6p9nSPhjNHbY1AU0BGV6o3wU0,20038
|
226
|
+
py2ls-0.2.4.2.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
227
|
+
py2ls-0.2.4.2.dist-info/RECORD,,
|
File without changes
|