.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/ms_bokeh/plot_spyogenes_subplots_ms_bokeh.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code or to run this example in your browser via Binder. .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_ms_bokeh_plot_spyogenes_subplots_ms_bokeh.py: Plot Spyogenes subplots ms_bokeh ======================================= Here we show how we can plot multiple chromatograms across runs together .. GENERATED FROM PYTHON SOURCE LINES 7-73 .. bokeh-plot:: :source-position: none from bokeh.plotting import show import pandas as pd import numpy as np from bokeh.layouts import column from bokeh.io import show from pyopenms_viz.util import download_file, unzip_file # GitHub release asset (primary) with Zenodo as backup url = ( "https://github.com/OpenMS/pyopenms_viz/releases/download/manuscript/spyogenes.zip" ) backup_url = "https://zenodo.org/records/17904512/files/spyogenes.zip?download=1" zip_filename = "spyogenes.zip" zip_dir = "spyogenes" download_file(url, zip_filename, backup_url=backup_url) unzip_file(zip_filename, ".") # Extract to current directory annotation_bounds = pd.read_csv( "spyogenes/AADGQTVSGGSILYR3_manual_annotations.tsv", sep="\t" ) # contain annotations across all runs chrom_df = pd.read_csv( "spyogenes/chroms_AADGQTVSGGSILYR3.tsv", sep="\t" ) # contains chromatogram for precursor across all runs ##### Set Plotting Variables ##### pd.options.plotting.backend = "ms_bokeh" RUN_NAMES = [ "Run #0 Spyogenes 0% human plasma", "Run #1 Spyogenes 0% human plasma", "Run #2 Spyogenes 0% human plasma", "Run #3 Spyogenes 10% human plasma", "Run #4 Spyogenes 10% human plasma", "Run #5 Spyogenes 10% human plasma", ] # For each run fill in the axs object with the corresponding chromatogram plot_list = [] for i, run in enumerate(RUN_NAMES): run_df = chrom_df[chrom_df["run_name"] == run] current_bounds = annotation_bounds[annotation_bounds["run"] == run] plot_list.append( run_df.plot( kind="chromatogram", x="rt", y="int", grid=False, by="ion_annotation", title=run_df.iloc[0]["run_name"], title_font_size=16, width=700, xaxis_label_font_size=16, yaxis_label_font_size=16, xaxis_tick_font_size=14, yaxis_tick_font_size=14, relative_intensity=True, annotation_data=current_bounds, xlabel="Retention Time (sec)", ylabel="Relative\nIntensity", show_plot=False, legend_config={"show": True, "title": "Transition"}, ) ) show(column(plot_list)) .. code-block:: Python import pandas as pd import numpy as np from bokeh.layouts import column from bokeh.io import show from pyopenms_viz.util import download_file, unzip_file # GitHub release asset (primary) with Zenodo as backup url = ( "https://github.com/OpenMS/pyopenms_viz/releases/download/manuscript/spyogenes.zip" ) backup_url = "https://zenodo.org/records/17904512/files/spyogenes.zip?download=1" zip_filename = "spyogenes.zip" zip_dir = "spyogenes" download_file(url, zip_filename, backup_url=backup_url) unzip_file(zip_filename, ".") # Extract to current directory annotation_bounds = pd.read_csv( "spyogenes/AADGQTVSGGSILYR3_manual_annotations.tsv", sep="\t" ) # contain annotations across all runs chrom_df = pd.read_csv( "spyogenes/chroms_AADGQTVSGGSILYR3.tsv", sep="\t" ) # contains chromatogram for precursor across all runs ##### Set Plotting Variables ##### pd.options.plotting.backend = "ms_bokeh" RUN_NAMES = [ "Run #0 Spyogenes 0% human plasma", "Run #1 Spyogenes 0% human plasma", "Run #2 Spyogenes 0% human plasma", "Run #3 Spyogenes 10% human plasma", "Run #4 Spyogenes 10% human plasma", "Run #5 Spyogenes 10% human plasma", ] # For each run fill in the axs object with the corresponding chromatogram plot_list = [] for i, run in enumerate(RUN_NAMES): run_df = chrom_df[chrom_df["run_name"] == run] current_bounds = annotation_bounds[annotation_bounds["run"] == run] plot_list.append( run_df.plot( kind="chromatogram", x="rt", y="int", grid=False, by="ion_annotation", title=run_df.iloc[0]["run_name"], title_font_size=16, width=700, xaxis_label_font_size=16, yaxis_label_font_size=16, xaxis_tick_font_size=14, yaxis_tick_font_size=14, relative_intensity=True, annotation_data=current_bounds, xlabel="Retention Time (sec)", ylabel="Relative\nIntensity", show_plot=False, legend_config={"show": True, "title": "Transition"}, ) ) show(column(plot_list)) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.114 seconds) .. _sphx_glr_download_gallery_ms_bokeh_plot_spyogenes_subplots_ms_bokeh.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: binder-badge .. image:: images/binder_badge_logo.svg :target: https://notebooks.gesis.org/binder/v2/gh/OpenMS/pyopenms_viz/gh_pages?filepath=notebooks/gallery/ms_bokeh/plot_spyogenes_subplots_ms_bokeh.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_spyogenes_subplots_ms_bokeh.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_spyogenes_subplots_ms_bokeh.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_spyogenes_subplots_ms_bokeh.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_