|
552 | 552 | "id": "ae74387d", |
553 | 553 | "metadata": {}, |
554 | 554 | "source": [ |
555 | | - "# Analytical Plots\n", |
556 | | - "- data distribution (e.g. histogram)\n", |
| 555 | + "# Quality Control Plots (protein level)\n", |
| 556 | + "- data distribution (histogram and boxplot) to identify drift\n", |
557 | 557 | "- coefficient of variation (CV)\n", |
558 | 558 | "- number of identified proteins per sample" |
559 | 559 | ] |
560 | 560 | }, |
| 561 | + { |
| 562 | + "cell_type": "markdown", |
| 563 | + "id": "9d7e3e1f", |
| 564 | + "metadata": {}, |
| 565 | + "source": [ |
| 566 | + "## Data distribution (histogram)" |
| 567 | + ] |
| 568 | + }, |
561 | 569 | { |
562 | 570 | "cell_type": "code", |
563 | 571 | "execution_count": null, |
564 | 572 | "id": "c2de94d3", |
565 | 573 | "metadata": {}, |
566 | 574 | "outputs": [], |
567 | 575 | "source": [ |
568 | | - "_min_int, _max_int = proteins.min().min(), proteins.max().max()\n", |
569 | | - "bins = range(int(_min_int), int(_max_int) + 1, 1)\n", |
570 | | - "ax = proteins.T.hist(layout=(2, 4), bins=bins, sharex=True, sharey=True, figsize=(8, 4))\n", |
571 | | - "\n", |
572 | 576 | "min_int, max_int = int(proteins.min().min()), int(proteins.max().max())\n", |
573 | 577 | "bins = range(min_int, max_int+1, 1)\n", |
574 | 578 | "ax = proteins.T.hist(layout=(2, 4), bins=bins, sharex=True, sharey=True, figsize=(8, 4))" |
575 | 579 | ] |
576 | 580 | }, |
| 581 | + { |
| 582 | + "cell_type": "markdown", |
| 583 | + "id": "34cba269", |
| 584 | + "metadata": {}, |
| 585 | + "source": [ |
| 586 | + "## Data distribution (boxplot)" |
| 587 | + ] |
| 588 | + }, |
577 | 589 | { |
578 | 590 | "cell_type": "code", |
579 | 591 | "execution_count": null, |
|
596 | 608 | "id": "d39bedbb", |
597 | 609 | "metadata": {}, |
598 | 610 | "source": [ |
599 | | - "# Coefficient of Variation (CV)\n", |
| 611 | + "## Coefficient of Variation (CV)\n", |
600 | 612 | "- CV = standard deviation / mean\n", |
601 | 613 | " $$ CV = \\frac{\\sigma}{\\mu} $$\n", |
602 | 614 | "- per group\n", |
|
687 | 699 | "source": [ |
688 | 700 | "# Hierarchical Clustering of normalized data\n", |
689 | 701 | "- using completely observed data only\n", |
690 | | - "Checkout the [recipe on normalization methods](https://analytics-core.readthedocs.io/latest/api_examples/normalization_analysis.html)." |
| 702 | + "Checkout the \n", |
| 703 | + "[recipe on normalization methods](https://analytics-core.readthedocs.io/latest/api_examples/normalization_analysis.html).\n", |
| 704 | + "\n", |
| 705 | + "Let's see the effect of normalization on the clustering." |
691 | 706 | ] |
692 | 707 | }, |
693 | 708 | { |
|
1073 | 1088 | " pval_col=\"padj\", # toggle if it does not work\n", |
1074 | 1089 | " correction_alpha=0.2, # adjust the p-value to see more or less results\n", |
1075 | 1090 | ")\n", |
1076 | | - "enriched" |
| 1091 | + "enriched.set_index('identifiers')" |
1077 | 1092 | ] |
1078 | 1093 | }, |
1079 | 1094 | { |
|
1153 | 1168 | " out_dir_subsection / \"1_differently_regulated_as_in_paper.csv\",\n", |
1154 | 1169 | " index=False,\n", |
1155 | 1170 | ")\n", |
1156 | | - "view" |
| 1171 | + "view.set_index(\"identifier\")[['pvalue', 'log2FC', 'padj', 'rejected', 'mean(group1)', 'mean(group2)',\n", |
| 1172 | + " 'std(group1)', 'std(group2)', 'test', 'correction', \n", |
| 1173 | + " 'group1', 'group2', 'FC', '-log10 pvalue', 'Method']]" |
1157 | 1174 | ] |
1158 | 1175 | }, |
1159 | 1176 | { |
|
1201 | 1218 | "view = view.set_index(\"identifier\").join(proteins_meta.set_index(\"ProteinName\"))\n", |
1202 | 1219 | "view.to_csv(\n", |
1203 | 1220 | " out_dir_subsection / \"2_highlighted_proteins_in_figure3.csv\",\n", |
1204 | | - " index=False,\n", |
| 1221 | + " index=True,\n", |
1205 | 1222 | ")\n", |
1206 | 1223 | "sel_cols = [\n", |
1207 | | - " \"identifier\",\n", |
1208 | 1224 | " \"GeneName\",\n", |
1209 | 1225 | " \"log2FC\",\n", |
1210 | 1226 | " \"pvalue\",\n", |
|
1214 | 1230 | " \"group2\",\n", |
1215 | 1231 | " \"Method\",\n", |
1216 | 1232 | "]\n", |
1217 | | - "view.reset_index()[sel_cols].sort_values(\"log2FC\", ascending=False)" |
| 1233 | + "view[sel_cols].sort_values(\"log2FC\", ascending=False)" |
1218 | 1234 | ] |
1219 | 1235 | }, |
1220 | 1236 | { |
|
0 commit comments