Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pyOpenMS-Viz is a Python library that provides a simple interface for extending
- Consistent API across different plotting backends for easy switching between static and interactive plots
- Suitable for use in scripts, Jupyter notebooks, and web applications

## Suported Plots
## Supported Plots
| **Plot Type** | **Required Dimensions** | **pyopenms_viz Name** | **Matplotlib** | **Bokeh** | **Plotly** |
|-----------------|-------------------------|-----------------------------------------------------------|----------------|-----------|------------|
| Chromatogram | x, y | chromatogram | ✓ | ✓ | ✓ |
Expand All @@ -36,7 +36,7 @@ pyOpenMS-Viz is a Python library that provides a simple interface for extending

The recommended way of installing pyopenms_viz is through the Python Package Index (PyPI). We recommend installing pyopenms_viz in its own virtual environment using Anaconda to avoid packaging conflicts.

First create a new environemnt:
First create a new environment:

```bash
conda create --name=pyopenms_viz python=3.12
Expand Down
30 changes: 15 additions & 15 deletions docs/Getting Started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -678,15 +678,15 @@
"id": "3dc84ffd-d227-4593-a699-b1d9bac20dcb",
"metadata": {},
"source": [
"##### Base Customization Examples (Avalible for all graph types)"
"##### Base Customization Examples (Available for all graph types)"
]
},
{
"cell_type": "markdown",
"id": "549340bf-6216-4a48-8d9b-bc8091611225",
"metadata": {},
"source": [
"Below are examples of customizations avaliable for all plot types. For a full list of customization options, please see [Parameters](Parameters/Parameters.rst)"
"Below are examples of customizations available for all plot types. For a full list of customization options, please see [Parameters](Parameters/Parameters.rst)"
]
},
{
Expand Down Expand Up @@ -858,7 +858,7 @@
"plt.savefig('spectrum.pdf')\n",
"```\n",
"\n",
"- For bokeh, you can use `output_file` method to save an html file of the iteractive plot. To save a static plot you can use the tool bar in the interactive plot to save the plot as a png. Or you can use the `export_png` method. However, this requires additional dependencies: `pip install selenium geckodriver firefox`. For more information on saving bokeh plots see [here](https://docs.bokeh.org/en/latest/docs/first_steps/first_steps_7.html#first-steps-7-displaying-and-exporting).\n",
"- For bokeh, you can use `output_file` method to save an html file of the interactive plot. To save a static plot you can use the tool bar in the interactive plot to save the plot as a png. Or you can use the `export_png` method. However, this requires additional dependencies: `pip install selenium geckodriver firefox`. For more information on saving bokeh plots see [here](https://docs.bokeh.org/en/latest/docs/first_steps/first_steps_7.html#first-steps-7-displaying-and-exporting).\n",
"\n",
"```python\n",
"from bokeh.io import output_file\n",
Expand Down Expand Up @@ -901,7 +901,7 @@
"id": "732688a5-c69f-48e9-a6bb-c0216d52595e",
"metadata": {},
"source": [
"If there is a peptide spectrum match, it is useful to annotate the spectrum with the fragments of the expected peptide so that one can manually evalute the match. Here, we demonstrate how to do this with `pyopenms_viz` and `pyopenms`"
"If there is a peptide spectrum match, it is useful to annotate the spectrum with the fragments of the expected peptide so that one can manually evaluate the match. Here, we demonstrate how to do this with `pyopenms_viz` and `pyopenms`"
]
},
{
Expand Down Expand Up @@ -953,7 +953,7 @@
"id": "2495b624-e17c-4803-8bae-a3581ac325c3",
"metadata": {},
"source": [
"To plot with pyopenms_viz, all that is required is the addtional `reference_spectrum` parameter which contains a pandas dataframe of the theoretical spectrum and to change `mirror_spectrum` to `True`"
"To plot with pyopenms_viz, all that is required is the additional `reference_spectrum` parameter which contains a pandas dataframe of the theoretical spectrum and to change `mirror_spectrum` to `True`"
]
},
{
Expand Down Expand Up @@ -1512,7 +1512,7 @@
"id": "273adf2f-8879-4c82-99f8-0ea8f83013c8",
"metadata": {},
"source": [
"Below are some customizations that are specific to the `\"peakMap\"` plot. Note that some of these customizations, such as binning are also available for the `\"spectrum\"` plot however they are not avaliable for all plot types (e.g. `\"chromatogram\"`). For a full list of customizations please see the [PeakMap Parameters](Parameters/PeakMap.rst)."
"Below are some customizations that are specific to the `\"peakMap\"` plot. Note that some of these customizations, such as binning are also available for the `\"spectrum\"` plot however they are not available for all plot types (e.g. `\"chromatogram\"`). For a full list of customizations please see the [PeakMap Parameters](Parameters/PeakMap.rst)."
]
},
{
Expand Down Expand Up @@ -1933,7 +1933,7 @@
"id": "1abd64d2-3f47-4fe5-bbd7-bea77515b10c",
"metadata": {},
"source": [
"A chromatogram plot is useful for visualizing intensity across retention time. This can either be the total ion current across retention time or the ion curent from a specific region across m/z as used in targeted apporaches. "
"A chromatogram plot is useful for visualizing intensity across retention time. This can either be the total ion current across retention time or the ion current from a specific region across m/z as used in targeted approaches. "
]
},
{
Expand Down Expand Up @@ -2093,7 +2093,7 @@
"id": "026280af-f73a-4d71-97fd-035b20a28994",
"metadata": {},
"source": [
"In this dataset different features are resolved nicely as indicated by nicely seperable peaks. "
"In this dataset different features are resolved nicely as indicated by nicely separable peaks. "
]
},
{
Expand Down Expand Up @@ -2125,7 +2125,7 @@
"id": "9b17fa72-1791-4e9d-b0e5-8d743042fbf5",
"metadata": {},
"source": [
"In this example, we will show how `pyopenms_viz` can be used to inspec a target peptide in Data Indepdent Acquisition. For this, we will be using a timsTOF dataset and show how `pyopenms_viz` integrates well with [alphatims](https://github.com/MannLabs/alphatims) "
"In this example, we will show how `pyopenms_viz` can be used to inspec a target peptide in Data Independent Acquisition. For this, we will be using a timsTOF dataset and show how `pyopenms_viz` integrates well with [alphatims](https://github.com/MannLabs/alphatims) "
]
},
{
Expand Down Expand Up @@ -2691,7 +2691,7 @@
"id": "ef06ecc1-fa50-48a2-97a0-8c86995765b3",
"metadata": {},
"source": [
"If we plot the dia_df chromatograms at baseline, we will have multiple points per RT point (due to multiple points across ion mobility). To address this we can use the `aggregate_duplicates=True` argument. Furthermore, setting `by='Annotation` tells `pyopenms_viz` to plot each annotation as a seperate chromatogram."
"If we plot the dia_df chromatograms at baseline, we will have multiple points per RT point (due to multiple points across ion mobility). To address this we can use the `aggregate_duplicates=True` argument. Furthermore, setting `by='Annotation` tells `pyopenms_viz` to plot each annotation as a separate chromatogram."
]
},
{
Expand Down Expand Up @@ -2755,7 +2755,7 @@
"dia_df.plot(x='rt_values', \n",
" y='intensity_values', \n",
" kind='chromatogram', \n",
" by='Annotation', # each annotation as seperate chromatogram\n",
" by='Annotation', # each annotation as separate chromatogram\n",
" aggregate_duplicates=True,\n",
" width=700,\n",
" legend_config=dict(title='Annotation'),\n",
Expand All @@ -2768,7 +2768,7 @@
"id": "83f27f19-ba2d-479d-808a-92eb2211afc1",
"metadata": {},
"source": [
"Based on the plot above, it looks like this peptide precursor elutes from 594.40 to 605 seconds. We can draw these boundaries on the chromatogram by specifiying the `annotation_data` dataframe. We can also extract across retention time to better see the feature."
"Based on the plot above, it looks like this peptide precursor elutes from 594.40 to 605 seconds. We can draw these boundaries on the chromatogram by specifying the `annotation_data` dataframe. We can also extract across retention time to better see the feature."
]
},
{
Expand Down Expand Up @@ -2837,7 +2837,7 @@
"dia_df_small.plot(x='rt_values', \n",
" y='intensity_values', \n",
" kind='chromatogram', \n",
" by='Annotation', # each annotation as seperate chromatogram\n",
" by='Annotation', # each annotation as separate chromatogram\n",
" aggregate_duplicates=True,\n",
" annotation_data=annotation_data,\n",
" width=700,\n",
Expand All @@ -2852,7 +2852,7 @@
"id": "a3335ede-5d2d-4afb-93f8-dd9f5beca962",
"metadata": {},
"source": [
"Grouping is not only limited to `Annnotation` we can change the `by` parameter to `ms_level` to get the total ion chromatograms for MS1 and MS2 levels respectively."
"Grouping is not only limited to `Annotation` we can change the `by` parameter to `ms_level` to get the total ion chromatograms for MS1 and MS2 levels respectively."
]
},
{
Expand Down Expand Up @@ -2921,7 +2921,7 @@
"dia_df_small.plot(x='rt_values', \n",
" y='intensity_values', \n",
" kind='chromatogram', \n",
" by='ms_level', # each ms_level as a seperate chromatogram\n",
" by='ms_level', # each ms_level as a separate chromatogram\n",
" aggregate_duplicates=True,\n",
" annotation_data=annotation_data,\n",
" width=700,\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def bokeh_scraper(block, block_vars, gallery_conf, **kwargs):
+ "from bokeh.plotting import show\n"
+ str(block[1])
)
# add indendation
# add indentation
code_block = code_block.replace("\n", "\n ")

return code_block
Expand Down
2 changes: 1 addition & 1 deletion docs/gallery_scripts_template/plot_spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
download_file(url, local_path, backup_url=backup_url)
df = pd.read_csv(local_path, sep="\t")

# mirror a reference spectrum with ion and sequence annoations
# mirror a reference spectrum with ion and sequence annotations
df.plot(
x="mz",
y="intensity",
Expand Down
4 changes: 2 additions & 2 deletions nbs/Spectrum.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@
}
],
"source": [
"# custom annoation for all peaks without mz annotation\n",
"# custom annotation for all peaks without mz annotation\n",
"df.plot(x=\"mz\", y=\"intensity\", kind=\"spectrum\",\n",
" custom_annotation=\"custom_annotation\", annotate_mz=False, annotate_top_n_peaks=\"all\")"
]
Expand All @@ -369,7 +369,7 @@
}
],
"source": [
"# mirror a reference spectrum with ion and sequence annoations\n",
"# mirror a reference spectrum with ion and sequence annotations\n",
"df.plot(x=\"mz\", y=\"intensity\", kind=\"spectrum\",\n",
" ion_annotation=\"ion_annotation\", sequence_annotation=\"sequence\",\n",
" reference_spectrum=df, mirror_spectrum=True)"
Expand Down
6 changes: 3 additions & 3 deletions pyopenms_viz/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def load_config(self, **kwargs):
def _check_and_aggregate_duplicates(self):
"""
Check if duplicate data is present and aggregate if specified.
Properly handles data types and only aggregates relevent columns
Properly handles data types and only aggregates relevant columns
"""
# Determine intensity column and relevant grouping columns
intensity_col = self.z if self._kind == "peakmap" else self.y
Expand Down Expand Up @@ -535,7 +535,7 @@ def _create_tooltips(self, entries: dict, index: bool = True):

Parameters:
entries (dict): Which data to put in tool tip and how display it with labels as keys and column names as values.
index (bool, optional): Wether to show dataframe index in tooltip. Defaults to True.
index (bool, optional): Whether to show dataframe index in tooltip. Defaults to True.

Returns:
Tooltip text.
Expand Down Expand Up @@ -774,7 +774,7 @@ def plot(self):

# color generation is more complex for spectrum plots, so it has its own methods

# Peak colors are determined by peak_color column (highest priorty) or ion_annotation column (second priority) or "by" column (lowest priority)
# Peak colors are determined by peak_color column (highest priority) or ion_annotation column (second priority) or "by" column (lowest priority)
if self.peak_color is not None and self.peak_color in self.data.columns:
self.by = self.peak_color
elif (
Expand Down
2 changes: 1 addition & 1 deletion pyopenms_viz/_matplotlib/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def _create_figure(self):
Create a figure and axes objects,
for consistency with other backends, the fig object stores the matplotlib axes object
"""
# TODO why is self.heigh and self.width checked if no alternatives
# TODO why is self.height and self.width checked if no alternatives
if self.width is not None and self.height is not None and not self.plot_3d:
self.fig, self.ax = plt.subplots(
figsize=(self.width / 100, self.height / 100), dpi=100
Expand Down
Loading