Compare outcomes from differential analysis based on different imputation methods#
load scores based on
10_1_ald_diff_analysis
Parameters#
Default and set parameters for the notebook.
folder_experiment = 'runs/appl_ald_data/plasma/proteinGroups'
target = 'kleiner'
model_key = 'VAE'
baseline = 'RSN'
out_folder = 'diff_analysis'
selected_statistics = ['p-unc', '-Log10 pvalue', 'qvalue', 'rejected']
disease_ontology = 5082 # code from https://disease-ontology.org/
# split diseases notebook? Query gene names for proteins in file from uniprot?
annotaitons_gene_col = 'PG.Genes'
# Parameters
disease_ontology = 10652
folder_experiment = "runs/alzheimer_study"
target = "AD"
baseline = "PI"
model_key = "DAE"
out_folder = "diff_analysis"
annotaitons_gene_col = "None"
Add set parameters to configuration
root - INFO Removed from global namespace: folder_experiment
root - INFO Removed from global namespace: target
root - INFO Removed from global namespace: model_key
root - INFO Removed from global namespace: baseline
root - INFO Removed from global namespace: out_folder
root - INFO Removed from global namespace: selected_statistics
root - INFO Removed from global namespace: disease_ontology
root - INFO Removed from global namespace: annotaitons_gene_col
root - INFO Already set attribute: folder_experiment has value runs/alzheimer_study
root - INFO Already set attribute: out_folder has value diff_analysis
{'annotaitons_gene_col': 'None',
'baseline': 'PI',
'data': PosixPath('runs/alzheimer_study/data'),
'disease_ontology': 10652,
'folder_experiment': PosixPath('runs/alzheimer_study'),
'freq_features_observed': PosixPath('runs/alzheimer_study/freq_features_observed.csv'),
'model_key': 'DAE',
'out_figures': PosixPath('runs/alzheimer_study/figures'),
'out_folder': PosixPath('runs/alzheimer_study/diff_analysis/AD/PI_vs_DAE'),
'out_metrics': PosixPath('runs/alzheimer_study'),
'out_models': PosixPath('runs/alzheimer_study'),
'out_preds': PosixPath('runs/alzheimer_study/preds'),
'scores_folder': PosixPath('runs/alzheimer_study/diff_analysis/AD/scores'),
'selected_statistics': ['p-unc', '-Log10 pvalue', 'qvalue', 'rejected'],
'target': 'AD'}
Excel file for exports#
files_out = dict()
writer_args = dict(float_format='%.3f')
fname = args.out_folder / 'diff_analysis_compare_methods.xlsx'
files_out[fname.name] = fname
writer = pd.ExcelWriter(fname)
logger.info("Writing to excel file: %s", fname)
root - INFO Writing to excel file: runs/alzheimer_study/diff_analysis/AD/PI_vs_DAE/diff_analysis_compare_methods.xlsx
Load scores#
Load baseline model scores#
Show all statistics, later use selected statistics
| model | PI | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| var | SS | DF | F | p-unc | np2 | -Log10 pvalue | qvalue | rejected | |
| protein groups | Source | ||||||||
| A0A024QZX5;A0A087X1N8;P35237 | AD | 0.633 | 1 | 0.931 | 0.336 | 0.005 | 0.474 | 0.502 | False |
| age | 0.035 | 1 | 0.052 | 0.820 | 0.000 | 0.086 | 0.894 | False | |
| Kiel | 2.253 | 1 | 3.315 | 0.070 | 0.017 | 1.154 | 0.159 | False | |
| Magdeburg | 5.871 | 1 | 8.639 | 0.004 | 0.043 | 2.432 | 0.015 | True | |
| Sweden | 10.533 | 1 | 15.498 | 0.000 | 0.075 | 3.937 | 0.001 | True | |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| S4R3U6 | AD | 0.795 | 1 | 0.798 | 0.373 | 0.004 | 0.428 | 0.538 | False |
| age | 0.835 | 1 | 0.838 | 0.361 | 0.004 | 0.442 | 0.526 | False | |
| Kiel | 0.537 | 1 | 0.538 | 0.464 | 0.003 | 0.333 | 0.619 | False | |
| Magdeburg | 3.819 | 1 | 3.831 | 0.052 | 0.020 | 1.286 | 0.125 | False | |
| Sweden | 4.139 | 1 | 4.153 | 0.043 | 0.021 | 1.367 | 0.108 | False | |
7105 rows × 8 columns
Load selected comparison model scores#
| model | DAE | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| var | SS | DF | F | p-unc | np2 | -Log10 pvalue | qvalue | rejected | |
| protein groups | Source | ||||||||
| A0A024QZX5;A0A087X1N8;P35237 | AD | 1.123 | 1 | 8.169 | 0.005 | 0.041 | 2.325 | 0.014 | True |
| age | 0.004 | 1 | 0.028 | 0.867 | 0.000 | 0.062 | 0.912 | False | |
| Kiel | 0.260 | 1 | 1.889 | 0.171 | 0.010 | 0.767 | 0.277 | False | |
| Magdeburg | 0.455 | 1 | 3.308 | 0.071 | 0.017 | 1.152 | 0.136 | False | |
| Sweden | 1.629 | 1 | 11.848 | 0.001 | 0.058 | 3.149 | 0.003 | True | |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| S4R3U6 | AD | 3.223 | 1 | 5.449 | 0.021 | 0.028 | 1.686 | 0.049 | True |
| age | 1.082 | 1 | 1.830 | 0.178 | 0.009 | 0.750 | 0.285 | False | |
| Kiel | 3.108 | 1 | 5.255 | 0.023 | 0.027 | 1.639 | 0.054 | False | |
| Magdeburg | 3.155 | 1 | 5.333 | 0.022 | 0.027 | 1.658 | 0.052 | False | |
| Sweden | 25.073 | 1 | 42.385 | 0.000 | 0.182 | 9.191 | 0.000 | True | |
7105 rows × 8 columns
Combined scores#
show only selected statistics for comparsion
| model | DAE | PI | |||||||
|---|---|---|---|---|---|---|---|---|---|
| var | p-unc | -Log10 pvalue | qvalue | rejected | p-unc | -Log10 pvalue | qvalue | rejected | |
| protein groups | Source | ||||||||
| A0A024QZX5;A0A087X1N8;P35237 | AD | 0.005 | 2.325 | 0.014 | True | 0.336 | 0.474 | 0.502 | False |
| Kiel | 0.171 | 0.767 | 0.277 | False | 0.070 | 1.154 | 0.159 | False | |
| Magdeburg | 0.071 | 1.152 | 0.136 | False | 0.004 | 2.432 | 0.015 | True | |
| Sweden | 0.001 | 3.149 | 0.003 | True | 0.000 | 3.937 | 0.001 | True | |
| age | 0.867 | 0.062 | 0.912 | False | 0.820 | 0.086 | 0.894 | False | |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| S4R3U6 | AD | 0.021 | 1.686 | 0.049 | True | 0.373 | 0.428 | 0.538 | False |
| Kiel | 0.023 | 1.639 | 0.054 | False | 0.464 | 0.333 | 0.619 | False | |
| Magdeburg | 0.022 | 1.658 | 0.052 | False | 0.052 | 1.286 | 0.125 | False | |
| Sweden | 0.000 | 9.191 | 0.000 | True | 0.043 | 1.367 | 0.108 | False | |
| age | 0.178 | 0.750 | 0.285 | False | 0.361 | 0.442 | 0.526 | False | |
7105 rows × 8 columns
Models in comparison (name mapping)
{'DAE': 'DAE', 'PI': 'PI'}
Describe scores#
| model | DAE | PI | ||||
|---|---|---|---|---|---|---|
| var | p-unc | -Log10 pvalue | qvalue | p-unc | -Log10 pvalue | qvalue |
| count | 7,105.000 | 7,105.000 | 7,105.000 | 7,105.000 | 7,105.000 | 7,105.000 |
| mean | 0.221 | 3.334 | 0.274 | 0.262 | 2.481 | 0.339 |
| std | 0.291 | 6.322 | 0.317 | 0.304 | 5.331 | 0.332 |
| min | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 |
| 25% | 0.000 | 0.415 | 0.002 | 0.004 | 0.332 | 0.015 |
| 50% | 0.058 | 1.234 | 0.117 | 0.119 | 0.923 | 0.239 |
| 75% | 0.385 | 3.343 | 0.513 | 0.465 | 2.416 | 0.620 |
| max | 0.999 | 86.773 | 0.999 | 1.000 | 149.342 | 1.000 |
One to one comparison of by feature:#
/tmp/ipykernel_79664/3761369923.py:2: FutureWarning: Starting with pandas version 3.0 all arguments of to_excel except for the argument 'excel_writer' will be keyword-only.
scores.to_excel(writer, 'scores', **writer_args)
| model | DAE | PI | |||||||
|---|---|---|---|---|---|---|---|---|---|
| var | p-unc | -Log10 pvalue | qvalue | rejected | p-unc | -Log10 pvalue | qvalue | rejected | |
| protein groups | Source | ||||||||
| A0A024QZX5;A0A087X1N8;P35237 | AD | 0.005 | 2.325 | 0.014 | True | 0.336 | 0.474 | 0.502 | False |
| A0A024R0T9;K7ER74;P02655 | AD | 0.030 | 1.516 | 0.069 | False | 0.043 | 1.364 | 0.109 | False |
| A0A024R3W6;A0A024R412;O60462;O60462-2;O60462-3;O60462-4;O60462-5;Q7LBX6;X5D2Q8 | AD | 0.339 | 0.469 | 0.468 | False | 0.072 | 1.144 | 0.161 | False |
| A0A024R644;A0A0A0MRU5;A0A1B0GWI2;O75503 | AD | 0.252 | 0.598 | 0.375 | False | 0.586 | 0.232 | 0.724 | False |
| A0A075B6H7 | AD | 0.010 | 1.997 | 0.027 | True | 0.111 | 0.955 | 0.227 | False |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| Q9Y6R7 | AD | 0.175 | 0.756 | 0.282 | False | 0.175 | 0.756 | 0.318 | False |
| Q9Y6X5 | AD | 0.223 | 0.652 | 0.341 | False | 0.032 | 1.495 | 0.086 | False |
| Q9Y6Y8;Q9Y6Y8-2 | AD | 0.083 | 1.079 | 0.156 | False | 0.083 | 1.079 | 0.182 | False |
| Q9Y6Y9 | AD | 0.812 | 0.090 | 0.874 | False | 0.409 | 0.388 | 0.572 | False |
| S4R3U6 | AD | 0.021 | 1.686 | 0.049 | True | 0.373 | 0.428 | 0.538 | False |
1421 rows × 8 columns
And the descriptive statistics of the numeric values:
| model | DAE | PI | ||||
|---|---|---|---|---|---|---|
| var | p-unc | -Log10 pvalue | qvalue | p-unc | -Log10 pvalue | qvalue |
| count | 1,421.000 | 1,421.000 | 1,421.000 | 1,421.000 | 1,421.000 | 1,421.000 |
| mean | 0.237 | 1.608 | 0.296 | 0.255 | 1.414 | 0.336 |
| std | 0.287 | 1.885 | 0.311 | 0.296 | 1.648 | 0.321 |
| min | 0.000 | 0.000 | 0.000 | 0.000 | 0.001 | 0.000 |
| 25% | 0.007 | 0.385 | 0.019 | 0.011 | 0.365 | 0.038 |
| 50% | 0.088 | 1.055 | 0.162 | 0.116 | 0.934 | 0.234 |
| 75% | 0.412 | 2.172 | 0.539 | 0.432 | 1.941 | 0.592 |
| max | 0.999 | 24.385 | 0.999 | 0.998 | 23.733 | 0.999 |
and the boolean decision values
| model | DAE | PI |
|---|---|---|
| var | rejected | rejected |
| count | 1421 | 1421 |
| unique | 2 | 2 |
| top | False | False |
| freq | 933 | 1025 |
Load frequencies of observed features#
| data | |
|---|---|
| frequency | |
| protein groups | |
| A0A024QZX5;A0A087X1N8;P35237 | 186 |
| A0A024R0T9;K7ER74;P02655 | 195 |
| A0A024R3W6;A0A024R412;O60462;O60462-2;O60462-3;O60462-4;O60462-5;Q7LBX6;X5D2Q8 | 174 |
| A0A024R644;A0A0A0MRU5;A0A1B0GWI2;O75503 | 196 |
| A0A075B6H7 | 91 |
| ... | ... |
| Q9Y6R7 | 197 |
| Q9Y6X5 | 173 |
| Q9Y6Y8;Q9Y6Y8-2 | 197 |
| Q9Y6Y9 | 119 |
| S4R3U6 | 126 |
1421 rows × 1 columns
Plot qvalues of both models with annotated decisions#
Prepare data for plotting (qvalues)
| DAE | PI | frequency | Differential Analysis Comparison | |
|---|---|---|---|---|
| protein groups | ||||
| A0A024QZX5;A0A087X1N8;P35237 | 0.014 | 0.502 | 186 | DAE (yes) - PI (no) |
| A0A024R0T9;K7ER74;P02655 | 0.069 | 0.109 | 195 | DAE (no) - PI (no) |
| A0A024R3W6;A0A024R412;O60462;O60462-2;O60462-3;O60462-4;O60462-5;Q7LBX6;X5D2Q8 | 0.468 | 0.161 | 174 | DAE (no) - PI (no) |
| A0A024R644;A0A0A0MRU5;A0A1B0GWI2;O75503 | 0.375 | 0.724 | 196 | DAE (no) - PI (no) |
| A0A075B6H7 | 0.027 | 0.227 | 91 | DAE (yes) - PI (no) |
| ... | ... | ... | ... | ... |
| Q9Y6R7 | 0.282 | 0.318 | 197 | DAE (no) - PI (no) |
| Q9Y6X5 | 0.341 | 0.086 | 173 | DAE (no) - PI (no) |
| Q9Y6Y8;Q9Y6Y8-2 | 0.156 | 0.182 | 197 | DAE (no) - PI (no) |
| Q9Y6Y9 | 0.874 | 0.572 | 119 | DAE (no) - PI (no) |
| S4R3U6 | 0.049 | 0.538 | 126 | DAE (yes) - PI (no) |
1421 rows × 4 columns
List of features with the highest difference in qvalues
| DAE | PI | frequency | Differential Analysis Comparison | diff_qvalue | |
|---|---|---|---|---|---|
| protein groups | |||||
| P51688 | 0.006 | 0.994 | 58 | DAE (yes) - PI (no) | 0.988 |
| O15197;O15197-3 | 0.001 | 0.980 | 104 | DAE (yes) - PI (no) | 0.979 |
| Q8N9I0 | 0.012 | 0.989 | 141 | DAE (yes) - PI (no) | 0.977 |
| O00187;O00187-2 | 0.049 | 0.999 | 119 | DAE (yes) - PI (no) | 0.950 |
| Q14165 | 0.996 | 0.047 | 133 | DAE (no) - PI (yes) | 0.948 |
| ... | ... | ... | ... | ... | ... |
| Q9NX62 | 0.045 | 0.055 | 197 | DAE (yes) - PI (no) | 0.010 |
| P00740;P00740-2 | 0.043 | 0.053 | 197 | DAE (yes) - PI (no) | 0.010 |
| K7ERG9;P00746 | 0.042 | 0.052 | 197 | DAE (yes) - PI (no) | 0.010 |
| K7ERI9;P02654 | 0.050 | 0.043 | 196 | DAE (no) - PI (yes) | 0.007 |
| O43916 | 0.050 | 0.043 | 162 | DAE (no) - PI (yes) | 0.007 |
214 rows × 5 columns
Differences plotted with created annotations#
pimmslearn.plotting - INFO Saved Figures to runs/alzheimer_study/diff_analysis/AD/PI_vs_DAE/diff_analysis_comparision_1_DAE
also showing how many features were measured (“observed”) by size of circle
pimmslearn.plotting - INFO Saved Figures to runs/alzheimer_study/diff_analysis/AD/PI_vs_DAE/diff_analysis_comparision_2_DAE
Only features contained in model#
this block exist due to a specific part in the ALD analysis of the paper
root - INFO No features only in new comparision model.
DISEASES DB lookup#
Query diseases database for gene associations with specified disease ontology id.
pimmslearn.databases.diseases - WARNING There are more associations available
| ENSP | score | |
|---|---|---|
| None | ||
| APOE | ENSP00000252486 | 5.000 |
| PSEN2 | ENSP00000355747 | 5.000 |
| PSEN1 | ENSP00000326366 | 5.000 |
| APP | ENSP00000284981 | 5.000 |
| TREM2 | ENSP00000362205 | 4.825 |
| ... | ... | ... |
| ERP27 | ENSP00000266397 | 0.681 |
| ZNF585B | ENSP00000433773 | 0.681 |
| KIR3DL2 | ENSP00000325525 | 0.681 |
| C12orf66 | ENSP00000311486 | 0.681 |
| ELP2 | ENSP00000414851 | 0.681 |
10000 rows × 2 columns
only by model#
Only by model which were significant#
Only significant by RSN#
mask = (scores_common[(str(args.baseline), 'rejected')] & mask_different)
mask.sum()