From 060a5c9ab95f6544b73c2a24c1896d6b1f8e4e56 Mon Sep 17 00:00:00 2001 From: a-slide Date: Mon, 13 Jul 2020 12:28:33 +0200 Subject: [PATCH 01/11] Dropped Orca for Kaleido --- docs/installation.md | 18 +++++----------- meta.yaml | 6 +++--- pycoMeth/Comp_Report.py | 41 +++++++++++++++++++++++------------ pycoMeth/common.py | 47 +++++++++++++++++++++++++++++------------ setup.py | 3 ++- 5 files changed, 70 insertions(+), 45 deletions(-) diff --git a/docs/installation.md b/docs/installation.md index 733c14f..2514cbc 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -2,7 +2,7 @@ ## Create a clean virtual environment (optional but recommended) -Ideally, before installation, create a clean **python3.6+** virtual environment to deploy the package. +Ideally, before installation, create a clean **python3.7+** virtual environment to deploy the package. Earlier version of Python3 should also work but **Python 2 is not supported**. For example one can use conda or virtualenvwrapper. @@ -37,16 +37,9 @@ You might also want to install [Nanopolish](https://github.com/jts/nanopolish) i * `pyfaidx>=0.5.8` * `tqdm>=4.45.0` * `colorlog>=4.1.0` +* `kaleido` *New library being developed by the plotly team for static image export* -The correct versions of packages are installed together with the software when using pip - -in addition if you want to enable static images export you will also need the following dependencies: - -* `plotly-orca==1.2.1` -* `psutil>=5.7.0` -* `requests>=2.24.0` - -Those dependencies will only be installed with conda as `orca` is not a python package. +The correct versions of packages are installed together with the software when using pip or conda ## Option 1: Installation with pip from pypi @@ -64,17 +57,16 @@ pip install --index-url https://test.pypi.org/simple/ pycoMeth -U ## Option 2: Installation with conda from Anaconda cloud -This option will also install `orca` which is required for static images export ```bash # First installation -conda install -c aleg -c plotly pycometh +conda install -c aleg pycometh ``` You can also get the **unstable** development version from the dev channel ```bash -conda update -c aleg_dev -c plotly pycometh +conda update -c aleg_dev pycometh ``` ## Option 3: Installation with pip from Github diff --git a/meta.yaml b/meta.yaml index 7c8ac38..2e117f9 100644 --- a/meta.yaml +++ b/meta.yaml @@ -31,9 +31,9 @@ requirements: - tqdm>=4.45.0 - colorlog>=4.1.0 - nbformat>=4.2.0 - - plotly-orca=1.3.1 - - psutil>=5.7.0 - - requests>=2.24.0 + - pip>=19.2.1 + - pip : + - kaleido test: imports: diff --git a/pycoMeth/Comp_Report.py b/pycoMeth/Comp_Report.py index 9553b82..619e33a 100644 --- a/pycoMeth/Comp_Report.py +++ b/pycoMeth/Comp_Report.py @@ -144,6 +144,7 @@ def Comp_Report ( mkdir (os.path.join(outdir, reports_outdir), exist_ok=True) mkdir (os.path.join(outdir, tables_outdir), exist_ok=True) if export_static_plots: + kaleido = Kaleido() plot_outdir = "static_plots" mkdir (os.path.join(outdir, plot_outdir), exist_ok=True) @@ -207,13 +208,16 @@ def Comp_Report ( table_out_path = os.path.join(outdir, tables_outdir, top_dict[idx]["bn"]+".tsv") transcript_df.to_csv(table_out_path, sep="\t", index=False) - # Try to export static plots if orca is installed + # Try to export static plots if required if export_static_plots: - try: - heatmap_fig.write_image(os.path.join(outdir, plot_outdir, top_dict[idx]["bn"]+"_heatmap.svg"), width=1400) - ridgeplot_fig.write_image(os.path.join(outdir, plot_outdir, top_dict[idx]["bn"]+"_ridgeplot.svg"), width=1400) - except Exception: - pass + kaleido.export_plotly_svg ( + fig = heatmap_fig, + fn = os.path.join(outdir, plot_outdir, top_dict[idx]["bn"]+"_heatmap.svg"), + width = 1400) + kaleido.export_plotly_svg ( + fig = ridgeplot_fig, + fn = os.path.join(outdir, plot_outdir, top_dict[idx]["bn"]+"_ridgeplot.svg"), + width = 1400) # Convert to DataFrame all_cpg_df = pd.DataFrame.from_dict(all_cpg_d) @@ -256,15 +260,24 @@ def Comp_Report ( top_df = top_df.drop(columns=["detailled report"]) top_df.to_csv(table_out_path, sep="\t", index=False) - # Try to export static plots if orca is installed + # Try to export static plots if required if export_static_plots: - try: - all_heatmap_fig.write_image(os.path.join(outdir, plot_outdir, "all_heatmap.svg"), width=1400) - all_ridgeplot_fig.write_image(os.path.join(outdir, plot_outdir, "all_ridgeplot.svg"), width=1400) - catplot_fig.write_image(os.path.join(outdir, plot_outdir, "all_catplot.svg"), width=1400) - ideogram_fig.write_image(os.path.join(outdir, plot_outdir, "all_ideogram.svg"), width=1400) - except Exception: - pass + kaleido.export_plotly_svg ( + fig=all_heatmap_fig, + fn=os.path.join(outdir, plot_outdir, "all_heatmap.svg"), + width=1400) + kaleido.export_plotly_svg ( + fig=all_ridgeplot_fig, + fn=os.path.join(outdir, plot_outdir, "all_ridgeplot.svg"), + width=1400) + kaleido.export_plotly_svg ( + fig=catplot_fig, + fn=os.path.join(outdir, plot_outdir, "all_catplot.svg"), + width=1400) + kaleido.export_plotly_svg ( + fig=ideogram_fig, + fn=os.path.join(outdir, plot_outdir, "all_ideogram.svg"), + width=1400) #~~~~~~~~~~~~~~~~~~~~~~~~HTML generating functions~~~~~~~~~~~~~~~~~~~~~~~~# diff --git a/pycoMeth/common.py b/pycoMeth/common.py index 881608e..b3e168d 100644 --- a/pycoMeth/common.py +++ b/pycoMeth/common.py @@ -19,6 +19,16 @@ # Third party imports import colorlog +# Optional static export deps +try: + from kaleido.scopes.plotly import PlotlyScope + from IPython.core.display import SVG, display + STATIC_EXPORT=True +except (ModuleNotFoundError, ImportError) as E: + print("Cannot import dependencies required for static image export") + STATIC_EXPORT=False + pass + #~~~~~~~~~~~~~~FUNCTIONS~~~~~~~~~~~~~~# def opt_summary (local_opt): """Simplifiy option dict creation""" @@ -367,21 +377,30 @@ def log_list (l, logger, header="", indent="\t"): for i in l: logger("{}*{}".format(indent, i)) -def static_display (fig, width=None, height=None): - """ - Function to render a plotly figure in SVG inside jupyter - Requires jupyter and Orca to be installed - """ - # if not orca_running(): - # raise ImportError ("plotly-orca is required for static image export") - - # function specific imports - from tempfile import NamedTemporaryFile - from IPython.core.display import display, SVG - with NamedTemporaryFile(suffix=".svg") as temp_svg: - fig.write_image(temp_svg.name, width=width, height=height) - display(SVG(temp_svg.name)) +class Kaleido: + def __init__ (self): + # Init scopes + if not STATIC_EXPORT: + raise ImportError ("Static export is not possible due to missing dependencies") + self.plotly_scope = PlotlyScope() + + def render_plotly_svg (self, fig, width=None, height=None): + """ + Function to render a plotly figure in SVG inside jupyter + """ + if STATIC_EXPORT: + svg_fig = self.plotly_scope.transform(fig, format="svg", width=width, height=height) + return SVG(svg_fig) + + def export_plotly_svg (self, fig, fn, width=None, height=None): + """ + Function to export a plotly figure to SVG + """ + if STATIC_EXPORT: + svg_fig = self.plotly_scope.transform(fig, format="svg", width=width, height=height) + with open (fn, mode="wb") as fp: + fp.write(svg_fig) #~~~~~~~~~~~~~~CUSTOM EXCEPTION AND WARN CLASSES~~~~~~~~~~~~~~# class pycoMethError (Exception): diff --git a/setup.py b/setup.py index a8bbf07..d17de79 100755 --- a/setup.py +++ b/setup.py @@ -38,7 +38,8 @@ "pyfaidx>=0.5.8", "tqdm>=4.45.0", "colorlog>=4.1.0", - "nbformat>=4.2.0"], + "nbformat>=4.2.0", + "kaleido"], packages = [name], package_dir = {name: name}, package_data = {name: ['templates/*']}, From cf40b0b3fda95e008c162ff77beaa19e6284ebe1 Mon Sep 17 00:00:00 2001 From: a-slide Date: Mon, 13 Jul 2020 12:33:27 +0200 Subject: [PATCH 02/11] Update notebooks and output files --- docs/Comp_Report/API_usage.ipynb | 663 ++++-------------- docs/Comp_Report/CLI_usage.ipynb | 25 +- ...interval_0001_chr15-13014693-13015794.html | 14 +- ...interval_0002_chr16-26220047-26221325.html | 14 +- .../interval_0003_chr17-316390-318610.html | 14 +- ...interval_0004_chr11-27686928-27688355.html | 14 +- .../interval_0005_chr4-7874048-7875618.html | 14 +- .../interval_0006_chr15-1565040-1565987.html | 14 +- .../interval_0007_chr2-23361417-23362425.html | 14 +- .../interval_0008_chr2-12169442-12171060.html | 14 +- .../interval_0009_chr8-450569-451548.html | 14 +- .../interval_0010_chr8-23224550-23225428.html | 14 +- .../interval_0011_chr2-3660038-3660922.html | 14 +- .../interval_0012_chr22-1816785-1817685.html | 14 +- .../interval_0013_chr16-7720134-7721846.html | 14 +- .../interval_0014_chr5-19638728-19639909.html | 14 +- ...interval_0015_chr14-24222331-24223586.html | 14 +- ...interval_0016_chr20-15042642-15043458.html | 14 +- .../interval_0017_chr3-309650-310584.html | 14 +- .../interval_0018_chr19-1948176-1949405.html | 14 +- ...interval_0019_chr14-29614617-29615705.html | 14 +- .../interval_0020_chr22-2405753-2407192.html | 14 +- .../interval_0021_chr16-7663486-7664331.html | 14 +- .../interval_0022_chr9-1939074-1940052.html | 14 +- .../interval_0023_chr17-48535-49910.html | 14 +- .../interval_0024_chr2-22706556-22707650.html | 14 +- .../interval_0025_chr2-23324373-23325538.html | 14 +- .../interval_0026_chr12-2187537-2190115.html | 14 +- .../interval_0027_chr5-30060867-30062266.html | 14 +- .../interval_0028_chr6-1003683-1004493.html | 14 +- .../interval_0029_chr3-7956996-7957867.html | 14 +- ...interval_0030_chr14-29286331-29287419.html | 14 +- .../interval_0031_chr7-26640756-26641574.html | 14 +- .../interval_0032_chr6-4948049-4949056.html | 14 +- .../interval_0033_chr9-1940281-1941248.html | 14 +- ...interval_0034_chr14-19955750-19956691.html | 14 +- .../interval_0035_chr6-2209392-2211073.html | 14 +- .../interval_0036_chr1-1608911-1609767.html | 14 +- ...interval_0037_chr11-14611139-14611909.html | 14 +- ...interval_0038_chr18-19963184-19964018.html | 14 +- ...interval_0039_chr24-10286328-10287069.html | 14 +- .../interval_0040_chr1-28861433-28862812.html | 14 +- .../interval_0041_chr1-28858118-28859215.html | 14 +- .../interval_0042_chr3-16474087-16474976.html | 14 +- .../interval_0043_chr23-3850204-3850968.html | 14 +- ...interval_0044_chr15-29821056-29822141.html | 14 +- .../interval_0045_chr13-383208-383975.html | 14 +- .../interval_0046_chr8-21261846-21262796.html | 14 +- .../interval_0047_chr10-1395471-1396245.html | 14 +- ...interval_0048_chr23-22979232-22979976.html | 14 +- ...interval_0049_chr16-27924435-27925464.html | 14 +- ...interval_0050_chr21-28550521-28551558.html | 14 +- .../medaka_html/pycoMeth_summary_report.html | 26 +- .../medaka_html/static_plots/all_catplot.svg | 2 +- .../medaka_html/static_plots/all_heatmap.svg | 2 +- .../medaka_html/static_plots/all_ideogram.svg | 2 +- .../static_plots/all_ridgeplot.svg | 2 +- ...l_0001_chr15-13014693-13015794_heatmap.svg | 2 +- ...0001_chr15-13014693-13015794_ridgeplot.svg | 2 +- ...l_0002_chr16-26220047-26221325_heatmap.svg | 2 +- ...0002_chr16-26220047-26221325_ridgeplot.svg | 2 +- ...erval_0003_chr17-316390-318610_heatmap.svg | 2 +- ...val_0003_chr17-316390-318610_ridgeplot.svg | 2 +- ...l_0004_chr11-27686928-27688355_heatmap.svg | 2 +- ...0004_chr11-27686928-27688355_ridgeplot.svg | 2 +- ...rval_0005_chr4-7874048-7875618_heatmap.svg | 2 +- ...al_0005_chr4-7874048-7875618_ridgeplot.svg | 2 +- ...val_0006_chr15-1565040-1565987_heatmap.svg | 2 +- ...l_0006_chr15-1565040-1565987_ridgeplot.svg | 2 +- ...al_0007_chr2-23361417-23362425_heatmap.svg | 2 +- ..._0007_chr2-23361417-23362425_ridgeplot.svg | 2 +- ...al_0008_chr2-12169442-12171060_heatmap.svg | 2 +- ..._0008_chr2-12169442-12171060_ridgeplot.svg | 2 +- ...terval_0009_chr8-450569-451548_heatmap.svg | 2 +- ...rval_0009_chr8-450569-451548_ridgeplot.svg | 2 +- ...al_0010_chr8-23224550-23225428_heatmap.svg | 2 +- ..._0010_chr8-23224550-23225428_ridgeplot.svg | 2 +- ...rval_0011_chr2-3660038-3660922_heatmap.svg | 2 +- ...al_0011_chr2-3660038-3660922_ridgeplot.svg | 2 +- ...val_0012_chr22-1816785-1817685_heatmap.svg | 2 +- ...l_0012_chr22-1816785-1817685_ridgeplot.svg | 2 +- ...val_0013_chr16-7720134-7721846_heatmap.svg | 2 +- ...l_0013_chr16-7720134-7721846_ridgeplot.svg | 2 +- ...al_0014_chr5-19638728-19639909_heatmap.svg | 2 +- ..._0014_chr5-19638728-19639909_ridgeplot.svg | 2 +- ...l_0015_chr14-24222331-24223586_heatmap.svg | 2 +- ...0015_chr14-24222331-24223586_ridgeplot.svg | 2 +- ...l_0016_chr20-15042642-15043458_heatmap.svg | 2 +- ...0016_chr20-15042642-15043458_ridgeplot.svg | 2 +- ...terval_0017_chr3-309650-310584_heatmap.svg | 2 +- ...rval_0017_chr3-309650-310584_ridgeplot.svg | 2 +- ...val_0018_chr19-1948176-1949405_heatmap.svg | 2 +- ...l_0018_chr19-1948176-1949405_ridgeplot.svg | 2 +- ...l_0019_chr14-29614617-29615705_heatmap.svg | 2 +- ...0019_chr14-29614617-29615705_ridgeplot.svg | 2 +- ...val_0020_chr22-2405753-2407192_heatmap.svg | 2 +- ...l_0020_chr22-2405753-2407192_ridgeplot.svg | 2 +- ...val_0021_chr16-7663486-7664331_heatmap.svg | 2 +- ...l_0021_chr16-7663486-7664331_ridgeplot.svg | 2 +- ...rval_0022_chr9-1939074-1940052_heatmap.svg | 2 +- ...al_0022_chr9-1939074-1940052_ridgeplot.svg | 2 +- ...nterval_0023_chr17-48535-49910_heatmap.svg | 2 +- ...erval_0023_chr17-48535-49910_ridgeplot.svg | 2 +- ...al_0024_chr2-22706556-22707650_heatmap.svg | 2 +- ..._0024_chr2-22706556-22707650_ridgeplot.svg | 2 +- ...al_0025_chr2-23324373-23325538_heatmap.svg | 2 +- ..._0025_chr2-23324373-23325538_ridgeplot.svg | 2 +- ...val_0026_chr12-2187537-2190115_heatmap.svg | 2 +- ...l_0026_chr12-2187537-2190115_ridgeplot.svg | 2 +- ...al_0027_chr5-30060867-30062266_heatmap.svg | 2 +- ..._0027_chr5-30060867-30062266_ridgeplot.svg | 2 +- ...rval_0028_chr6-1003683-1004493_heatmap.svg | 2 +- ...al_0028_chr6-1003683-1004493_ridgeplot.svg | 2 +- ...rval_0029_chr3-7956996-7957867_heatmap.svg | 2 +- ...al_0029_chr3-7956996-7957867_ridgeplot.svg | 2 +- ...l_0030_chr14-29286331-29287419_heatmap.svg | 2 +- ...0030_chr14-29286331-29287419_ridgeplot.svg | 2 +- ...al_0031_chr7-26640756-26641574_heatmap.svg | 2 +- ..._0031_chr7-26640756-26641574_ridgeplot.svg | 2 +- ...rval_0032_chr6-4948049-4949056_heatmap.svg | 2 +- ...al_0032_chr6-4948049-4949056_ridgeplot.svg | 2 +- ...rval_0033_chr9-1940281-1941248_heatmap.svg | 2 +- ...al_0033_chr9-1940281-1941248_ridgeplot.svg | 2 +- ...l_0034_chr14-19955750-19956691_heatmap.svg | 2 +- ...0034_chr14-19955750-19956691_ridgeplot.svg | 2 +- ...rval_0035_chr6-2209392-2211073_heatmap.svg | 2 +- ...al_0035_chr6-2209392-2211073_ridgeplot.svg | 2 +- ...rval_0036_chr1-1608911-1609767_heatmap.svg | 2 +- ...al_0036_chr1-1608911-1609767_ridgeplot.svg | 2 +- ...l_0037_chr11-14611139-14611909_heatmap.svg | 2 +- ...0037_chr11-14611139-14611909_ridgeplot.svg | 2 +- ...l_0038_chr18-19963184-19964018_heatmap.svg | 2 +- ...0038_chr18-19963184-19964018_ridgeplot.svg | 2 +- ...l_0039_chr24-10286328-10287069_heatmap.svg | 2 +- ...0039_chr24-10286328-10287069_ridgeplot.svg | 2 +- ...al_0040_chr1-28861433-28862812_heatmap.svg | 2 +- ..._0040_chr1-28861433-28862812_ridgeplot.svg | 2 +- ...al_0041_chr1-28858118-28859215_heatmap.svg | 2 +- ..._0041_chr1-28858118-28859215_ridgeplot.svg | 2 +- ...al_0042_chr3-16474087-16474976_heatmap.svg | 2 +- ..._0042_chr3-16474087-16474976_ridgeplot.svg | 2 +- ...val_0043_chr23-3850204-3850968_heatmap.svg | 2 +- ...l_0043_chr23-3850204-3850968_ridgeplot.svg | 2 +- ...l_0044_chr15-29821056-29822141_heatmap.svg | 2 +- ...0044_chr15-29821056-29822141_ridgeplot.svg | 2 +- ...erval_0045_chr13-383208-383975_heatmap.svg | 2 +- ...val_0045_chr13-383208-383975_ridgeplot.svg | 2 +- ...al_0046_chr8-21261846-21262796_heatmap.svg | 2 +- ..._0046_chr8-21261846-21262796_ridgeplot.svg | 2 +- ...val_0047_chr10-1395471-1396245_heatmap.svg | 2 +- ...l_0047_chr10-1395471-1396245_ridgeplot.svg | 2 +- ...l_0048_chr23-22979232-22979976_heatmap.svg | 2 +- ...0048_chr23-22979232-22979976_ridgeplot.svg | 2 +- ...l_0049_chr16-27924435-27925464_heatmap.svg | 2 +- ...0049_chr16-27924435-27925464_ridgeplot.svg | 2 +- ...l_0050_chr21-28550521-28551558_heatmap.svg | 2 +- ...0050_chr21-28550521-28551558_ridgeplot.svg | 2 +- .../interval_0001_chrV-65380-65612.html | 14 +- .../yeast_html/pycoMeth_summary_report.html | 8 +- 159 files changed, 637 insertions(+), 1007 deletions(-) diff --git a/docs/Comp_Report/API_usage.ipynb b/docs/Comp_Report/API_usage.ipynb index b385dea..1ced1ab 100644 --- a/docs/Comp_Report/API_usage.ipynb +++ b/docs/Comp_Report/API_usage.ipynb @@ -21,11 +21,11 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 5, "metadata": { "ExecuteTime": { - "end_time": "2020-07-09T13:20:33.210319Z", - "start_time": "2020-07-09T13:20:32.381152Z" + "end_time": "2020-07-13T10:16:23.940885Z", + "start_time": "2020-07-13T10:16:23.916102Z" }, "init_cell": true, "scrolled": true @@ -36,7 +36,7 @@ "from pycoMeth.Comp_Report import Comp_Report, cpg_heatmap, cpg_ridgeplot, category_barplot, chr_ideogram_plot\n", "\n", "# optionally inport jupyter helper functions\n", - "from pycoMeth.common import head, jhelp, static_display" + "from pycoMeth.common import head, jhelp, Kaleido" ] }, { @@ -48,11 +48,11 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 6, "metadata": { "ExecuteTime": { - "end_time": "2020-07-09T13:20:33.229716Z", - "start_time": "2020-07-09T13:20:33.212714Z" + "end_time": "2020-07-13T10:16:25.619594Z", + "start_time": "2020-07-13T10:16:25.601327Z" }, "init_cell": true, "scrolled": true @@ -157,11 +157,11 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 7, "metadata": { "ExecuteTime": { - "end_time": "2020-07-09T13:20:58.172814Z", - "start_time": "2020-07-09T13:20:54.000118Z" + "end_time": "2020-07-13T10:16:33.558070Z", + "start_time": "2020-07-13T10:16:29.849863Z" }, "scrolled": false }, @@ -179,7 +179,7 @@ "\u001b[32m\tFinding top candidates\u001b[0m\n", "\u001b[01;34m## Parsing methcomp data ##\u001b[0m\n", "\u001b[32m\tIterating over significant intervals\u001b[0m\n", - "\tProgress: 100%|██████████| 3.53k/3.53k [00:00<00:00, 3.67k intervals/s]\n" + "\tProgress: 100%|██████████| 3.53k/3.53k [00:00<00:00, 3.87k intervals/s]\n" ] }, { @@ -347,177 +347,9 @@ " 0.615\n", " 2.260\n", " \n", - " \n", - " Sample 4-1_B2\n", - " -2.920\n", - " 1.735\n", - " 0.505\n", - " 1.078\n", - " -2.240\n", - " 2.370\n", - " -1.055\n", - " -0.088\n", - " 0.810\n", - " -2.108\n", - " ...\n", - " 0.390\n", - " -0.050\n", - " 4.110\n", - " -0.360\n", - " 2.570\n", - " 1.990\n", - " 1.950\n", - " 0.720\n", - " 1.420\n", - " 1.705\n", - " \n", - " \n", - " Sample 4-2_B2\n", - " -0.405\n", - " 1.490\n", - " 3.020\n", - " 1.652\n", - " -0.575\n", - " 2.082\n", - " -0.225\n", - " -0.100\n", - " 1.480\n", - " -1.370\n", - " ...\n", - " -1.270\n", - " -1.770\n", - " 3.710\n", - " 1.100\n", - " 2.810\n", - " -0.085\n", - " -0.280\n", - " 0.310\n", - " -0.875\n", - " 1.225\n", - " \n", - " \n", - " Sample 69-1_F3\n", - " -2.050\n", - " 2.613\n", - " -3.270\n", - " -1.743\n", - " -0.040\n", - " 1.418\n", - " -2.395\n", - " -3.150\n", - " -2.500\n", - " -1.290\n", - " ...\n", - " 0.350\n", - " -1.550\n", - " 3.102\n", - " 0.980\n", - " 2.740\n", - " -2.300\n", - " -1.150\n", - " 1.420\n", - " 2.455\n", - " 2.155\n", - " \n", - " \n", - " Sample 7-1_E2\n", - " -3.812\n", - " 2.872\n", - " -3.490\n", - " 0.940\n", - " 0.913\n", - " 2.600\n", - " 2.105\n", - " 2.132\n", - " 4.380\n", - " -0.118\n", - " ...\n", - " -1.795\n", - " -0.140\n", - " 3.608\n", - " -1.430\n", - " 2.730\n", - " 3.865\n", - " 2.110\n", - " 0.525\n", - " 1.700\n", - " -0.855\n", - " \n", - " \n", - " Sample 7-2_F2\n", - " -2.412\n", - " 1.152\n", - " 2.880\n", - " 0.645\n", - " -0.555\n", - " -3.302\n", - " -3.225\n", - " NaN\n", - " -0.220\n", - " -0.510\n", - " ...\n", - " 0.295\n", - " 0.190\n", - " 3.552\n", - " 0.300\n", - " NaN\n", - " 2.640\n", - " 2.190\n", - " -1.225\n", - " 0.778\n", - " -1.340\n", - " \n", - " \n", - " Sample 79-2_G3\n", - " -3.435\n", - " 1.375\n", - " 2.965\n", - " 1.070\n", - " -1.578\n", - " 1.238\n", - " -3.360\n", - " 2.562\n", - " -2.850\n", - " -1.730\n", - " ...\n", - " 1.140\n", - " -2.940\n", - " 2.615\n", - " -0.055\n", - " 3.070\n", - " -4.185\n", - " 1.455\n", - " 2.505\n", - " 1.850\n", - " -1.545\n", - " \n", - " \n", - " Sample 80-1_H3\n", - " -3.522\n", - " NaN\n", - " 2.915\n", - " 1.640\n", - " -2.440\n", - " 1.217\n", - " -2.078\n", - " 1.090\n", - " 1.640\n", - " -1.148\n", - " ...\n", - " 0.600\n", - " 3.550\n", - " -2.232\n", - " 0.270\n", - " 2.545\n", - " -3.205\n", - " NaN\n", - " 1.350\n", - " 2.295\n", - " NaN\n", - " \n", " \n", "\n", - "

12 rows × 3532 columns

\n", + "

5 rows × 3532 columns

\n", "" ], "text/plain": [ @@ -527,13 +359,6 @@ "Sample 131-1_F4 0.570 1.522 1.200 \n", "Sample 134-1_H4 -1.152 -1.142 1.265 \n", "Sample 134-2_A5 2.145 -5.395 3.050 \n", - "Sample 4-1_B2 -2.920 1.735 0.505 \n", - "Sample 4-2_B2 -0.405 1.490 3.020 \n", - "Sample 69-1_F3 -2.050 2.613 -3.270 \n", - "Sample 7-1_E2 -3.812 2.872 -3.490 \n", - "Sample 7-2_F2 -2.412 1.152 2.880 \n", - "Sample 79-2_G3 -3.435 1.375 2.965 \n", - "Sample 80-1_H3 -3.522 NaN 2.915 \n", "\n", " 1-570414-576486 1-623809-625652 1-727090-729031 \\\n", "Sample 11-1_A3 NaN -0.968 1.255 \n", @@ -541,13 +366,6 @@ "Sample 131-1_F4 1.628 0.095 1.995 \n", "Sample 134-1_H4 1.518 -1.925 1.760 \n", "Sample 134-2_A5 1.638 3.125 1.705 \n", - "Sample 4-1_B2 1.078 -2.240 2.370 \n", - "Sample 4-2_B2 1.652 -0.575 2.082 \n", - "Sample 69-1_F3 -1.743 -0.040 1.418 \n", - "Sample 7-1_E2 0.940 0.913 2.600 \n", - "Sample 7-2_F2 0.645 -0.555 -3.302 \n", - "Sample 79-2_G3 1.070 -1.578 1.238 \n", - "Sample 80-1_H3 1.640 -2.440 1.217 \n", "\n", " 1-729239-730182 1-1077484-1077924 1-1162762-1163132 \\\n", "Sample 11-1_A3 -2.085 4.352 2.855 \n", @@ -555,13 +373,6 @@ "Sample 131-1_F4 -1.792 3.035 0.340 \n", "Sample 134-1_H4 NaN 0.872 0.590 \n", "Sample 134-2_A5 -3.133 -3.960 -2.475 \n", - "Sample 4-1_B2 -1.055 -0.088 0.810 \n", - "Sample 4-2_B2 -0.225 -0.100 1.480 \n", - "Sample 69-1_F3 -2.395 -3.150 -2.500 \n", - "Sample 7-1_E2 2.105 2.132 4.380 \n", - "Sample 7-2_F2 -3.225 NaN -0.220 \n", - "Sample 79-2_G3 -3.360 2.562 -2.850 \n", - "Sample 80-1_H3 -2.078 1.090 1.640 \n", "\n", " 1-1314335-1314688 ... 24-21407316-21407672 \\\n", "Sample 11-1_A3 -2.058 ... 0.090 \n", @@ -569,13 +380,6 @@ "Sample 131-1_F4 1.985 ... 0.550 \n", "Sample 134-1_H4 -3.310 ... 2.705 \n", "Sample 134-2_A5 1.635 ... -0.205 \n", - "Sample 4-1_B2 -2.108 ... 0.390 \n", - "Sample 4-2_B2 -1.370 ... -1.270 \n", - "Sample 69-1_F3 -1.290 ... 0.350 \n", - "Sample 7-1_E2 -0.118 ... -1.795 \n", - "Sample 7-2_F2 -0.510 ... 0.295 \n", - "Sample 79-2_G3 -1.730 ... 1.140 \n", - "Sample 80-1_H3 -1.148 ... 0.600 \n", "\n", " 24-22058632-22059037 24-22331849-22332483 \\\n", "Sample 11-1_A3 -0.195 3.020 \n", @@ -583,13 +387,6 @@ "Sample 131-1_F4 -1.185 3.108 \n", "Sample 134-1_H4 -1.322 3.278 \n", "Sample 134-2_A5 -0.692 3.980 \n", - "Sample 4-1_B2 -0.050 4.110 \n", - "Sample 4-2_B2 -1.770 3.710 \n", - "Sample 69-1_F3 -1.550 3.102 \n", - "Sample 7-1_E2 -0.140 3.608 \n", - "Sample 7-2_F2 0.190 3.552 \n", - "Sample 79-2_G3 -2.940 2.615 \n", - "Sample 80-1_H3 3.550 -2.232 \n", "\n", " 24-22382403-22382773 24-22452449-22452848 \\\n", "Sample 11-1_A3 -0.055 2.935 \n", @@ -597,13 +394,6 @@ "Sample 131-1_F4 1.440 2.270 \n", "Sample 134-1_H4 0.730 3.915 \n", "Sample 134-2_A5 0.150 3.400 \n", - "Sample 4-1_B2 -0.360 2.570 \n", - "Sample 4-2_B2 1.100 2.810 \n", - "Sample 69-1_F3 0.980 2.740 \n", - "Sample 7-1_E2 -1.430 2.730 \n", - "Sample 7-2_F2 0.300 NaN \n", - "Sample 79-2_G3 -0.055 3.070 \n", - "Sample 80-1_H3 0.270 2.545 \n", "\n", " 24-22584245-22584601 24-22760710-22761123 \\\n", "Sample 11-1_A3 -0.058 0.220 \n", @@ -611,13 +401,6 @@ "Sample 131-1_F4 NaN 0.900 \n", "Sample 134-1_H4 2.805 1.205 \n", "Sample 134-2_A5 -2.365 1.625 \n", - "Sample 4-1_B2 1.990 1.950 \n", - "Sample 4-2_B2 -0.085 -0.280 \n", - "Sample 69-1_F3 -2.300 -1.150 \n", - "Sample 7-1_E2 3.865 2.110 \n", - "Sample 7-2_F2 2.640 2.190 \n", - "Sample 79-2_G3 -4.185 1.455 \n", - "Sample 80-1_H3 -3.205 NaN \n", "\n", " 24-22892617-22893113 24-23134697-23135071 \\\n", "Sample 11-1_A3 1.760 -1.502 \n", @@ -625,13 +408,6 @@ "Sample 131-1_F4 NaN 0.965 \n", "Sample 134-1_H4 1.030 1.545 \n", "Sample 134-2_A5 1.785 0.615 \n", - "Sample 4-1_B2 0.720 1.420 \n", - "Sample 4-2_B2 0.310 -0.875 \n", - "Sample 69-1_F3 1.420 2.455 \n", - "Sample 7-1_E2 0.525 1.700 \n", - "Sample 7-2_F2 -1.225 0.778 \n", - "Sample 79-2_G3 2.505 1.850 \n", - "Sample 80-1_H3 1.350 2.295 \n", "\n", " 24-23191101-23191433 \n", "Sample 11-1_A3 1.797 \n", @@ -639,15 +415,8 @@ "Sample 131-1_F4 2.100 \n", "Sample 134-1_H4 2.418 \n", "Sample 134-2_A5 2.260 \n", - "Sample 4-1_B2 1.705 \n", - "Sample 4-2_B2 1.225 \n", - "Sample 69-1_F3 2.155 \n", - "Sample 7-1_E2 -0.855 \n", - "Sample 7-2_F2 -1.340 \n", - "Sample 79-2_G3 -1.545 \n", - "Sample 80-1_H3 NaN \n", "\n", - "[12 rows x 3532 columns]" + "[5 rows x 3532 columns]" ] }, "metadata": {}, @@ -702,7 +471,7 @@ " Sample 11-1_A3\n", " -1.510\n", " -2.730\n", - " -5.460\n", + " -5.46\n", " -0.320\n", " -3.330\n", " -7.600\n", @@ -720,13 +489,13 @@ " -2.330\n", " -3.350\n", " -1.90\n", - " -2.180\n", + " -2.18\n", " \n", " \n", " Sample 117-2_C4\n", " -1.775\n", " -1.010\n", - " -3.160\n", + " -3.16\n", " 0.030\n", " 1.120\n", " 4.520\n", @@ -744,13 +513,13 @@ " -0.290\n", " -0.830\n", " -0.13\n", - " 0.600\n", + " 0.60\n", " \n", " \n", " Sample 131-1_F4\n", " -1.210\n", " -3.400\n", - " -4.310\n", + " -4.31\n", " -0.810\n", " -0.995\n", " -13.525\n", @@ -768,13 +537,13 @@ " -2.885\n", " -3.995\n", " -2.57\n", - " -4.330\n", + " -4.33\n", " \n", " \n", " Sample 134-1_H4\n", " -2.875\n", " -4.845\n", - " -4.020\n", + " -4.02\n", " -0.845\n", " -4.675\n", " -7.845\n", @@ -792,13 +561,13 @@ " -1.220\n", " -1.830\n", " -0.54\n", - " -1.980\n", + " -1.98\n", " \n", " \n", " Sample 134-2_A5\n", " -0.500\n", " 3.230\n", - " -3.220\n", + " -3.22\n", " 0.000\n", " 3.620\n", " 7.900\n", @@ -816,195 +585,20 @@ " 1.765\n", " 1.600\n", " 1.69\n", - " 1.820\n", - " \n", - " \n", - " Sample 4-1_B2\n", - " 0.260\n", - " 2.495\n", - " -1.880\n", - " 0.300\n", - " 3.320\n", - " 8.535\n", - " 1.705\n", - " 4.885\n", - " 3.455\n", - " 0.955\n", - " ...\n", - " 5.870\n", - " 2.100\n", - " 4.860\n", - " 2.010\n", - " 1.030\n", - " 2.770\n", - " 1.310\n", - " 2.410\n", - " 1.28\n", - " 2.410\n", - " \n", - " \n", - " Sample 4-2_B2\n", - " -1.970\n", - " 0.505\n", - " -2.420\n", - " 0.110\n", - " 1.190\n", - " 3.450\n", - " 2.625\n", - " 4.380\n", - " 3.435\n", - " 1.700\n", - " ...\n", - " 6.680\n", - " 1.790\n", - " 3.940\n", - " 1.670\n", - " 0.760\n", - " 1.550\n", - " 1.830\n", - " 0.520\n", - " 1.18\n", - " 3.340\n", - " \n", - " \n", - " Sample 69-1_F3\n", - " -2.430\n", - " 0.020\n", - " -2.600\n", - " -0.130\n", - " 1.860\n", - " 6.345\n", - " 1.730\n", - " 5.235\n", - " 4.125\n", - " 0.025\n", - " ...\n", - " 8.190\n", - " 2.450\n", - " 3.190\n", - " 1.000\n", - " 0.950\n", - " 1.420\n", - " 1.820\n", - " 1.160\n", - " 0.01\n", - " 3.785\n", - " \n", - " \n", - " Sample 7-1_E2\n", - " -3.430\n", - " -4.350\n", - " -5.180\n", - " -0.550\n", - " -4.310\n", - " -8.240\n", - " -0.350\n", - " -2.850\n", - " -4.790\n", - " -1.220\n", - " ...\n", - " -12.670\n", - " -2.820\n", - " -9.330\n", - " -0.650\n", - " -3.940\n", - " -1.580\n", - " -3.190\n", - " -3.770\n", - " -2.29\n", - " -2.780\n", - " \n", - " \n", - " Sample 7-2_F2\n", - " -0.730\n", - " -4.290\n", - " -4.080\n", - " -0.370\n", - " -2.230\n", - " -4.420\n", - " -1.340\n", - " -3.200\n", - " -5.140\n", - " -0.150\n", - " ...\n", - " -11.875\n", - " -2.710\n", - " -8.000\n", - " -2.305\n", - " -2.140\n", - " -1.350\n", - " -2.120\n", - " -2.890\n", - " -1.61\n", - " -0.890\n", - " \n", - " \n", - " Sample 79-2_G3\n", - " 0.315\n", - " -0.780\n", - " -4.115\n", - " -0.070\n", - " 0.375\n", - " -0.765\n", - " 0.605\n", - " 3.020\n", - " -2.790\n", - " -0.105\n", - " ...\n", - " -8.730\n", - " -0.380\n", - " 0.520\n", - " 1.110\n", - " 0.090\n", - " -0.360\n", - " 0.340\n", - " -1.950\n", - " -0.47\n", - " 0.530\n", - " \n", - " \n", - " Sample 80-1_H3\n", - " -1.075\n", - " 0.975\n", - " -0.925\n", - " -0.050\n", - " 2.990\n", - " 6.180\n", - " 1.760\n", - " 4.380\n", - " 3.170\n", - " 1.230\n", - " ...\n", - " 8.830\n", - " 3.885\n", - " 5.690\n", - " 1.845\n", - " 3.130\n", - " 2.305\n", - " 0.675\n", - " 3.990\n", - " 0.98\n", - " 1.785\n", + " 1.82\n", " \n", " \n", "\n", - "

12 rows × 39 columns

\n", + "

5 rows × 39 columns

\n", "" ], "text/plain": [ " 15-13,014,749 15-13,014,782 15-13,014,816 15-13,014,843 \\\n", - "Sample 11-1_A3 -1.510 -2.730 -5.460 -0.320 \n", - "Sample 117-2_C4 -1.775 -1.010 -3.160 0.030 \n", - "Sample 131-1_F4 -1.210 -3.400 -4.310 -0.810 \n", - "Sample 134-1_H4 -2.875 -4.845 -4.020 -0.845 \n", - "Sample 134-2_A5 -0.500 3.230 -3.220 0.000 \n", - "Sample 4-1_B2 0.260 2.495 -1.880 0.300 \n", - "Sample 4-2_B2 -1.970 0.505 -2.420 0.110 \n", - "Sample 69-1_F3 -2.430 0.020 -2.600 -0.130 \n", - "Sample 7-1_E2 -3.430 -4.350 -5.180 -0.550 \n", - "Sample 7-2_F2 -0.730 -4.290 -4.080 -0.370 \n", - "Sample 79-2_G3 0.315 -0.780 -4.115 -0.070 \n", - "Sample 80-1_H3 -1.075 0.975 -0.925 -0.050 \n", + "Sample 11-1_A3 -1.510 -2.730 -5.46 -0.320 \n", + "Sample 117-2_C4 -1.775 -1.010 -3.16 0.030 \n", + "Sample 131-1_F4 -1.210 -3.400 -4.31 -0.810 \n", + "Sample 134-1_H4 -2.875 -4.845 -4.02 -0.845 \n", + "Sample 134-2_A5 -0.500 3.230 -3.22 0.000 \n", "\n", " 15-13,014,876 15-13,014,892 15-13,014,924 15-13,014,942 \\\n", "Sample 11-1_A3 -3.330 -7.600 -1.490 -2.210 \n", @@ -1012,13 +606,6 @@ "Sample 131-1_F4 -0.995 -13.525 0.300 -1.740 \n", "Sample 134-1_H4 -4.675 -7.845 -0.065 -2.525 \n", "Sample 134-2_A5 3.620 7.900 2.180 4.380 \n", - "Sample 4-1_B2 3.320 8.535 1.705 4.885 \n", - "Sample 4-2_B2 1.190 3.450 2.625 4.380 \n", - "Sample 69-1_F3 1.860 6.345 1.730 5.235 \n", - "Sample 7-1_E2 -4.310 -8.240 -0.350 -2.850 \n", - "Sample 7-2_F2 -2.230 -4.420 -1.340 -3.200 \n", - "Sample 79-2_G3 0.375 -0.765 0.605 3.020 \n", - "Sample 80-1_H3 2.990 6.180 1.760 4.380 \n", "\n", " 15-13,014,970 15-13,015,026 ... 15-13,015,535 \\\n", "Sample 11-1_A3 -1.690 -1.290 ... -10.740 \n", @@ -1026,13 +613,6 @@ "Sample 131-1_F4 -4.870 -2.110 ... -13.535 \n", "Sample 134-1_H4 -3.125 -0.555 ... -7.200 \n", "Sample 134-2_A5 3.160 1.570 ... 8.830 \n", - "Sample 4-1_B2 3.455 0.955 ... 5.870 \n", - "Sample 4-2_B2 3.435 1.700 ... 6.680 \n", - "Sample 69-1_F3 4.125 0.025 ... 8.190 \n", - "Sample 7-1_E2 -4.790 -1.220 ... -12.670 \n", - "Sample 7-2_F2 -5.140 -0.150 ... -11.875 \n", - "Sample 79-2_G3 -2.790 -0.105 ... -8.730 \n", - "Sample 80-1_H3 3.170 1.230 ... 8.830 \n", "\n", " 15-13,015,568 15-13,015,587 15-13,015,618 15-13,015,629 \\\n", "Sample 11-1_A3 -3.065 -7.785 -1.520 -2.795 \n", @@ -1040,13 +620,6 @@ "Sample 131-1_F4 -2.915 -9.220 -1.485 -4.485 \n", "Sample 134-1_H4 -2.500 -5.920 0.140 -2.160 \n", "Sample 134-2_A5 1.700 3.860 2.405 1.475 \n", - "Sample 4-1_B2 2.100 4.860 2.010 1.030 \n", - "Sample 4-2_B2 1.790 3.940 1.670 0.760 \n", - "Sample 69-1_F3 2.450 3.190 1.000 0.950 \n", - "Sample 7-1_E2 -2.820 -9.330 -0.650 -3.940 \n", - "Sample 7-2_F2 -2.710 -8.000 -2.305 -2.140 \n", - "Sample 79-2_G3 -0.380 0.520 1.110 0.090 \n", - "Sample 80-1_H3 3.885 5.690 1.845 3.130 \n", "\n", " 15-13,015,651 15-13,015,671 15-13,015,693 15-13,015,739 \\\n", "Sample 11-1_A3 -1.630 -2.330 -3.350 -1.90 \n", @@ -1054,29 +627,15 @@ "Sample 131-1_F4 -1.825 -2.885 -3.995 -2.57 \n", "Sample 134-1_H4 -0.450 -1.220 -1.830 -0.54 \n", "Sample 134-2_A5 2.860 1.765 1.600 1.69 \n", - "Sample 4-1_B2 2.770 1.310 2.410 1.28 \n", - "Sample 4-2_B2 1.550 1.830 0.520 1.18 \n", - "Sample 69-1_F3 1.420 1.820 1.160 0.01 \n", - "Sample 7-1_E2 -1.580 -3.190 -3.770 -2.29 \n", - "Sample 7-2_F2 -1.350 -2.120 -2.890 -1.61 \n", - "Sample 79-2_G3 -0.360 0.340 -1.950 -0.47 \n", - "Sample 80-1_H3 2.305 0.675 3.990 0.98 \n", "\n", " 15-13,015,768 \n", - "Sample 11-1_A3 -2.180 \n", - "Sample 117-2_C4 0.600 \n", - "Sample 131-1_F4 -4.330 \n", - "Sample 134-1_H4 -1.980 \n", - "Sample 134-2_A5 1.820 \n", - "Sample 4-1_B2 2.410 \n", - "Sample 4-2_B2 3.340 \n", - "Sample 69-1_F3 3.785 \n", - "Sample 7-1_E2 -2.780 \n", - "Sample 7-2_F2 -0.890 \n", - "Sample 79-2_G3 0.530 \n", - "Sample 80-1_H3 1.785 \n", + "Sample 11-1_A3 -2.18 \n", + "Sample 117-2_C4 0.60 \n", + "Sample 131-1_F4 -4.33 \n", + "Sample 134-1_H4 -1.98 \n", + "Sample 134-2_A5 1.82 \n", "\n", - "[12 rows x 39 columns]" + "[5 rows x 39 columns]" ] }, "metadata": {}, @@ -1092,8 +651,8 @@ " progress=True,\n", " api_mode=True)\n", "\n", - "display(all_cpg_df)\n", - "display(top_cpg_df_d[1])" + "display(all_cpg_df.head())\n", + "display(top_cpg_df_d[1].head())" ] }, { @@ -1103,6 +662,27 @@ "### Plotting functions" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "To display static version in jupyter (easier to export that dynamic d3js plots), one can use the Kaleido wrapper included in pycoMeth " + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "ExecuteTime": { + "end_time": "2020-07-13T10:18:34.856807Z", + "start_time": "2020-07-13T10:18:34.842887Z" + } + }, + "outputs": [], + "source": [ + "kaleido = Kaleido()" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -1119,11 +699,11 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 11, "metadata": { "ExecuteTime": { - "end_time": "2020-07-09T13:21:27.414835Z", - "start_time": "2020-07-09T13:21:24.117600Z" + "end_time": "2020-07-13T10:18:38.945157Z", + "start_time": "2020-07-13T10:18:37.126588Z" }, "scrolled": false }, @@ -1131,7 +711,7 @@ { "data": { "image/svg+xml": [ - "Sample 80-1_H3Sample 79-2_G3Sample 4-2_B2Sample 4-1_B2Sample 69-1_F3Sample 11-1_A3Sample 7-2_F2Sample 7-1_E2Sample 131-1_F4Sample 117-2_C4Sample 134-2_A5Sample 134-1_H4−3−2−10123Median LLRCpG positions" + "Sample 69-1_F3Sample 4-2_B2Sample 80-1_H3Sample 4-1_B2Sample 134-2_A5Sample 117-2_C4Sample 79-2_G3Sample 7-2_F2Sample 11-1_A3Sample 134-1_H4Sample 7-1_E2Sample 131-1_F4−6−4−20246Median LLRCpG positions" ], "text/plain": [ "" @@ -1139,11 +719,28 @@ }, "metadata": {}, "output_type": "display_data" + } + ], + "source": [ + "fig = cpg_heatmap(top_cpg_df_d[1], lim_llr=7)\n", + "display(kaleido.render_plotly_svg(fig, width=1200))" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "ExecuteTime": { + "end_time": "2020-07-13T10:18:41.896839Z", + "start_time": "2020-07-13T10:18:41.464350Z" }, + "scrolled": false + }, + "outputs": [ { "data": { "image/svg+xml": [ - "Sample 69-1_F3Sample 4-2_B2Sample 80-1_H3Sample 4-1_B2Sample 134-2_A5Sample 117-2_C4Sample 79-2_G3Sample 7-2_F2Sample 11-1_A3Sample 134-1_H4Sample 7-1_E2Sample 131-1_F4−6−4−20246Median LLRCpG positions" + "Sample 80-1_H3Sample 79-2_G3Sample 4-2_B2Sample 4-1_B2Sample 69-1_F3Sample 11-1_A3Sample 7-2_F2Sample 7-1_E2Sample 131-1_F4Sample 117-2_C4Sample 134-2_A5Sample 134-1_H4−3−2−10123Median LLRCpG positions" ], "text/plain": [ "" @@ -1154,8 +751,8 @@ } ], "source": [ - "static_display(cpg_heatmap(all_cpg_df, lim_llr=3), width=1200)\n", - "static_display(cpg_heatmap(top_cpg_df_d[1], lim_llr=7), width=1200)" + "fig = cpg_heatmap(all_cpg_df, lim_llr=3)\n", + "display(kaleido.render_plotly_svg(fig, width=1200))" ] }, { @@ -1179,18 +776,18 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 13, "metadata": { "ExecuteTime": { - "end_time": "2020-07-09T13:21:34.488826Z", - "start_time": "2020-07-09T13:21:33.284000Z" + "end_time": "2020-07-13T10:18:45.714449Z", + "start_time": "2020-07-13T10:18:44.914540Z" } }, "outputs": [ { "data": { "image/svg+xml": [ - "−10−50510Sample 11-1_A3Sample 4-2_B2Sample 80-1_H3Sample 7-2_F2Sample 79-2_G3Sample 134-2_A5Sample 69-1_F3Sample 117-2_C4Sample 131-1_F4Sample 7-1_E2Sample 134-1_H4Sample 4-1_B2CpG median log likelihood ratioAmbiguousUnmethylatedMethylated" + "−10−50510Sample 11-1_A3Sample 4-2_B2Sample 80-1_H3Sample 7-2_F2Sample 79-2_G3Sample 134-2_A5Sample 69-1_F3Sample 117-2_C4Sample 131-1_F4Sample 7-1_E2Sample 134-1_H4Sample 4-1_B2CpG median log likelihood ratioAmbiguousUnmethylatedMethylated" ], "text/plain": [ "" @@ -1198,11 +795,27 @@ }, "metadata": {}, "output_type": "display_data" - }, + } + ], + "source": [ + "fig = cpg_ridgeplot(all_cpg_df, box=True, scatter=False)\n", + "display(kaleido.render_plotly_svg(fig, width=1200))" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "ExecuteTime": { + "end_time": "2020-07-13T10:18:48.679257Z", + "start_time": "2020-07-13T10:18:48.440419Z" + } + }, + "outputs": [ { "data": { "image/svg+xml": [ - "−15−10−50510Sample 131-1_F4Sample 7-1_E2Sample 7-2_F2Sample 11-1_A3Sample 134-1_H4Sample 79-2_G3Sample 117-2_C4Sample 69-1_F3Sample 4-2_B2Sample 134-2_A5Sample 80-1_H3Sample 4-1_B2CpG median log likelihood ratioAmbiguousUnmethylatedMethylated" + "−15−10−50510Sample 131-1_F4Sample 7-1_E2Sample 7-2_F2Sample 11-1_A3Sample 134-1_H4Sample 79-2_G3Sample 117-2_C4Sample 69-1_F3Sample 4-2_B2Sample 134-2_A5Sample 80-1_H3Sample 4-1_B2CpG median log likelihood ratioAmbiguousUnmethylatedMethylated" ], "text/plain": [ "" @@ -1213,8 +826,8 @@ } ], "source": [ - "static_display(cpg_ridgeplot(all_cpg_df, box=True, scatter=False), width=1200)\n", - "static_display(cpg_ridgeplot(top_cpg_df_d[1]), width=1200)" + "fig = cpg_ridgeplot(top_cpg_df_d[1])\n", + "display(kaleido.render_plotly_svg(fig, width=1200))" ] }, { @@ -1238,18 +851,18 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 15, "metadata": { "ExecuteTime": { - "end_time": "2020-07-09T13:21:42.158153Z", - "start_time": "2020-07-09T13:21:41.809027Z" + "end_time": "2020-07-13T10:18:53.404109Z", + "start_time": "2020-07-13T10:18:53.211974Z" } }, "outputs": [ { "data": { "image/svg+xml": [ - "Sample 11-1_A3Sample 117-2_C4Sample 131-1_F4Sample 134-1_H4Sample 134-2_A5Sample 4-1_B2Sample 4-2_B2Sample 69-1_F3Sample 7-1_E2Sample 7-2_F2Sample 79-2_G3Sample 80-1_H30500100015002000250030003500No dataAmbiguousMethylatedUnmethylatedCounts per category" + "Sample 11-1_A3Sample 117-2_C4Sample 131-1_F4Sample 134-1_H4Sample 134-2_A5Sample 4-1_B2Sample 4-2_B2Sample 69-1_F3Sample 7-1_E2Sample 7-2_F2Sample 79-2_G3Sample 80-1_H30500100015002000250030003500No dataAmbiguousMethylatedUnmethylatedCounts per category" ], "text/plain": [ "" @@ -1257,11 +870,27 @@ }, "metadata": {}, "output_type": "display_data" - }, + } + ], + "source": [ + "fig = category_barplot(all_cpg_df)\n", + "display(kaleido.render_plotly_svg(fig, width=1200))" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "ExecuteTime": { + "end_time": "2020-07-13T10:18:56.051367Z", + "start_time": "2020-07-13T10:18:55.856750Z" + } + }, + "outputs": [ { "data": { "image/svg+xml": [ - "Sample 11-1_A3Sample 117-2_C4Sample 131-1_F4Sample 134-1_H4Sample 134-2_A5Sample 4-1_B2Sample 4-2_B2Sample 69-1_F3Sample 7-1_E2Sample 7-2_F2Sample 79-2_G3Sample 80-1_H30510152025303540No dataAmbiguousMethylatedUnmethylatedCounts per category" + "Sample 11-1_A3Sample 117-2_C4Sample 131-1_F4Sample 134-1_H4Sample 134-2_A5Sample 4-1_B2Sample 4-2_B2Sample 69-1_F3Sample 7-1_E2Sample 7-2_F2Sample 79-2_G3Sample 80-1_H30510152025303540No dataAmbiguousMethylatedUnmethylatedCounts per category" ], "text/plain": [ "" @@ -1272,8 +901,8 @@ } ], "source": [ - "static_display(category_barplot(all_cpg_df), width=1200)\n", - "static_display(category_barplot(top_cpg_df_d[1]), width=1200)" + "fig = category_barplot(top_cpg_df_d[1])\n", + "display(kaleido.render_plotly_svg(fig, width=1200))" ] }, { @@ -1297,18 +926,19 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 17, "metadata": { "ExecuteTime": { - "end_time": "2020-07-09T13:21:48.752462Z", - "start_time": "2020-07-09T13:21:48.177824Z" - } + "end_time": "2020-07-13T10:19:00.356154Z", + "start_time": "2020-07-13T10:18:59.940272Z" + }, + "scrolled": false }, "outputs": [ { "data": { "image/svg+xml": [ - "05M10M15M20M25M30M35Mchr 24chr 23chr 22chr 21chr 20chr 19chr 18chr 17chr 16chr 15chr 14chr 13chr 12chr 11chr 10chr 9chr 8chr 7chr 6chr 5chr 4chr 3chr 2chr 100.511.522.53Genomic coordinatesReference sequences" + "05M10M15M20M25M30M35Mchr 24chr 23chr 22chr 21chr 20chr 19chr 18chr 17chr 16chr 15chr 14chr 13chr 12chr 11chr 10chr 9chr 8chr 7chr 6chr 5chr 4chr 3chr 2chr 1012345Genomic coordinatesReference sequences" ], "text/plain": [ "" @@ -1319,7 +949,8 @@ } ], "source": [ - "static_display(chr_ideogram_plot(all_cpg_df, ref_fasta_fn=\"./data/medaka.fa\"), width=1200)" + "fig = chr_ideogram_plot(all_cpg_df, ref_fasta_fn=\"./data/medaka.fa\", n_len_bin=250)\n", + "display(kaleido.render_plotly_svg(fig, width=1200, height=700))" ] }, { @@ -1338,11 +969,11 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 18, "metadata": { "ExecuteTime": { - "end_time": "2020-07-09T13:21:55.699071Z", - "start_time": "2020-07-09T13:21:54.818267Z" + "end_time": "2020-07-13T10:19:08.250542Z", + "start_time": "2020-07-13T10:19:07.521679Z" }, "scrolled": false }, @@ -1354,8 +985,8 @@ "\u001b[01;34m## Checking options and input files ##\u001b[0m\n", "\u001b[37m\t[DEBUG]: Options summary\u001b[0m\n", "\u001b[37m\t[DEBUG]: \tPackage name: pycoMeth\u001b[0m\n", - "\u001b[37m\t[DEBUG]: \tPackage version: 0.4.7\u001b[0m\n", - "\u001b[37m\t[DEBUG]: \tTimestamp: 2020-07-09 14:21:54.832500\u001b[0m\n", + "\u001b[37m\t[DEBUG]: \tPackage version: 0.4.8\u001b[0m\n", + "\u001b[37m\t[DEBUG]: \tTimestamp: 2020-07-13 12:19:07.534789\u001b[0m\n", "\u001b[37m\t[DEBUG]: \tmethcomp_fn: ./data/Yeast_CGI_meth_comp.tsv.gz\u001b[0m\n", "\u001b[37m\t[DEBUG]: \tgff3_fn: ./data/yeast.gff3\u001b[0m\n", "\u001b[37m\t[DEBUG]: \tref_fasta_fn: ./data/yeast.fa\u001b[0m\n", @@ -1407,11 +1038,11 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 19, "metadata": { "ExecuteTime": { - "end_time": "2020-07-09T13:22:24.702636Z", - "start_time": "2020-07-09T13:21:59.238550Z" + "end_time": "2020-07-13T10:20:24.456828Z", + "start_time": "2020-07-13T10:19:58.540546Z" }, "scrolled": true }, @@ -1431,7 +1062,7 @@ "\u001b[32m\tComputing source md5\u001b[0m\n", "\u001b[01;34m## Parsing methcomp data ##\u001b[0m\n", "\u001b[32m\tIterating over significant intervals\u001b[0m\n", - "\tProgress: 100%|██████████| 3.53k/3.53k [00:20<00:00, 172 intervals/s] \n", + "\tProgress: 100%|██████████| 3.53k/3.53k [00:21<00:00, 166 intervals/s] \n", "\u001b[32m\tGenerating summary report\u001b[0m\n" ] } diff --git a/docs/Comp_Report/CLI_usage.ipynb b/docs/Comp_Report/CLI_usage.ipynb index b4fcf90..f1eedff 100644 --- a/docs/Comp_Report/CLI_usage.ipynb +++ b/docs/Comp_Report/CLI_usage.ipynb @@ -24,8 +24,8 @@ "execution_count": 2, "metadata": { "ExecuteTime": { - "end_time": "2020-07-09T13:26:07.327464Z", - "start_time": "2020-07-09T13:26:07.033194Z" + "end_time": "2020-07-13T10:25:45.753266Z", + "start_time": "2020-07-13T10:25:45.490831Z" }, "init_cell": true }, @@ -61,8 +61,8 @@ "execution_count": 3, "metadata": { "ExecuteTime": { - "end_time": "2020-07-09T13:22:45.143253Z", - "start_time": "2020-07-09T13:22:43.827719Z" + "end_time": "2020-07-13T10:25:49.221115Z", + "start_time": "2020-07-13T10:25:47.958971Z" } }, "outputs": [ @@ -165,8 +165,8 @@ "execution_count": 4, "metadata": { "ExecuteTime": { - "end_time": "2020-07-09T13:23:00.396019Z", - "start_time": "2020-07-09T13:22:57.799296Z" + "end_time": "2020-07-13T10:25:55.324118Z", + "start_time": "2020-07-13T10:25:52.892417Z" }, "scrolled": false }, @@ -178,8 +178,8 @@ "\u001b[01;34m## Checking options and input files ##\u001b[0m\n", "\u001b[37m\t[DEBUG]: Options summary\u001b[0m\n", "\u001b[37m\t[DEBUG]: \tPackage name: pycoMeth\u001b[0m\n", - "\u001b[37m\t[DEBUG]: \tPackage version: 0.4.7\u001b[0m\n", - "\u001b[37m\t[DEBUG]: \tTimestamp: 2020-07-09 14:22:59.200640\u001b[0m\n", + "\u001b[37m\t[DEBUG]: \tPackage version: 0.4.8\u001b[0m\n", + "\u001b[37m\t[DEBUG]: \tTimestamp: 2020-07-13 12:25:54.286588\u001b[0m\n", "\u001b[37m\t[DEBUG]: \tmethcomp_fn: ./data/Yeast_CGI_meth_comp.tsv.gz\u001b[0m\n", "\u001b[37m\t[DEBUG]: \tgff3_fn: ./data/yeast.gff3\u001b[0m\n", "\u001b[37m\t[DEBUG]: \tref_fasta_fn: ./data/yeast.fa\u001b[0m\n", @@ -196,7 +196,7 @@ "\u001b[37m\t[DEBUG]: \tprogress: False\u001b[0m\n", "\u001b[37m\t[DEBUG]: \tkwargs\u001b[0m\n", "\u001b[37m\t[DEBUG]: \t\tsubcommands: Comp_Report\u001b[0m\n", - "\u001b[37m\t[DEBUG]: \t\tfunc: \u001b[0m\n", + "\u001b[37m\t[DEBUG]: \t\tfunc: \u001b[0m\n", "\u001b[01;34m## Loading and preparing data ##\u001b[0m\n", "\u001b[32m\tLoading Methcomp data from TSV file\u001b[0m\n", "\u001b[32m\tLoading transcripts info from GFF file\u001b[0m\n", @@ -240,11 +240,11 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 5, "metadata": { "ExecuteTime": { - "end_time": "2020-07-09T13:26:40.196255Z", - "start_time": "2020-07-09T13:26:10.371755Z" + "end_time": "2020-07-13T10:26:40.115493Z", + "start_time": "2020-07-13T10:26:12.814818Z" }, "scrolled": false }, @@ -264,7 +264,6 @@ "\u001b[32m\tComputing source md5\u001b[0m\n", "\u001b[01;34m## Parsing methcomp data ##\u001b[0m\n", "\u001b[32m\tIterating over significant intervals\u001b[0m\n", - "[10219:0709/142616.540247:ERROR:buffer_manager.cc(488)] [.DisplayCompositor]GL ERROR :GL_INVALID_OPERATION : glBufferData: <- error from previous GL command\n", "\u001b[32m\tGenerating summary report\u001b[0m\n", "(pycoMeth) " ] diff --git a/docs/Comp_Report/medaka_html/interval_reports/interval_0001_chr15-13014693-13015794.html b/docs/Comp_Report/medaka_html/interval_reports/interval_0001_chr15-13014693-13015794.html index 189721c..0fe31bb 100644 --- a/docs/Comp_Report/medaka_html/interval_reports/interval_0001_chr15-13014693-13015794.html +++ b/docs/Comp_Report/medaka_html/interval_reports/interval_0001_chr15-13014693-13015794.html @@ -63,7 +63,7 @@
-

CpG interval report generated on 09/07/20 with pycoMeth 0.4.7

+

CpG interval report generated on 13/07/20 with pycoMeth 0.4.8

@@ -102,14 +102,14 @@
Methylation log-likelihood ratio by CpG position -
+