-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path03_4_join_tables.py
72 lines (61 loc) · 1.46 KB
/
03_4_join_tables.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# %%
from pathlib import Path
import numpy as np
import pandas as pd
# %%
fname = 'runs/appl_ald_data_2023_11/plasma/proteinGroups/01_2_performance_summary.xlsx'
ald_pg_perf = pd.read_excel(fname, sheet_name=-1, index_col=0)
ald_pg_perf.columns = pd.MultiIndex.from_tuples([('ALD protein groups', x) for x in ald_pg_perf.columns])
ald_pg_perf
# %%
file = 'runs/mnar_mcar/all_results.xlsx'
table = [pd.read_excel(file, index_col=0, header=[0, 1])]
table.append(ald_pg_perf)
table = pd.concat(table, axis=1)
table
# %%
order = (table
.loc[:, pd.IndexSlice[ :, 'val']]
.mean(axis=1)
.sort_values()
)
order
# %%
table = table.loc[order.index]
table
# %%
fname = 'runs/supp_table_performance.xlsx'
table.to_excel(fname, float_format='%.4f')
fname
# %% [markdown]
# # Compare performance for small HeLa data set
# %%
files = (f"runs/dev_dataset_small/{level}_N50_all_small.xlsx"
for level
in ['proteinGroups', 'peptides', 'evidence']
)
files
# %%
table = list()
for file in files:
df = pd.read_excel(file, index_col=0, header=[0, 1])
table.append(df)
table = pd.concat(table, axis=1)
table
# %%
# %%
order = (table
.loc[:, pd.IndexSlice[:, 'val']]
.mean(axis=1)
.sort_values()
)
order
# %%
table = table.loc[order.index]
table = table.style.highlight_min(axis=0)
table
# %%
fname = 'runs/dev_dataset_small/supp_table_small_HeLa.xlsx'
table.to_excel(fname, float_format='%.4f')
fname
# %%