From cc2af6c61bd321c3780515af36810295dc357a3e Mon Sep 17 00:00:00 2001 From: ahernank Date: Mon, 17 Jun 2024 09:52:08 -0500 Subject: [PATCH 1/2] fix code on cloud example --- docs/af1/af1.1.ipynb | 76 ++++++++++++++++++++++++++++---------- docs/af1/af1.2.ipynb | 88 +++++++++++++++++++++++++++++++++++++++++++- docs/af1/af1.3.ipynb | 2 +- docs/af1/cloud.ipynb | 9 +++++ 4 files changed, 152 insertions(+), 23 deletions(-) diff --git a/docs/af1/af1.1.ipynb b/docs/af1/af1.1.ipynb index 3755ab2..67d3428 100644 --- a/docs/af1/af1.1.ipynb +++ b/docs/af1/af1.1.ipynb @@ -119,14 +119,14 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "**Note:** To access the `Af1.1` release, you need to use the `pre=True` flag as shown in the line below. \n", + "**Note:** To access the `Af1.1` release, you need to use the `pre=True` flag. \n", "\n", "This flag is used when more data will be added to this release, for the case of `Af1.1`, CNV data for the sample sets on this release will be included at a future date." ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 1, "metadata": { "id": "AnmzLmEgpk8n", "tags": [ @@ -137,6 +137,7 @@ { "data": { "application/javascript": [ + "'use strict';\n", "(function(root) {\n", " function now() {\n", " return new Date();\n", @@ -298,17 +299,42 @@ " \"\\n\"+\n", " \"\"}};\n", "\n", - " function display_loaded() {\n", + " function display_loaded(error = null) {\n", " const el = document.getElementById(null);\n", " if (el != null) {\n", - " el.textContent = \"BokehJS is loading...\";\n", - " }\n", - " if (root.Bokeh !== undefined) {\n", - " if (el != null) {\n", - " el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n", + " const html = (() => {\n", + " if (typeof root.Bokeh === \"undefined\") {\n", + " if (error == null) {\n", + " return \"BokehJS is loading ...\";\n", + " } else {\n", + " return \"BokehJS failed to load.\";\n", + " }\n", + " } else {\n", + " const prefix = `BokehJS ${root.Bokeh.version}`;\n", + " if (error == null) {\n", + " return `${prefix} successfully loaded.`;\n", + " } else {\n", + " return `${prefix} encountered errors while loading and may not function as expected.`;\n", + " }\n", + " }\n", + " })();\n", + " el.innerHTML = html;\n", + "\n", + " if (error != null) {\n", + " const wrapper = document.createElement(\"div\");\n", + " wrapper.style.overflow = \"auto\";\n", + " wrapper.style.height = \"5em\";\n", + " wrapper.style.resize = \"vertical\";\n", + " const content = document.createElement(\"div\");\n", + " content.style.fontFamily = \"monospace\";\n", + " content.style.whiteSpace = \"pre-wrap\";\n", + " content.style.backgroundColor = \"rgb(255, 221, 221)\";\n", + " content.textContent = error.stack ?? error.toString();\n", + " wrapper.append(content);\n", + " el.append(wrapper);\n", " }\n", " } else if (Date.now() < root._bokeh_timeout) {\n", - " setTimeout(display_loaded, 100)\n", + " setTimeout(() => display_loaded(error), 100);\n", " }\n", " }\n", "\n", @@ -382,7 +408,7 @@ " document.body.appendChild(element);\n", " }\n", "\n", - " const js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-3.3.0.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-3.3.0.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-3.3.0.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-3.3.0.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-mathjax-3.3.0.min.js\"];\n", + " const js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-3.4.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-3.4.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-3.4.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-3.4.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-mathjax-3.4.1.min.js\"];\n", " const css_urls = [];\n", "\n", " const inline_js = [ function(Bokeh) {\n", @@ -394,10 +420,13 @@ "\n", " function run_inline_js() {\n", " if (root.Bokeh !== undefined || force === true) {\n", - " for (let i = 0; i < inline_js.length; i++) {\n", + " try {\n", + " for (let i = 0; i < inline_js.length; i++) {\n", " inline_js[i].call(root, root.Bokeh);\n", " }\n", - "} else if (Date.now() < root._bokeh_timeout) {\n", + "\n", + " } catch (error) {throw error;\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", @@ -419,7 +448,7 @@ " }\n", "}(window));" ], - "application/vnd.bokehjs_load.v0+json": "" + "application/vnd.bokehjs_load.v0+json": "'use strict';\n(function(root) {\n function now() {\n return new Date();\n }\n\n const 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\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 const NB_LOAD_WARNING = {'data': {'text/html':\n \"
\\n\"+\n \"

\\n\"+\n \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n \"

\\n\"+\n \"\\n\"+\n \"\\n\"+\n \"from bokeh.resources import INLINE\\n\"+\n \"output_notebook(resources=INLINE)\\n\"+\n \"\\n\"+\n \"
\"}};\n\n function display_loaded(error = null) {\n const el = document.getElementById(null);\n if (el != null) {\n const html = (() => {\n if (typeof root.Bokeh === \"undefined\") {\n if (error == null) {\n return \"BokehJS is loading ...\";\n } else {\n return \"BokehJS failed to load.\";\n }\n } else {\n const prefix = `BokehJS ${root.Bokeh.version}`;\n if (error == null) {\n return `${prefix} successfully loaded.`;\n } else {\n return `${prefix} encountered errors while loading and may not function as expected.`;\n }\n }\n })();\n el.innerHTML = html;\n\n if (error != null) {\n const wrapper = document.createElement(\"div\");\n wrapper.style.overflow = \"auto\";\n wrapper.style.height = \"5em\";\n wrapper.style.resize = \"vertical\";\n const content = document.createElement(\"div\");\n content.style.fontFamily = \"monospace\";\n content.style.whiteSpace = \"pre-wrap\";\n content.style.backgroundColor = \"rgb(255, 221, 221)\";\n content.textContent = error.stack ?? error.toString();\n wrapper.append(content);\n el.append(wrapper);\n }\n } else if (Date.now() < root._bokeh_timeout) {\n setTimeout(() => display_loaded(error), 100);\n }\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(url) {\n console.error(\"failed to load \" + url);\n }\n\n for (let i = 0; i < css_urls.length; i++) {\n const url = css_urls[i];\n const element = document.createElement(\"link\");\n element.onload = on_load;\n element.onerror = on_error.bind(null, url);\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 for (let i = 0; i < js_urls.length; i++) {\n const url = js_urls[i];\n const element = document.createElement('script');\n element.onload = on_load;\n element.onerror = on_error.bind(null, url);\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 };\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 const js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-3.4.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-3.4.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-3.4.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-3.4.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-mathjax-3.4.1.min.js\"];\n const css_urls = [];\n\n const inline_js = [ function(Bokeh) {\n Bokeh.set_log_level(\"info\");\n },\nfunction(Bokeh) {\n }\n ];\n\n function run_inline_js() {\n if (root.Bokeh !== undefined || force === true) {\n try {\n for (let i = 0; i < inline_js.length; i++) {\n inline_js[i].call(root, root.Bokeh);\n }\n\n } catch (error) {throw error;\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 } else if (force !== true) {\n const cell = $(document.getElementById(null)).parents('.cell').data().cell;\n cell.output_area.append_execute_result(NB_LOAD_WARNING)\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" @@ -432,7 +461,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 2, "metadata": { "colab": { "base_uri": "https://localhost:8080/", @@ -593,7 +622,7 @@ "small-2020-af small-2020-af 50" ] }, - "execution_count": 4, + "execution_count": 2, "metadata": {}, "output_type": "execute_result" } @@ -614,7 +643,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 3, "metadata": { "colab": { "base_uri": "https://localhost:8080/", @@ -627,6 +656,13 @@ ] }, "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " \r" + ] + }, { "data": { "text/html": [ @@ -1175,7 +1211,7 @@ " 2011 0 " ] }, - "execution_count": 5, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -1228,9 +1264,9 @@ "provenance": [] }, "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "global-global-binder-5.0.0", "language": "python", - "name": "python3" + "name": "conda-env-global-global-binder-5.0.0-py" }, "language_info": { "codemirror_mode": { @@ -1242,7 +1278,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.11" + "version": "3.10.14" } }, "nbformat": 4, diff --git a/docs/af1/af1.2.ipynb b/docs/af1/af1.2.ipynb index dcf4443..cf043f8 100644 --- a/docs/af1/af1.2.ipynb +++ b/docs/af1/af1.2.ipynb @@ -108,7 +108,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "**Note:** To access the `Af1.2` release, you need to use the `pre=True` flag as shown in the line below. \n", + "**Note:** To access the `Af1.2` release, you need to use the `pre=True` flag. \n", "\n", "This flag is used when more data will be added to this release, for the case of `Af1.2`, CNV data for the sample sets on this release will be included at a future date." ] @@ -441,11 +441,95 @@ }, "metadata": {}, "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
MalariaGEN Af1 API client
\n", + " Please note that data are subject to terms of use,\n", + " for more information see \n", + " the MalariaGEN website or contact support@malariagen.net.\n", + " See also the Af1 API docs.\n", + "
\n", + " Storage URL\n", + " gs://vo_afun_release_master_us_central1
\n", + " Data releases available\n", + " 1.0
\n", + " Results cache\n", + " None
\n", + " Cohorts analysis\n", + " 20231215
\n", + " Site filters analysis\n", + " dt_20200416
\n", + " Software version\n", + " malariagen_data 10.0.0
\n", + " Client location\n", + " Iowa, United States (Google Cloud us-central1)
\n", + " " + ], + "text/plain": [ + "\n", + "Storage URL : gs://vo_afun_release_master_us_central1\n", + "Data releases available : 1.0\n", + "Results cache : None\n", + "Cohorts analysis : 20231215\n", + "Site filters analysis : dt_20200416\n", + "Software version : malariagen_data 10.0.0\n", + "Client location : Iowa, United States (Google Cloud us-central1)\n", + "---\n", + "Please note that data are subject to terms of use,\n", + "for more information see https://www.malariagen.net/data\n", + "or contact support@malariagen.net. For API documentation see \n", + "https://malariagen.github.io/malariagen-data-python/v10.0.0/Af1.html" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ "import malariagen_data\n", - "af1 = malariagen_data.Af1(pre=True)" + "af1 = malariagen_data.Af1()\n", + "af1" ] }, { diff --git a/docs/af1/af1.3.ipynb b/docs/af1/af1.3.ipynb index 9201dfd..6fa7061 100644 --- a/docs/af1/af1.3.ipynb +++ b/docs/af1/af1.3.ipynb @@ -104,7 +104,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "**Note:** To access the `Af1.3` release, you need to use the `pre=True` flag as shown in the line below. \n", + "**Note:** To access the `Af1.3` release, you need to use the `pre=True` flag. \n", "\n", "This flag is used when more data will be added to this release, for the case of `Af1.3`, CNV data for the sample sets on this release will be included at a future date." ] diff --git a/docs/af1/cloud.ipynb b/docs/af1/cloud.ipynb index 8696b38..dc91bf8 100644 --- a/docs/af1/cloud.ipynb +++ b/docs/af1/cloud.ipynb @@ -516,6 +516,15 @@ "af1" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "**Note:** To access the `Af1.1`, `Af1.2` & `Af1.3` releases, you need to use the `pre=True` flag in code above. \n", + "\n", + "This flag is used when more data will be added to this release. In the case of `Af1.1`, `Af1.2` & `Af1.3`; CNV data for the sample sets on these releases will be included at a future date." + ] + }, { "cell_type": "markdown", "metadata": { From 52b01762eef21eddb649b8958a4d77062158220a Mon Sep 17 00:00:00 2001 From: ahernank Date: Mon, 17 Jun 2024 09:54:07 -0500 Subject: [PATCH 2/2] fix flag --- docs/af1/af1.2.ipynb | 88 +------------------------------------------- 1 file changed, 2 insertions(+), 86 deletions(-) diff --git a/docs/af1/af1.2.ipynb b/docs/af1/af1.2.ipynb index cf043f8..dd48f8c 100644 --- a/docs/af1/af1.2.ipynb +++ b/docs/af1/af1.2.ipynb @@ -115,7 +115,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "metadata": { "id": "AnmzLmEgpk8n", "tags": [ @@ -441,95 +441,11 @@ }, "metadata": {}, "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
MalariaGEN Af1 API client
\n", - " Please note that data are subject to terms of use,\n", - " for more information see \n", - " the MalariaGEN website or contact support@malariagen.net.\n", - " See also the Af1 API docs.\n", - "
\n", - " Storage URL\n", - " gs://vo_afun_release_master_us_central1
\n", - " Data releases available\n", - " 1.0
\n", - " Results cache\n", - " None
\n", - " Cohorts analysis\n", - " 20231215
\n", - " Site filters analysis\n", - " dt_20200416
\n", - " Software version\n", - " malariagen_data 10.0.0
\n", - " Client location\n", - " Iowa, United States (Google Cloud us-central1)
\n", - " " - ], - "text/plain": [ - "\n", - "Storage URL : gs://vo_afun_release_master_us_central1\n", - "Data releases available : 1.0\n", - "Results cache : None\n", - "Cohorts analysis : 20231215\n", - "Site filters analysis : dt_20200416\n", - "Software version : malariagen_data 10.0.0\n", - "Client location : Iowa, United States (Google Cloud us-central1)\n", - "---\n", - "Please note that data are subject to terms of use,\n", - "for more information see https://www.malariagen.net/data\n", - "or contact support@malariagen.net. For API documentation see \n", - "https://malariagen.github.io/malariagen-data-python/v10.0.0/Af1.html" - ] - }, - "execution_count": 1, - "metadata": {}, - "output_type": "execute_result" } ], "source": [ "import malariagen_data\n", - "af1 = malariagen_data.Af1()\n", - "af1" + "af1 = malariagen_data.Af1(pre=True)" ] }, {