|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "metadata": {}, |
| 6 | + "source": [ |
| 7 | + "# PreProcessing PCNet for OmicsIntegrator\n", |
| 8 | + "\n", |
| 9 | + "All Fraenkel-lab interactomes have been pre-processed to have 3 columns: 2 interactors and a scalar confidence\n", |
| 10 | + "However, OmicsIntegrator requires that edges have a cost, not a confidence. This notebook sets costs on the edges and augments those interactomes for use in OmicsIntegrator." |
| 11 | + ] |
| 12 | + }, |
| 13 | + { |
| 14 | + "cell_type": "code", |
| 15 | + "execution_count": 1, |
| 16 | + "metadata": {}, |
| 17 | + "outputs": [], |
| 18 | + "source": [ |
| 19 | + "import numpy as np\n", |
| 20 | + "import pandas as pd\n", |
| 21 | + "import matplotlib.pyplot as plt\n", |
| 22 | + "%matplotlib inline" |
| 23 | + ] |
| 24 | + }, |
| 25 | + { |
| 26 | + "cell_type": "code", |
| 27 | + "execution_count": 2, |
| 28 | + "metadata": {}, |
| 29 | + "outputs": [ |
| 30 | + { |
| 31 | + "data": { |
| 32 | + "text/html": [ |
| 33 | + "<div>\n", |
| 34 | + "<style scoped>\n", |
| 35 | + " .dataframe tbody tr th:only-of-type {\n", |
| 36 | + " vertical-align: middle;\n", |
| 37 | + " }\n", |
| 38 | + "\n", |
| 39 | + " .dataframe tbody tr th {\n", |
| 40 | + " vertical-align: top;\n", |
| 41 | + " }\n", |
| 42 | + "\n", |
| 43 | + " .dataframe thead th {\n", |
| 44 | + " text-align: right;\n", |
| 45 | + " }\n", |
| 46 | + "</style>\n", |
| 47 | + "<table border=\"1\" class=\"dataframe\">\n", |
| 48 | + " <thead>\n", |
| 49 | + " <tr style=\"text-align: right;\">\n", |
| 50 | + " <th></th>\n", |
| 51 | + " <th>protein1</th>\n", |
| 52 | + " <th>protein2</th>\n", |
| 53 | + " <th>confidence</th>\n", |
| 54 | + " </tr>\n", |
| 55 | + " </thead>\n", |
| 56 | + " <tbody>\n", |
| 57 | + " <tr>\n", |
| 58 | + " <th>0</th>\n", |
| 59 | + " <td>A1BG</td>\n", |
| 60 | + " <td>A2M</td>\n", |
| 61 | + " <td>NaN</td>\n", |
| 62 | + " </tr>\n", |
| 63 | + " <tr>\n", |
| 64 | + " <th>1</th>\n", |
| 65 | + " <td>A1BG</td>\n", |
| 66 | + " <td>ABCC6</td>\n", |
| 67 | + " <td>NaN</td>\n", |
| 68 | + " </tr>\n", |
| 69 | + " <tr>\n", |
| 70 | + " <th>2</th>\n", |
| 71 | + " <td>A1BG</td>\n", |
| 72 | + " <td>ACOT12</td>\n", |
| 73 | + " <td>NaN</td>\n", |
| 74 | + " </tr>\n", |
| 75 | + " <tr>\n", |
| 76 | + " <th>3</th>\n", |
| 77 | + " <td>A1BG</td>\n", |
| 78 | + " <td>ADH1A</td>\n", |
| 79 | + " <td>NaN</td>\n", |
| 80 | + " </tr>\n", |
| 81 | + " <tr>\n", |
| 82 | + " <th>4</th>\n", |
| 83 | + " <td>A1BG</td>\n", |
| 84 | + " <td>ADH4</td>\n", |
| 85 | + " <td>NaN</td>\n", |
| 86 | + " </tr>\n", |
| 87 | + " </tbody>\n", |
| 88 | + "</table>\n", |
| 89 | + "</div>" |
| 90 | + ], |
| 91 | + "text/plain": [ |
| 92 | + " protein1 protein2 confidence\n", |
| 93 | + "0 A1BG A2M NaN\n", |
| 94 | + "1 A1BG ABCC6 NaN\n", |
| 95 | + "2 A1BG ACOT12 NaN\n", |
| 96 | + "3 A1BG ADH1A NaN\n", |
| 97 | + "4 A1BG ADH4 NaN" |
| 98 | + ] |
| 99 | + }, |
| 100 | + "execution_count": 2, |
| 101 | + "metadata": {}, |
| 102 | + "output_type": "execute_result" |
| 103 | + } |
| 104 | + ], |
| 105 | + "source": [ |
| 106 | + "pcnet = pd.read_pickle(\"../../interactomes/PCNet/PCNet.05_2018.cleaned.namespace-mapped.full.pickle\")\n", |
| 107 | + "pcnet.head()" |
| 108 | + ] |
| 109 | + }, |
| 110 | + { |
| 111 | + "cell_type": "markdown", |
| 112 | + "metadata": {}, |
| 113 | + "source": [ |
| 114 | + "### PCNet is relatively unique in that we don't have confidences for the edges. We'll need to set them arbitrarily" |
| 115 | + ] |
| 116 | + }, |
| 117 | + { |
| 118 | + "cell_type": "code", |
| 119 | + "execution_count": 3, |
| 120 | + "metadata": {}, |
| 121 | + "outputs": [ |
| 122 | + { |
| 123 | + "data": { |
| 124 | + "text/html": [ |
| 125 | + "<div>\n", |
| 126 | + "<style scoped>\n", |
| 127 | + " .dataframe tbody tr th:only-of-type {\n", |
| 128 | + " vertical-align: middle;\n", |
| 129 | + " }\n", |
| 130 | + "\n", |
| 131 | + " .dataframe tbody tr th {\n", |
| 132 | + " vertical-align: top;\n", |
| 133 | + " }\n", |
| 134 | + "\n", |
| 135 | + " .dataframe thead th {\n", |
| 136 | + " text-align: right;\n", |
| 137 | + " }\n", |
| 138 | + "</style>\n", |
| 139 | + "<table border=\"1\" class=\"dataframe\">\n", |
| 140 | + " <thead>\n", |
| 141 | + " <tr style=\"text-align: right;\">\n", |
| 142 | + " <th></th>\n", |
| 143 | + " <th>protein1</th>\n", |
| 144 | + " <th>protein2</th>\n", |
| 145 | + " <th>cost</th>\n", |
| 146 | + " </tr>\n", |
| 147 | + " </thead>\n", |
| 148 | + " <tbody>\n", |
| 149 | + " <tr>\n", |
| 150 | + " <th>0</th>\n", |
| 151 | + " <td>A1BG</td>\n", |
| 152 | + " <td>A2M</td>\n", |
| 153 | + " <td>1.0</td>\n", |
| 154 | + " </tr>\n", |
| 155 | + " <tr>\n", |
| 156 | + " <th>1</th>\n", |
| 157 | + " <td>A1BG</td>\n", |
| 158 | + " <td>ABCC6</td>\n", |
| 159 | + " <td>1.0</td>\n", |
| 160 | + " </tr>\n", |
| 161 | + " <tr>\n", |
| 162 | + " <th>2</th>\n", |
| 163 | + " <td>A1BG</td>\n", |
| 164 | + " <td>ACOT12</td>\n", |
| 165 | + " <td>1.0</td>\n", |
| 166 | + " </tr>\n", |
| 167 | + " <tr>\n", |
| 168 | + " <th>3</th>\n", |
| 169 | + " <td>A1BG</td>\n", |
| 170 | + " <td>ADH1A</td>\n", |
| 171 | + " <td>1.0</td>\n", |
| 172 | + " </tr>\n", |
| 173 | + " <tr>\n", |
| 174 | + " <th>4</th>\n", |
| 175 | + " <td>A1BG</td>\n", |
| 176 | + " <td>ADH4</td>\n", |
| 177 | + " <td>1.0</td>\n", |
| 178 | + " </tr>\n", |
| 179 | + " </tbody>\n", |
| 180 | + "</table>\n", |
| 181 | + "</div>" |
| 182 | + ], |
| 183 | + "text/plain": [ |
| 184 | + " protein1 protein2 cost\n", |
| 185 | + "0 A1BG A2M 1.0\n", |
| 186 | + "1 A1BG ABCC6 1.0\n", |
| 187 | + "2 A1BG ACOT12 1.0\n", |
| 188 | + "3 A1BG ADH1A 1.0\n", |
| 189 | + "4 A1BG ADH4 1.0" |
| 190 | + ] |
| 191 | + }, |
| 192 | + "execution_count": 3, |
| 193 | + "metadata": {}, |
| 194 | + "output_type": "execute_result" |
| 195 | + } |
| 196 | + ], |
| 197 | + "source": [ |
| 198 | + "pcnet['cost'] = 1.0\n", |
| 199 | + "del pcnet['confidence']\n", |
| 200 | + "\n", |
| 201 | + "pcnet.head()" |
| 202 | + ] |
| 203 | + }, |
| 204 | + { |
| 205 | + "cell_type": "code", |
| 206 | + "execution_count": 4, |
| 207 | + "metadata": {}, |
| 208 | + "outputs": [], |
| 209 | + "source": [ |
| 210 | + "pcnet.to_csv('PCNet.05_2018.oi2', sep='\\t', index=False)\n" |
| 211 | + ] |
| 212 | + }, |
| 213 | + { |
| 214 | + "cell_type": "code", |
| 215 | + "execution_count": null, |
| 216 | + "metadata": {}, |
| 217 | + "outputs": [], |
| 218 | + "source": [] |
| 219 | + } |
| 220 | + ], |
| 221 | + "metadata": { |
| 222 | + "kernelspec": { |
| 223 | + "display_name": "Python 3", |
| 224 | + "language": "python", |
| 225 | + "name": "python3" |
| 226 | + }, |
| 227 | + "language_info": { |
| 228 | + "codemirror_mode": { |
| 229 | + "name": "ipython", |
| 230 | + "version": 3 |
| 231 | + }, |
| 232 | + "file_extension": ".py", |
| 233 | + "mimetype": "text/x-python", |
| 234 | + "name": "python", |
| 235 | + "nbconvert_exporter": "python", |
| 236 | + "pygments_lexer": "ipython3", |
| 237 | + "version": "3.6.5" |
| 238 | + } |
| 239 | + }, |
| 240 | + "nbformat": 4, |
| 241 | + "nbformat_minor": 2 |
| 242 | +} |
0 commit comments