diff --git a/Workflow.ipynb b/Workflow.ipynb index 2b1dc05..71a8ca2 100644 --- a/Workflow.ipynb +++ b/Workflow.ipynb @@ -64,8 +64,8 @@ "name": "stderr", "output_type": "stream", "text": [ - "/opt/anaconda3/envs/alphamap_fold/lib/python3.8/site-packages/IPython/core/interactiveshell.py:3364: DtypeWarning: Columns (2) have mixed types.Specify dtype option on import or set low_memory=False.\n", - " if (await self.run_code(code, result, async_=asy)):\n" + "/Users/isabell/Desktop/projects/packages/alphamap/alphamap/organisms_data.py:135: DtypeWarning: Columns (2) have mixed types. Specify dtype option on import or set low_memory=False.\n", + " uniprot_file = pd.read_csv(os.path.join(DATA_PATH, uniprot_name))\n" ] } ], @@ -142,7 +142,394 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/javascript": [ + "\n", + "(function(root) {\n", + " function now() {\n", + " return new Date();\n", + " }\n", + "\n", + " var force = true;\n", + "\n", + " if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n", + " root._bokeh_onload_callbacks = [];\n", + " root._bokeh_is_loading = undefined;\n", + " }\n", + "\n", + " if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n", + " root._bokeh_timeout = Date.now() + 5000;\n", + " root._bokeh_failed_load = false;\n", + " }\n", + "\n", + " function run_callbacks() {\n", + " try {\n", + " root._bokeh_onload_callbacks.forEach(function(callback) {\n", + " if (callback != null)\n", + " callback();\n", + " });\n", + " } finally {\n", + " delete root._bokeh_onload_callbacks\n", + " }\n", + " console.debug(\"Bokeh: all callbacks have finished\");\n", + " }\n", + "\n", + " function load_libs(css_urls, js_urls, callback) {\n", + " if (css_urls == null) css_urls = [];\n", + " if (js_urls == null) js_urls = [];\n", + "\n", + " root._bokeh_onload_callbacks.push(callback);\n", + " if (root._bokeh_is_loading > 0) {\n", + " console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n", + " return null;\n", + " }\n", + " if (js_urls == null || js_urls.length === 0) {\n", + " run_callbacks();\n", + " return null;\n", + " }\n", + " console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n", + " root._bokeh_is_loading = css_urls.length + js_urls.length;\n", + "\n", + " function on_load() {\n", + " root._bokeh_is_loading--;\n", + " if (root._bokeh_is_loading === 0) {\n", + " console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n", + " run_callbacks()\n", + " }\n", + " }\n", + "\n", + " function on_error() {\n", + " console.error(\"failed to load \" + url);\n", + " }\n", + "\n", + " for (var i = 0; i < css_urls.length; i++) {\n", + " var url = css_urls[i];\n", + " const element = document.createElement(\"link\");\n", + " element.onload = on_load;\n", + " element.onerror = on_error;\n", + " element.rel = \"stylesheet\";\n", + " element.type = \"text/css\";\n", + " element.href = url;\n", + " console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n", + " document.body.appendChild(element);\n", + " }\n", + "\n", + " var skip = [];\n", + " if (window.requirejs) {\n", + " require([], function() {\n", + " })\n", + " }\n", + " for (var i = 0; i < js_urls.length; i++) {\n", + " var url = js_urls[i];\n", + " if (skip.indexOf(url) >= 0) { on_load(); continue; }\n", + " var element = document.createElement('script');\n", + " element.onload = on_load;\n", + " element.onerror = on_error;\n", + " element.async = false;\n", + " element.src = url;\n", + " console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n", + " document.head.appendChild(element);\n", + " }\n", + "\tif (!js_urls.length) {\n", + " on_load()\n", + " }\n", + " };\n", + "\n", + " function inject_raw_css(css) {\n", + " const element = document.createElement(\"style\");\n", + " element.appendChild(document.createTextNode(css));\n", + " document.body.appendChild(element);\n", + " }\n", + "\n", + " var js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-2.2.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.2.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.2.2.min.js\", \"https://unpkg.com/@holoviz/panel@^0.10.3/dist/panel.min.js\"];\n", + " var css_urls = [\"https://unpkg.com/@holoviz/panel@0.10.3/dist/css/alerts.css\", \"https://unpkg.com/@holoviz/panel@0.10.3/dist/css/card.css\", \"https://unpkg.com/@holoviz/panel@0.10.3/dist/css/widgets.css\", \"https://unpkg.com/@holoviz/panel@0.10.3/dist/css/markdown.css\", \"https://unpkg.com/@holoviz/panel@0.10.3/dist/css/json.css\", \"https://unpkg.com/@holoviz/panel@0.10.3/dist/css/dataframe.css\"];\n", + "\n", + " var inline_js = [\n", + " function(Bokeh) {\n", + " Bokeh.set_log_level(\"info\");\n", + " },\n", + " function(Bokeh) {} // ensure no trailing comma for IE\n", + " ];\n", + "\n", + " function run_inline_js() {\n", + " if ((root.Bokeh !== undefined) || (force === true)) {\n", + " for (var i = 0; i < inline_js.length; i++) {\n", + " inline_js[i].call(root, root.Bokeh);\n", + " }} else if (Date.now() < root._bokeh_timeout) {\n", + " setTimeout(run_inline_js, 100);\n", + " } else if (!root._bokeh_failed_load) {\n", + " console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n", + " root._bokeh_failed_load = true;\n", + " }\n", + " }\n", + "\n", + " if (root._bokeh_is_loading === 0) {\n", + " console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n", + " run_inline_js();\n", + " } else {\n", + " load_libs(css_urls, js_urls, function() {\n", + " console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n", + " run_inline_js();\n", + " });\n", + " }\n", + "}(window));" + ], + "application/vnd.holoviews_load.v0+json": "\n(function(root) {\n function now() {\n return new Date();\n }\n\n var force = true;\n\n if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n root._bokeh_onload_callbacks = [];\n root._bokeh_is_loading = undefined;\n }\n\n if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n root._bokeh_timeout = Date.now() + 5000;\n root._bokeh_failed_load = false;\n }\n\n function run_callbacks() {\n try {\n root._bokeh_onload_callbacks.forEach(function(callback) {\n if (callback != null)\n callback();\n });\n } finally {\n delete root._bokeh_onload_callbacks\n }\n console.debug(\"Bokeh: all callbacks have finished\");\n }\n\n function load_libs(css_urls, js_urls, callback) {\n if (css_urls == null) css_urls = [];\n if (js_urls == null) js_urls = [];\n\n root._bokeh_onload_callbacks.push(callback);\n if (root._bokeh_is_loading > 0) {\n console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n return null;\n }\n if (js_urls == null || js_urls.length === 0) {\n run_callbacks();\n return null;\n }\n console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n root._bokeh_is_loading = css_urls.length + js_urls.length;\n\n function on_load() {\n root._bokeh_is_loading--;\n if (root._bokeh_is_loading === 0) {\n console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n run_callbacks()\n }\n }\n\n function on_error() {\n console.error(\"failed to load \" + url);\n }\n\n for (var i = 0; i < css_urls.length; i++) {\n var url = css_urls[i];\n const element = document.createElement(\"link\");\n element.onload = on_load;\n element.onerror = on_error;\n element.rel = \"stylesheet\";\n element.type = \"text/css\";\n element.href = url;\n console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n document.body.appendChild(element);\n }\n\n var skip = [];\n if (window.requirejs) {\n require([], function() {\n })\n }\n for (var i = 0; i < js_urls.length; i++) {\n var url = js_urls[i];\n if (skip.indexOf(url) >= 0) { on_load(); continue; }\n var element = document.createElement('script');\n element.onload = on_load;\n element.onerror = on_error;\n element.async = false;\n element.src = url;\n console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.head.appendChild(element);\n }\n\tif (!js_urls.length) {\n on_load()\n }\n };\n\n function inject_raw_css(css) {\n const element = document.createElement(\"style\");\n element.appendChild(document.createTextNode(css));\n document.body.appendChild(element);\n }\n\n var js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-2.2.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.2.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.2.2.min.js\", \"https://unpkg.com/@holoviz/panel@^0.10.3/dist/panel.min.js\"];\n var css_urls = [\"https://unpkg.com/@holoviz/panel@0.10.3/dist/css/alerts.css\", \"https://unpkg.com/@holoviz/panel@0.10.3/dist/css/card.css\", \"https://unpkg.com/@holoviz/panel@0.10.3/dist/css/widgets.css\", \"https://unpkg.com/@holoviz/panel@0.10.3/dist/css/markdown.css\", \"https://unpkg.com/@holoviz/panel@0.10.3/dist/css/json.css\", \"https://unpkg.com/@holoviz/panel@0.10.3/dist/css/dataframe.css\"];\n\n var inline_js = [\n function(Bokeh) {\n Bokeh.set_log_level(\"info\");\n },\n function(Bokeh) {} // ensure no trailing comma for IE\n ];\n\n function run_inline_js() {\n if ((root.Bokeh !== undefined) || (force === true)) {\n for (var i = 0; i < inline_js.length; i++) {\n inline_js[i].call(root, root.Bokeh);\n }} else if (Date.now() < root._bokeh_timeout) {\n setTimeout(run_inline_js, 100);\n } else if (!root._bokeh_failed_load) {\n console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n root._bokeh_failed_load = true;\n }\n }\n\n if (root._bokeh_is_loading === 0) {\n console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n run_inline_js();\n } else {\n load_libs(css_urls, js_urls, function() {\n console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n run_inline_js();\n });\n }\n}(window));" + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/javascript": [ + "\n", + "if ((window.PyViz === undefined) || (window.PyViz instanceof HTMLElement)) {\n", + " window.PyViz = {comms: {}, comm_status:{}, kernels:{}, receivers: {}, plot_index: []}\n", + "}\n", + "\n", + "\n", + " function JupyterCommManager() {\n", + " }\n", + "\n", + " JupyterCommManager.prototype.register_target = function(plot_id, comm_id, msg_handler) {\n", + " if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n", + " var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n", + " comm_manager.register_target(comm_id, function(comm) {\n", + " comm.on_msg(msg_handler);\n", + " });\n", + " } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n", + " window.PyViz.kernels[plot_id].registerCommTarget(comm_id, function(comm) {\n", + " comm.onMsg = msg_handler;\n", + " });\n", + " } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n", + " google.colab.kernel.comms.registerTarget(comm_id, (comm) => {\n", + " var messages = comm.messages[Symbol.asyncIterator]();\n", + " function processIteratorResult(result) {\n", + " var message = result.value;\n", + " console.log(message)\n", + " var content = {data: message.data, comm_id};\n", + " var buffers = []\n", + " for (var buffer of message.buffers || []) {\n", + " buffers.push(new DataView(buffer))\n", + " }\n", + " var metadata = message.metadata || {};\n", + " var msg = {content, buffers, metadata}\n", + " msg_handler(msg);\n", + " return messages.next().then(processIteratorResult);\n", + " }\n", + " return messages.next().then(processIteratorResult);\n", + " })\n", + " }\n", + " }\n", + "\n", + " JupyterCommManager.prototype.get_client_comm = function(plot_id, comm_id, msg_handler) {\n", + " if (comm_id in window.PyViz.comms) {\n", + " return window.PyViz.comms[comm_id];\n", + " } else if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n", + " var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n", + " var comm = comm_manager.new_comm(comm_id, {}, {}, {}, comm_id);\n", + " if (msg_handler) {\n", + " comm.on_msg(msg_handler);\n", + " }\n", + " } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n", + " var comm = window.PyViz.kernels[plot_id].connectToComm(comm_id);\n", + " comm.open();\n", + " if (msg_handler) {\n", + " comm.onMsg = msg_handler;\n", + " }\n", + " } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n", + " var comm_promise = google.colab.kernel.comms.open(comm_id)\n", + " comm_promise.then((comm) => {\n", + " window.PyViz.comms[comm_id] = comm;\n", + " if (msg_handler) {\n", + " var messages = comm.messages[Symbol.asyncIterator]();\n", + " function processIteratorResult(result) {\n", + " var message = result.value;\n", + " var content = {data: message.data};\n", + " var metadata = message.metadata || {comm_id};\n", + " var msg = {content, metadata}\n", + " msg_handler(msg);\n", + " return messages.next().then(processIteratorResult);\n", + " }\n", + " return messages.next().then(processIteratorResult);\n", + " }\n", + " }) \n", + " var sendClosure = (data, metadata, buffers, disposeOnDone) => {\n", + " return comm_promise.then((comm) => {\n", + " comm.send(data, metadata, buffers, disposeOnDone);\n", + " });\n", + " };\n", + " var comm = {\n", + " send: sendClosure\n", + " };\n", + " }\n", + " window.PyViz.comms[comm_id] = comm;\n", + " return comm;\n", + " }\n", + " window.PyViz.comm_manager = new JupyterCommManager();\n", + " \n", + "\n", + "\n", + "var JS_MIME_TYPE = 'application/javascript';\n", + "var HTML_MIME_TYPE = 'text/html';\n", + "var EXEC_MIME_TYPE = 'application/vnd.holoviews_exec.v0+json';\n", + "var CLASS_NAME = 'output';\n", + "\n", + "/**\n", + " * Render data to the DOM node\n", + " */\n", + "function render(props, node) {\n", + " var div = document.createElement(\"div\");\n", + " var script = document.createElement(\"script\");\n", + " node.appendChild(div);\n", + " node.appendChild(script);\n", + "}\n", + "\n", + "/**\n", + " * Handle when a new output is added\n", + " */\n", + "function handle_add_output(event, handle) {\n", + " var output_area = handle.output_area;\n", + " var output = handle.output;\n", + " if ((output.data == undefined) || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n", + " return\n", + " }\n", + " var id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n", + " var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n", + " if (id !== undefined) {\n", + " var nchildren = toinsert.length;\n", + " var html_node = toinsert[nchildren-1].children[0];\n", + " html_node.innerHTML = output.data[HTML_MIME_TYPE];\n", + " var scripts = [];\n", + " var nodelist = html_node.querySelectorAll(\"script\");\n", + " for (var i in nodelist) {\n", + " if (nodelist.hasOwnProperty(i)) {\n", + " scripts.push(nodelist[i])\n", + " }\n", + " }\n", + "\n", + " scripts.forEach( function (oldScript) {\n", + " var newScript = document.createElement(\"script\");\n", + " var attrs = [];\n", + " var nodemap = oldScript.attributes;\n", + " for (var j in nodemap) {\n", + " if (nodemap.hasOwnProperty(j)) {\n", + " attrs.push(nodemap[j])\n", + " }\n", + " }\n", + " attrs.forEach(function(attr) { newScript.setAttribute(attr.name, attr.value) });\n", + " newScript.appendChild(document.createTextNode(oldScript.innerHTML));\n", + " oldScript.parentNode.replaceChild(newScript, oldScript);\n", + " });\n", + " if (JS_MIME_TYPE in output.data) {\n", + " toinsert[nchildren-1].children[1].textContent = output.data[JS_MIME_TYPE];\n", + " }\n", + " output_area._hv_plot_id = id;\n", + " if ((window.Bokeh !== undefined) && (id in Bokeh.index)) {\n", + " window.PyViz.plot_index[id] = Bokeh.index[id];\n", + " } else {\n", + " window.PyViz.plot_index[id] = null;\n", + " }\n", + " } else if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n", + " var bk_div = document.createElement(\"div\");\n", + " bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n", + " var script_attrs = bk_div.children[0].attributes;\n", + " for (var i = 0; i < script_attrs.length; i++) {\n", + " toinsert[toinsert.length - 1].childNodes[1].setAttribute(script_attrs[i].name, script_attrs[i].value);\n", + " }\n", + " // store reference to server id on output_area\n", + " output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n", + " }\n", + "}\n", + "\n", + "/**\n", + " * Handle when an output is cleared or removed\n", + " */\n", + "function handle_clear_output(event, handle) {\n", + " var id = handle.cell.output_area._hv_plot_id;\n", + " var server_id = handle.cell.output_area._bokeh_server_id;\n", + " if (((id === undefined) || !(id in PyViz.plot_index)) && (server_id !== undefined)) { return; }\n", + " var comm = window.PyViz.comm_manager.get_client_comm(\"hv-extension-comm\", \"hv-extension-comm\", function () {});\n", + " if (server_id !== null) {\n", + " comm.send({event_type: 'server_delete', 'id': server_id});\n", + " return;\n", + " } else if (comm !== null) {\n", + " comm.send({event_type: 'delete', 'id': id});\n", + " }\n", + " delete PyViz.plot_index[id];\n", + " if ((window.Bokeh !== undefined) & (id in window.Bokeh.index)) {\n", + " var doc = window.Bokeh.index[id].model.document\n", + " doc.clear();\n", + " const i = window.Bokeh.documents.indexOf(doc);\n", + " if (i > -1) {\n", + " window.Bokeh.documents.splice(i, 1);\n", + " }\n", + " }\n", + "}\n", + "\n", + "/**\n", + " * Handle kernel restart event\n", + " */\n", + "function handle_kernel_cleanup(event, handle) {\n", + " delete PyViz.comms[\"hv-extension-comm\"];\n", + " window.PyViz.plot_index = {}\n", + "}\n", + "\n", + "/**\n", + " * Handle update_display_data messages\n", + " */\n", + "function handle_update_output(event, handle) {\n", + " handle_clear_output(event, {cell: {output_area: handle.output_area}})\n", + " handle_add_output(event, handle)\n", + "}\n", + "\n", + "function register_renderer(events, OutputArea) {\n", + " function append_mime(data, metadata, element) {\n", + " // create a DOM node to render to\n", + " var toinsert = this.create_output_subarea(\n", + " metadata,\n", + " CLASS_NAME,\n", + " EXEC_MIME_TYPE\n", + " );\n", + " this.keyboard_manager.register_events(toinsert);\n", + " // Render to node\n", + " var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n", + " render(props, toinsert[0]);\n", + " element.append(toinsert);\n", + " return toinsert\n", + " }\n", + "\n", + " events.on('output_added.OutputArea', handle_add_output);\n", + " events.on('output_updated.OutputArea', handle_update_output);\n", + " events.on('clear_output.CodeCell', handle_clear_output);\n", + " events.on('delete.Cell', handle_clear_output);\n", + " events.on('kernel_ready.Kernel', handle_kernel_cleanup);\n", + "\n", + " OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n", + " safe: true,\n", + " index: 0\n", + " });\n", + "}\n", + "\n", + "if (window.Jupyter !== undefined) {\n", + " try {\n", + " var events = require('base/js/events');\n", + " var OutputArea = require('notebook/js/outputarea').OutputArea;\n", + " if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n", + " register_renderer(events, OutputArea);\n", + " }\n", + " } catch(err) {\n", + " }\n", + "}\n" + ], + "application/vnd.holoviews_load.v0+json": "\nif ((window.PyViz === undefined) || (window.PyViz instanceof HTMLElement)) {\n window.PyViz = {comms: {}, comm_status:{}, kernels:{}, receivers: {}, plot_index: []}\n}\n\n\n function JupyterCommManager() {\n }\n\n JupyterCommManager.prototype.register_target = function(plot_id, comm_id, msg_handler) {\n if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n comm_manager.register_target(comm_id, function(comm) {\n comm.on_msg(msg_handler);\n });\n } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n window.PyViz.kernels[plot_id].registerCommTarget(comm_id, function(comm) {\n comm.onMsg = msg_handler;\n });\n } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n google.colab.kernel.comms.registerTarget(comm_id, (comm) => {\n var messages = comm.messages[Symbol.asyncIterator]();\n function processIteratorResult(result) {\n var message = result.value;\n console.log(message)\n var content = {data: message.data, comm_id};\n var buffers = []\n for (var buffer of message.buffers || []) {\n buffers.push(new DataView(buffer))\n }\n var metadata = message.metadata || {};\n var msg = {content, buffers, metadata}\n msg_handler(msg);\n return messages.next().then(processIteratorResult);\n }\n return messages.next().then(processIteratorResult);\n })\n }\n }\n\n JupyterCommManager.prototype.get_client_comm = function(plot_id, comm_id, msg_handler) {\n if (comm_id in window.PyViz.comms) {\n return window.PyViz.comms[comm_id];\n } else if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n var comm = comm_manager.new_comm(comm_id, {}, {}, {}, comm_id);\n if (msg_handler) {\n comm.on_msg(msg_handler);\n }\n } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n var comm = window.PyViz.kernels[plot_id].connectToComm(comm_id);\n comm.open();\n if (msg_handler) {\n comm.onMsg = msg_handler;\n }\n } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n var comm_promise = google.colab.kernel.comms.open(comm_id)\n comm_promise.then((comm) => {\n window.PyViz.comms[comm_id] = comm;\n if (msg_handler) {\n var messages = comm.messages[Symbol.asyncIterator]();\n function processIteratorResult(result) {\n var message = result.value;\n var content = {data: message.data};\n var metadata = message.metadata || {comm_id};\n var msg = {content, metadata}\n msg_handler(msg);\n return messages.next().then(processIteratorResult);\n }\n return messages.next().then(processIteratorResult);\n }\n }) \n var sendClosure = (data, metadata, buffers, disposeOnDone) => {\n return comm_promise.then((comm) => {\n comm.send(data, metadata, buffers, disposeOnDone);\n });\n };\n var comm = {\n send: sendClosure\n };\n }\n window.PyViz.comms[comm_id] = comm;\n return comm;\n }\n window.PyViz.comm_manager = new JupyterCommManager();\n \n\n\nvar JS_MIME_TYPE = 'application/javascript';\nvar HTML_MIME_TYPE = 'text/html';\nvar EXEC_MIME_TYPE = 'application/vnd.holoviews_exec.v0+json';\nvar CLASS_NAME = 'output';\n\n/**\n * Render data to the DOM node\n */\nfunction render(props, node) {\n var div = document.createElement(\"div\");\n var script = document.createElement(\"script\");\n node.appendChild(div);\n node.appendChild(script);\n}\n\n/**\n * Handle when a new output is added\n */\nfunction handle_add_output(event, handle) {\n var output_area = handle.output_area;\n var output = handle.output;\n if ((output.data == undefined) || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n return\n }\n var id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n if (id !== undefined) {\n var nchildren = toinsert.length;\n var html_node = toinsert[nchildren-1].children[0];\n html_node.innerHTML = output.data[HTML_MIME_TYPE];\n var scripts = [];\n var nodelist = html_node.querySelectorAll(\"script\");\n for (var i in nodelist) {\n if (nodelist.hasOwnProperty(i)) {\n scripts.push(nodelist[i])\n }\n }\n\n scripts.forEach( function (oldScript) {\n var newScript = document.createElement(\"script\");\n var attrs = [];\n var nodemap = oldScript.attributes;\n for (var j in nodemap) {\n if (nodemap.hasOwnProperty(j)) {\n attrs.push(nodemap[j])\n }\n }\n attrs.forEach(function(attr) { newScript.setAttribute(attr.name, attr.value) });\n newScript.appendChild(document.createTextNode(oldScript.innerHTML));\n oldScript.parentNode.replaceChild(newScript, oldScript);\n });\n if (JS_MIME_TYPE in output.data) {\n toinsert[nchildren-1].children[1].textContent = output.data[JS_MIME_TYPE];\n }\n output_area._hv_plot_id = id;\n if ((window.Bokeh !== undefined) && (id in Bokeh.index)) {\n window.PyViz.plot_index[id] = Bokeh.index[id];\n } else {\n window.PyViz.plot_index[id] = null;\n }\n } else if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n var bk_div = document.createElement(\"div\");\n bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n var script_attrs = bk_div.children[0].attributes;\n for (var i = 0; i < script_attrs.length; i++) {\n toinsert[toinsert.length - 1].childNodes[1].setAttribute(script_attrs[i].name, script_attrs[i].value);\n }\n // store reference to server id on output_area\n output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n }\n}\n\n/**\n * Handle when an output is cleared or removed\n */\nfunction handle_clear_output(event, handle) {\n var id = handle.cell.output_area._hv_plot_id;\n var server_id = handle.cell.output_area._bokeh_server_id;\n if (((id === undefined) || !(id in PyViz.plot_index)) && (server_id !== undefined)) { return; }\n var comm = window.PyViz.comm_manager.get_client_comm(\"hv-extension-comm\", \"hv-extension-comm\", function () {});\n if (server_id !== null) {\n comm.send({event_type: 'server_delete', 'id': server_id});\n return;\n } else if (comm !== null) {\n comm.send({event_type: 'delete', 'id': id});\n }\n delete PyViz.plot_index[id];\n if ((window.Bokeh !== undefined) & (id in window.Bokeh.index)) {\n var doc = window.Bokeh.index[id].model.document\n doc.clear();\n const i = window.Bokeh.documents.indexOf(doc);\n if (i > -1) {\n window.Bokeh.documents.splice(i, 1);\n }\n }\n}\n\n/**\n * Handle kernel restart event\n */\nfunction handle_kernel_cleanup(event, handle) {\n delete PyViz.comms[\"hv-extension-comm\"];\n window.PyViz.plot_index = {}\n}\n\n/**\n * Handle update_display_data messages\n */\nfunction handle_update_output(event, handle) {\n handle_clear_output(event, {cell: {output_area: handle.output_area}})\n handle_add_output(event, handle)\n}\n\nfunction register_renderer(events, OutputArea) {\n function append_mime(data, metadata, element) {\n // create a DOM node to render to\n var toinsert = this.create_output_subarea(\n metadata,\n CLASS_NAME,\n EXEC_MIME_TYPE\n );\n this.keyboard_manager.register_events(toinsert);\n // Render to node\n var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n render(props, toinsert[0]);\n element.append(toinsert);\n return toinsert\n }\n\n events.on('output_added.OutputArea', handle_add_output);\n events.on('output_updated.OutputArea', handle_update_output);\n events.on('clear_output.CodeCell', handle_clear_output);\n events.on('delete.Cell', handle_clear_output);\n events.on('kernel_ready.Kernel', handle_kernel_cleanup);\n\n OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n safe: true,\n index: 0\n });\n}\n\nif (window.Jupyter !== undefined) {\n try {\n var events = require('base/js/events');\n var OutputArea = require('notebook/js/outputarea').OutputArea;\n if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n register_renderer(events, OutputArea);\n }\n } catch(err) {\n }\n}\n" + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "from alphamap.sequenceplot import plot_peptide_traces, uniprot_color_dict\n", "from alphamap.uniprot_integration import uniprot_feature_dict" @@ -7587,9 +7974,9 @@ } }, "text/html": [ - "
+
+ + + +
+ + + + +
+ +
+ +
+ + + + {% endraw %} @@ -53,7 +454,7 @@

Format uniprot annotation -

format_uniprot_annotation[source]

format_uniprot_annotation(uniprot_ann:DataFrame, uniprot_feature_dict:dict)

+

format_uniprot_annotation[source]

format_uniprot_annotation(uniprot_ann:DataFrame, uniprot_feature_dict:dict)

Function to format uniprot annotation for plotting.

Args: @@ -103,7 +504,7 @@

Format data for plotting -

get_plot_data[source]

get_plot_data(protein, df, fasta)

+

get_plot_data[source]

get_plot_data(protein, df, fasta)

Function to format experimental data for plotting.

Args: @@ -147,7 +548,7 @@

Function to plot a single dataset -

plot_single_peptide_traces[source]

plot_single_peptide_traces(df_plot, protein, fasta)

+

plot_single_peptide_traces[source]

plot_single_peptide_traces(df_plot, protein, fasta)

Function to plot single peptide trace.

Args: @@ -219,7 +620,7 @@

Plotting function for the
-

get_quality_category[source]

get_quality_category(s)

+

get_quality_category[source]

get_quality_category(s)

@@ -250,7 +651,7 @@

get_quality_category -

get_exposure_category[source]

get_exposure_category(s)

+

get_exposure_category[source]

get_exposure_category(s)

@@ -281,7 +682,7 @@

get_exposure_category -

get_alphafold_annotation[source]

get_alphafold_annotation(protein:str, selected_features:list, download_folder:str='/var/folders/zx/n29r0swn0hddt1qgy159sjrw0000gn/T')

+

get_alphafold_annotation[source]

get_alphafold_annotation(protein:str, selected_features:list, download_folder:str='/var/folders/zx/n29r0swn0hddt1qgy159sjrw0000gn/T')

@@ -334,7 +735,7 @@

get_alphafold_annotat
-

plot_peptide_traces[source]

plot_peptide_traces(df:DataFrame, name:str, protein:str, fasta:pyteomics.fasta, uniprot:DataFrame, selected_features:list, uniprot_feature_dict:dict, uniprot_color_dict:dict, selected_proteases:list=[], selected_alphafold_features:list=[], dashboard:bool=False, trace_colors:list=[], download_folder:str='/var/folders/zx/n29r0swn0hddt1qgy159sjrw0000gn/T')

+

plot_peptide_traces[source]

plot_peptide_traces(df:DataFrame, name:str, protein:str, fasta:py'>, uniprot:DataFrame, selected_features:list, uniprot_feature_dict:dict, uniprot_color_dict:dict, selected_proteases:list=[], selected_alphafold_features:list=[], dashboard:bool=False, trace_colors:list=[], download_folder:str='/var/folders/zx/n29r0swn0hddt1qgy159sjrw0000gn/T')

Function to generate the sequence plot.

Args: @@ -386,7 +787,7 @@

3D visualization -

extract_annotation[source]

extract_annotation(df:DataFrame)

+

extract_annotation[source]

extract_annotation(df:DataFrame)

@@ -417,7 +818,7 @@

extract_annotation -

manipulate_cif[source]

manipulate_cif(protein:str, MS_data:DataFrame, download_folder:str='/var/folders/zx/n29r0swn0hddt1qgy159sjrw0000gn/T')

+

manipulate_cif[source]

manipulate_cif(protein:str, MS_data:DataFrame, download_folder:str='/var/folders/zx/n29r0swn0hddt1qgy159sjrw0000gn/T')

@@ -448,7 +849,7 @@

manipulate_cif -

adjust_html[source]

adjust_html(protein:str, coloring:str, data_name:str)

+

adjust_html[source]

adjust_html(protein:str, coloring:str, data_name:str)

@@ -479,7 +880,7 @@

adjust_html -

get_ms_concensus[source]

get_ms_concensus(ms_list)

+

get_ms_concensus[source]

get_ms_concensus(ms_list)

@@ -510,9 +911,9 @@

get_ms_concensus -

plot_3d_structure[source]

plot_3d_structure(df:DataFrame, name:str, protein:str, fasta:pyteomics.fasta, selected_coloring:str, dashboard:bool=False, download_folder:str='/var/folders/zx/n29r0swn0hddt1qgy159sjrw0000gn/T')

+

plot_3d_structure[source]

plot_3d_structure(df:DataFrame, name:str, protein:str, fasta:py'>, selected_coloring:str, dashboard:bool=False, download_folder:str='/var/folders/zx/n29r0swn0hddt1qgy159sjrw0000gn/T')

-

Function to generate the sequence plot.

+

Function to generate the 3D sequence plot.

Args: df (pd.DataFrame/list): Single dataframe or list of dataframes containing the datasets to plot. name (str): Single string containing the name of the MS dataset in df. @@ -537,6 +938,500 @@

plot_3d_structure + + {% endraw %} + + {% raw %} + +
+ +
+
+ +
+ + +
+

format_for_3Dviz[source]

format_for_3Dviz(df:DataFrame, ptm_dataset:str)

+
+

Function to format data for 3D visualization.

+

Args: + df (pd.DataFrame): Single dataframe containing PTM data for visualization, + formatted accorinding to StructureMap. + ptm_dataset (str): Single string containing the name of the target PTM column in df.

+

Returns: + pd.DataFrame: DataFrame containing the formatted PTM dat

+ +
+ +
+ +
+
+ +
+ {% endraw %} + + {% raw %} + +
+ +
+ {% endraw %} + + {% raw %} + +
+ +
+
+ +
+ + +
+

visualize_structure_in_panel[source]

visualize_structure_in_panel(plot_html:str, js_path:str, cif_path:str)

+
+ +
+ +
+ +
+
+ +
+ {% endraw %} + + {% raw %} + +
+ +
+
+ +
+ + + + +
+ +
+ +
+ +
+ + + + +
+ +
+ +
+ +
+
+ +
+ {% endraw %} + + {% raw %} + +
+
+ +
+
+
# mod_html, js_path, cif_path = plot_3d_structure(df = formatted_diann_data,
+#                     name = 'proteome',
+#                     protein = "P23284", #Q9H7C9, P23284
+#                     fasta = human_fasta,
+#                     selected_coloring = 'AlphaFold quality', #'AlphaFold exposure', #'AlphaFold quality', 'MS data'
+#                     dashboard = False)
+
+# visualize_structure_in_panel(mod_html, js_path, cif_path)
+
+ +
+
+
+
{% endraw %} @@ -566,22 +1461,39 @@

plot_3d_structure -
- + {% endraw %} + + {% raw %} + +
+
{% endraw %} @@ -602,7 +1514,7 @@

Create a pdf report -

create_pdf_report[source]

create_pdf_report(proteins:list, df:DataFrame, name:str, fasta:pyteomics.fasta, uniprot:DataFrame, selected_features:list, uniprot_feature_dict:dict, uniprot_color_dict:dict, selected_proteases:list=[], trace_colors:list=[])

+

create_pdf_report[source]

create_pdf_report(proteins:list, df:DataFrame, name:str, fasta:py'>, uniprot:DataFrame, selected_features:list, uniprot_feature_dict:dict, uniprot_color_dict:dict, selected_proteases:list=[], trace_colors:list=[])

Function to write pdf reports for selected proteins

Args: diff --git a/misc/bumpversion.cfg b/misc/bumpversion.cfg index 18c0ce4..975ae44 100644 --- a/misc/bumpversion.cfg +++ b/misc/bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.1.8 +current_version = 0.1.9 commit = False tag = False parse = (?P\d+)\.(?P\d+)\.(?P\d+)(\-(?P[a-z]+)(?P\d+))? diff --git a/misc/one_click_macos/Info.plist b/misc/one_click_macos/Info.plist index 1b76eeb..e1e25a3 100644 --- a/misc/one_click_macos/Info.plist +++ b/misc/one_click_macos/Info.plist @@ -9,9 +9,9 @@ CFBundleIconFile alpha_logo.icns CFBundleIdentifier - alphamap.0.1.8 + alphamap.0.1.9 CFBundleShortVersionString - 0.1.8 + 0.1.9 CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/misc/one_click_macos/create_installer_macos.sh b/misc/one_click_macos/create_installer_macos.sh index e02dccd..7d61a95 100644 --- a/misc/one_click_macos/create_installer_macos.sh +++ b/misc/one_click_macos/create_installer_macos.sh @@ -17,7 +17,7 @@ rm -rf build python setup.py sdist bdist_wheel cd misc/one_click_macos pip install pyinstaller==4.2 -pip install "../../dist/alphamap-0.1.8-py3-none-any.whl" +pip install "../../dist/alphamap-0.1.9-py3-none-any.whl" conda list pyinstaller ../pyinstaller/alphamap.spec -y conda deactivate @@ -37,7 +37,7 @@ if false; then for f in $(find dist/alphamap -name '*.so' -or -name '*.dylib'); do codesign --sign "Developer ID Application: Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (7QSY5527AQ)" $f; done codesign --sign "Developer ID Application: Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (7QSY5527AQ)" dist/alphamap/Contents/MacOS/alphamap_gui --force --options=runtime --entitlements entitlements.xml codesign --sign "Developer ID Application: Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (7QSY5527AQ)" dist/alphamap/Contents/MacOS/kaleido/executable/bin/kaleido --force --options=runtime --entitlements entitlements.xml - pkgbuild --root dist/alphamap --identifier de.mpg.biochem.alphamap.app --version 0.1.8 --install-location /Applications/AlphaMap.app --scripts scripts alphamap.pkg --sign "Developer ID Installer: Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (7QSY5527AQ)" + pkgbuild --root dist/alphamap --identifier de.mpg.biochem.alphamap.app --version 0.1.9 --install-location /Applications/AlphaMap.app --scripts scripts alphamap.pkg --sign "Developer ID Installer: Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (7QSY5527AQ)" productbuild --distribution distribution.xml --resources Resources --package-path alphamap.pkg dist/alphamap_gui_installer_macos.pkg --sign "Developer ID Installer: Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (7QSY5527AQ)" requestUUID=$(xcrun altool --notarize-app --primary-bundle-id "de.mpg.biochem.alphamap.app" --username "willems@biochem.mpg.de" --password "@keychain:Alphatims-develop" --asc-provider 7QSY5527AQ --file dist/alphamap_gui_installer_macos.pkg 2>&1 | awk '/RequestUUID/ { print $NF; }') request_status="in progress" @@ -49,6 +49,6 @@ if false; then xcrun altool --notarization-info "$requestUUID" --username "willems@biochem.mpg.de" --password "@keychain:Alphatims-develop" xcrun stapler staple dist/alphamap_gui_installer_macos.pkg else - pkgbuild --root dist/alphamap --identifier de.mpg.biochem.alphamap.app --version 0.1.8 --install-location /Applications/AlphaMap.app --scripts scripts alphamap.pkg + pkgbuild --root dist/alphamap --identifier de.mpg.biochem.alphamap.app --version 0.1.9 --install-location /Applications/AlphaMap.app --scripts scripts alphamap.pkg productbuild --distribution distribution.xml --resources Resources --package-path alphamap.pkg dist/alphamap_gui_installer_macos.pkg fi diff --git a/misc/one_click_macos/distribution.xml b/misc/one_click_macos/distribution.xml index 25d06a7..512d133 100755 --- a/misc/one_click_macos/distribution.xml +++ b/misc/one_click_macos/distribution.xml @@ -1,6 +1,6 @@ - AlphaMap 0.1.8 + AlphaMap 0.1.9 diff --git a/misc/one_click_windows/alphamap_innoinstaller.iss b/misc/one_click_windows/alphamap_innoinstaller.iss index 507b300..034b643 100644 --- a/misc/one_click_windows/alphamap_innoinstaller.iss +++ b/misc/one_click_windows/alphamap_innoinstaller.iss @@ -2,7 +2,7 @@ ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "AlphaMap" -#define MyAppVersion "0.1.8" +#define MyAppVersion "0.1.9" #define MyAppPublisher "Max Planck Institute of Biochemistry, Mann department" #define MyAppURL "https://github.com/MannLabs/alphamap" #define MyAppExeName "alphamap_gui.exe" diff --git a/misc/one_click_windows/create_installer_windows.bat b/misc/one_click_windows/create_installer_windows.bat index 430c381..c9b22d8 100644 --- a/misc/one_click_windows/create_installer_windows.bat +++ b/misc/one_click_windows/create_installer_windows.bat @@ -15,7 +15,7 @@ call rmdir dist /s /q call rmdir build /s /q call python setup.py sdist bdist_wheel call cd misc/one_click_windows -call pip install "../../dist/alphamap-0.1.8-py3-none-any.whl" +call pip install "../../dist/alphamap-0.1.9-py3-none-any.whl" call pip install pyinstaller==4.2 call pyinstaller ../pyinstaller/alphamap.spec -y call conda deactivate diff --git a/misc/one_click_windows/create_installer_windows.sh b/misc/one_click_windows/create_installer_windows.sh index 9811731..5c95ea7 100644 --- a/misc/one_click_windows/create_installer_windows.sh +++ b/misc/one_click_windows/create_installer_windows.sh @@ -7,7 +7,7 @@ rm -rf dist rm -rf build python setup.py sdist bdist_wheel cd misc/one_click_windows -pip install "../../dist/alphamap-0.1.8-py3-none-any.whl" +pip install "../../dist/alphamap-0.1.9-py3-none-any.whl" pip install pyinstaller==4.2 # TODO https://stackoverflow.com/questions/54175042/python-3-7-anaconda-environment-import-ssl-dll-load-fail-error/60405693#60405693 pyinstaller ../pyinstaller/alphamap.spec -y diff --git a/nbs/SequencePlot.ipynb b/nbs/SequencePlot.ipynb index 17efd0b..3b16314 100644 --- a/nbs/SequencePlot.ipynb +++ b/nbs/SequencePlot.ipynb @@ -89,8 +89,8 @@ "name": "stderr", "output_type": "stream", "text": [ - "/var/folders/zx/n29r0swn0hddt1qgy159sjrw0000gn/T/ipykernel_44445/1606015572.py:17: DtypeWarning: Columns (2) have mixed types.Specify dtype option on import or set low_memory=False.\n", - " test_format_uniprot_annotation()\n" + "/var/folders/zx/n29r0swn0hddt1qgy159sjrw0000gn/T/ipykernel_68058/1606015572.py:5: DtypeWarning: Columns (2) have mixed types. Specify dtype option on import or set low_memory=False.\n", + " in_df = pd.read_csv('../alphamap/data/preprocessed_uniprot_human.csv')\n" ] } ], @@ -1114,7 +1114,16 @@ "cell_type": "code", "execution_count": 20, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/var/folders/zx/n29r0swn0hddt1qgy159sjrw0000gn/T/ipykernel_68058/2699298541.py:9: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.\n", + " uniprot_annotation = uniprot_annotation.append(add_mock_annotation)\n" + ] + } + ], "source": [ "#hide\n", "uniprot_annotation = pd.read_csv('../testdata/test_preprocessed_uniprot.csv')\n", @@ -1147,12 +1156,12 @@ "name": "stderr", "output_type": "stream", "text": [ - "100%|██████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 1775.74it/s]\n", - "100%|██████████████████████████████████████████████████████████████████████████████████████| 236/236 [00:00<00:00, 2571.15it/s]\n", - "100%|██████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 2673.23it/s]\n", - "100%|████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:03<00:00, 3.23s/it]\n", - "100%|████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 93.99it/s]\n", - "100%|████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 2.79it/s]\n" + "100%|███████████████████████████████████████████| 1/1 [00:00<00:00, 2449.94it/s]\n", + "100%|███████████████████████████████████████| 172/172 [00:00<00:00, 3106.54it/s]\n", + "100%|███████████████████████████████████████████| 1/1 [00:00<00:00, 9098.27it/s]\n", + "100%|█████████████████████████████████████████████| 1/1 [00:03<00:00, 3.57s/it]\n", + "100%|████████████████████████████████████████████| 1/1 [00:00<00:00, 219.77it/s]\n", + "100%|█████████████████████████████████████████████| 1/1 [00:00<00:00, 4.44it/s]\n" ] }, { @@ -14721,9 +14730,9 @@ } }, "text/html": [ - "