Switch to side-by-side view

--- a
+++ b/notebooks/papermill_test.ipynb
@@ -0,0 +1,255 @@
+{
+ "cells": [
+  {
+   "cell_type": "code",
+   "execution_count": 1,
+   "metadata": {
+    "tags": []
+   },
+   "outputs": [],
+   "source": [
+    "%load_ext autoreload\n",
+    "%autoreload 2\n",
+    "\n",
+    "%matplotlib inline"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 2,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "import os, sys\n",
+    "import subprocess"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 3,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "import pylab as plt\n",
+    "import matplotlib\n",
+    "\n",
+    "import numpy as np\n",
+    "import pandas as pd"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 4,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "import papermill as pm"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 5,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "sys.path.append('..')"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 6,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "from pyMultiOmics.common import create_if_not_exist"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "# Execute notebook"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 7,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "'/Users/joewandy/Work/git/pyMultiOmics/templates/cic_template.ipynb'"
+      ]
+     },
+     "execution_count": 7,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "input_notebook = os.path.abspath(os.path.join('..', 'templates', 'cic_template.ipynb'))\n",
+    "input_notebook"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 8,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "('/Users/joewandy/Work/git/pyMultiOmics/notebooks/temp_results/cic_analysis.ipynb',\n",
+       " '/Users/joewandy/Work/git/pyMultiOmics/notebooks/temp_results/cic_analysis.pdf')"
+      ]
+     },
+     "execution_count": 8,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "output_dir = 'temp_results'\n",
+    "create_if_not_exist(output_dir)\n",
+    "\n",
+    "output_notebook = os.path.abspath(os.path.join(output_dir, 'cic_analysis.ipynb'))\n",
+    "output_pdf = os.path.abspath(os.path.join(output_dir, 'cic_analysis.pdf'))\n",
+    "output_notebook, output_pdf"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 9,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "params = {\n",
+    "    \n",
+    "    # the input file name (excel)\n",
+    "    'file_name': '/Users/joewandy/Library/CloudStorage/OneDrive-UniversityofGlasgow/CiC_Affinity_Biomarkers/data_group_clustering.xlsx',\n",
+    "    \n",
+    "    # parameters for feature normalisation\n",
+    "    'normalise': 'minmax',\n",
+    "    'log': True,\n",
+    "    \n",
+    "    # parameters for case-control analysis\n",
+    "    'case_group': 'disease',\n",
+    "    'control_group': 'control',\n",
+    "    \n",
+    "    # parameters for case-control results\n",
+    "    'p_value_thresh': 0.05,\n",
+    "    'fc_iqr_thresh': 1.5,\n",
+    "    'top_n': 10\n",
+    "    \n",
+    "}"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 10,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "{'file_name': '/Users/joewandy/Library/CloudStorage/OneDrive-UniversityofGlasgow/CiC_Affinity_Biomarkers/data_group_clustering.xlsx',\n",
+       " 'normalise': 'minmax',\n",
+       " 'log': True,\n",
+       " 'case_group': 'disease',\n",
+       " 'control_group': 'control',\n",
+       " 'p_value_thresh': 0.05,\n",
+       " 'fc_iqr_thresh': 1.5,\n",
+       " 'top_n': 10}"
+      ]
+     },
+     "execution_count": 10,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "params"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 11,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "application/vnd.jupyter.widget-view+json": {
+       "model_id": "7fc5f06355244b9b98dc3bf91ea5dafe",
+       "version_major": 2,
+       "version_minor": 0
+      },
+      "text/plain": [
+       "Executing:   0%|          | 0/37 [00:00<?, ?cell/s]"
+      ]
+     },
+     "metadata": {},
+     "output_type": "display_data"
+    }
+   ],
+   "source": [
+    "_ = pm.execute_notebook(input_notebook, output_notebook, report_mode=True, parameters=params)"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 12,
+   "metadata": {},
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "\n",
+      "[NbConvertApp] Converting notebook /Users/joewandy/Work/git/pyMultiOmics/notebooks/temp_results/cic_analysis.ipynb to pdf\n",
+      "[NbConvertApp] Support files will be in /Users/joewandy/Work/git/pyMultiOmics/notebooks/temp_results/cic_analysis_files/\n",
+      "[NbConvertApp] Making directory /Users/joewandy/Work/git/pyMultiOmics/notebooks/temp_results\n",
+      "[NbConvertApp] Making directory /Users/joewandy/Work/git/pyMultiOmics/notebooks/temp_results\n",
+      "[NbConvertApp] Making directory /Users/joewandy/Work/git/pyMultiOmics/notebooks/temp_results\n",
+      "[NbConvertApp] Making directory /Users/joewandy/Work/git/pyMultiOmics/notebooks/temp_results\n",
+      "[NbConvertApp] Writing 26073 bytes to notebook.tex\n",
+      "[NbConvertApp] Building PDF\n",
+      "[NbConvertApp] Running xelatex 3 times: ['xelatex', 'notebook.tex', '-quiet']\n",
+      "[NbConvertApp] Running bibtex 1 time: ['bibtex', 'notebook']\n",
+      "[NbConvertApp] WARNING | bibtex had problems, most likely because there were no citations\n",
+      "[NbConvertApp] PDF successfully created\n",
+      "[NbConvertApp] Writing 887703 bytes to /Users/joewandy/Work/git/pyMultiOmics/notebooks/temp_results/cic_analysis.pdf\n",
+      "\n"
+     ]
+    }
+   ],
+   "source": [
+    "command = ['jupyter', 'nbconvert', '--TemplateExporter.exclude_input=True', '--output', output_pdf, '--to', 'pdf', output_notebook]\n",
+    "result = subprocess.run(command, capture_output=True, text=True)\n",
+    "print(result.stdout)\n",
+    "print(result.stderr)"
+   ]
+  }
+ ],
+ "metadata": {
+  "kernelspec": {
+   "display_name": "Python 3 (ipykernel)",
+   "language": "python",
+   "name": "python3"
+  },
+  "language_info": {
+   "codemirror_mode": {
+    "name": "ipython",
+    "version": 3
+   },
+   "file_extension": ".py",
+   "mimetype": "text/x-python",
+   "name": "python",
+   "nbconvert_exporter": "python",
+   "pygments_lexer": "ipython3",
+   "version": "3.10.1"
+  }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 4
+}