py2ls 0.2.5.10__py3-none-any.whl → 0.2.5.14__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/.git/index +0 -0
- py2ls/ich2ls.py +1955 -296
- py2ls/im2.py +67 -0
- py2ls/ips.py +5913 -801
- py2ls/ips_lab.py +17172 -0
- py2ls/netfinder.py +511 -210
- py2ls/plot.py +13 -7
- py2ls/stats.py +1 -144
- {py2ls-0.2.5.10.dist-info → py2ls-0.2.5.14.dist-info}/METADATA +1 -1
- {py2ls-0.2.5.10.dist-info → py2ls-0.2.5.14.dist-info}/RECORD +11 -9
- {py2ls-0.2.5.10.dist-info → py2ls-0.2.5.14.dist-info}/WHEEL +0 -0
py2ls/im2.py
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
from .ips import *
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
# to quick look at the patient info
|
6
|
+
def get_patient(kw=None,type_=None,thr=5,columns=["sampleid","patientid","birth","experimentator","consent form","first","res","type"]):
|
7
|
+
def _get_patient(kw=None,type_=None):
|
8
|
+
if "aml" in type_.lower():
|
9
|
+
fpath=local_path(r'Q:\\IM\\AGLengerke\\Jeff\\Cell Bank\\AML Cells\\AML Data Collection Form.xlsx')
|
10
|
+
sheet_name=1
|
11
|
+
dir_aml=local_path(r"Q:\IM\AGLengerke\Lab\1_AML_Sample_Table\August_Updated_AML_Sample_Table.xlsx")
|
12
|
+
|
13
|
+
else:
|
14
|
+
fpath=local_path(r"Q:\IM\Klinik_IM2\Car-T-cells\JW_Tabelle aller CAR-T-cell Patienten und Proben.xlsx")
|
15
|
+
sheet_name=0
|
16
|
+
try:
|
17
|
+
df=fload(fpath=fpath,sheet_name=sheet_name,verbose=0)
|
18
|
+
except Exception as e:
|
19
|
+
print(e)
|
20
|
+
print()
|
21
|
+
if "aml" in type_.lower():
|
22
|
+
name_lists=df.iloc[:,0].tolist()
|
23
|
+
print("AML patients:")
|
24
|
+
else:
|
25
|
+
df["Name"]=df["Name"].apply(lambda x: str(x).strip().replace(" ",""))
|
26
|
+
df["Geb."]=df["Geb."].apply(lambda x: str2date(str(x),fmt="%d.%m.%y"))
|
27
|
+
name_lists=unique([n+"/"+d for n,d in zip(df["Name"], df["Geb."])], ascending=True )
|
28
|
+
print("Car-T patients:")
|
29
|
+
|
30
|
+
list_=[]
|
31
|
+
for i in name_lists:
|
32
|
+
if kw.lower() in str(i).lower():
|
33
|
+
print(f"{i} => '{"A"+enpass(i,method="5d").upper()[:6]}'")
|
34
|
+
list_.append(i)
|
35
|
+
if "aml" in type_.lower():
|
36
|
+
pat_id_=["A"+enpass(i,method="5d").upper()[:6] for i in name_lists]
|
37
|
+
pat_id_list=[]
|
38
|
+
for i,j in zip(name_lists, pat_id_):
|
39
|
+
if kw.upper() ==j:
|
40
|
+
print(f"{i} => '{j}'")
|
41
|
+
list_.append(f"{i} => '{j}'")
|
42
|
+
pat_id_list.append(j)
|
43
|
+
if 1 <= len(list_) <= thr:
|
44
|
+
if "aml" in type_.lower():
|
45
|
+
print(f"\n\nfound {len(list_)}")
|
46
|
+
df_aml = fload(dir_aml, sheet_name=0, header=1)
|
47
|
+
idx_=1
|
48
|
+
for name_ in list_:
|
49
|
+
if "=>" in name_:
|
50
|
+
name_=ssplit(name_,by=" =>")[0].strip()
|
51
|
+
print(f"{len(list_)}-{idx_}: {name_}")
|
52
|
+
if columns is None:
|
53
|
+
display(df_aml.loc[df_aml["PatientID"]==("A"+enpass(name_,method="5d").upper()[:6])].iloc[:,:19])
|
54
|
+
else:
|
55
|
+
display(df_aml.loc[df_aml["PatientID"]==("A"+enpass(name_,method="5d").upper()[:6])].select(columns))
|
56
|
+
idx_+=1
|
57
|
+
return list_
|
58
|
+
res=[]
|
59
|
+
if kw is None:
|
60
|
+
kw=input("input any related keyword: , dateformat: %")
|
61
|
+
kw=str(kw).replace(" ","").strip().lower()
|
62
|
+
if type_ is None:
|
63
|
+
for type_temp in ["aml","cart"]:
|
64
|
+
res.extend(_get_patient(kw=kw,type_=type_temp))
|
65
|
+
else:
|
66
|
+
res.extend(_get_patient(kw=kw,type_=type_))
|
67
|
+
return res
|