ms-mint 0.3.0__tar.gz → 0.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. {ms-mint-0.3.0/ms_mint.egg-info → ms-mint-0.3.2}/PKG-INFO +9 -7
  2. {ms-mint-0.3.0 → ms-mint-0.3.2}/README.md +8 -6
  3. {ms-mint-0.3.0 → ms-mint-0.3.2}/ms_mint/Mint.py +73 -21
  4. {ms-mint-0.3.0 → ms-mint-0.3.2}/ms_mint/MintPlotter.py +56 -85
  5. {ms-mint-0.3.0 → ms-mint-0.3.2}/ms_mint/_version.py +3 -3
  6. {ms-mint-0.3.0 → ms-mint-0.3.2}/ms_mint/io.py +8 -2
  7. {ms-mint-0.3.0 → ms-mint-0.3.2}/ms_mint/matplotlib_tools.py +14 -4
  8. {ms-mint-0.3.0 → ms-mint-0.3.2}/ms_mint/pca.py +9 -5
  9. {ms-mint-0.3.0 → ms-mint-0.3.2}/ms_mint/plotly_tools.py +85 -28
  10. {ms-mint-0.3.0 → ms-mint-0.3.2}/ms_mint/processing.py +1 -1
  11. {ms-mint-0.3.0 → ms-mint-0.3.2}/ms_mint/standards.py +14 -0
  12. {ms-mint-0.3.0 → ms-mint-0.3.2}/ms_mint/tools.py +7 -12
  13. {ms-mint-0.3.0 → ms-mint-0.3.2/ms_mint.egg-info}/PKG-INFO +9 -7
  14. {ms-mint-0.3.0 → ms-mint-0.3.2}/LICENSE +0 -0
  15. {ms-mint-0.3.0 → ms-mint-0.3.2}/MANIFEST.in +0 -0
  16. {ms-mint-0.3.0 → ms-mint-0.3.2}/ms_mint/Chromatogram.py +0 -0
  17. {ms-mint-0.3.0 → ms-mint-0.3.2}/ms_mint/TargetOptimizer.py +0 -0
  18. {ms-mint-0.3.0 → ms-mint-0.3.2}/ms_mint/__init__.py +0 -0
  19. {ms-mint-0.3.0 → ms-mint-0.3.2}/ms_mint/filelock.py +0 -0
  20. {ms-mint-0.3.0 → ms-mint-0.3.2}/ms_mint/filters.py +0 -0
  21. {ms-mint-0.3.0 → ms-mint-0.3.2}/ms_mint/notebook.py +0 -0
  22. {ms-mint-0.3.0 → ms-mint-0.3.2}/ms_mint/targets.py +0 -0
  23. {ms-mint-0.3.0 → ms-mint-0.3.2}/ms_mint.egg-info/SOURCES.txt +0 -0
  24. {ms-mint-0.3.0 → ms-mint-0.3.2}/ms_mint.egg-info/dependency_links.txt +0 -0
  25. {ms-mint-0.3.0 → ms-mint-0.3.2}/ms_mint.egg-info/requires.txt +0 -0
  26. {ms-mint-0.3.0 → ms-mint-0.3.2}/ms_mint.egg-info/top_level.txt +0 -0
  27. {ms-mint-0.3.0 → ms-mint-0.3.2}/scripts/ms-mint-convert.py +0 -0
  28. {ms-mint-0.3.0 → ms-mint-0.3.2}/setup.cfg +0 -0
  29. {ms-mint-0.3.0 → ms-mint-0.3.2}/setup.py +0 -0
  30. {ms-mint-0.3.0 → ms-mint-0.3.2}/versioneer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ms-mint
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: Metabolomics Integrator (Mint)
5
5
  Home-page: https://github.com/LewisResearchGroup/ms-mint
6
6
  Author: Soren Wacker
@@ -15,6 +15,8 @@ License-File: LICENSE
15
15
  [![Python package](https://github.com/LewisResearchGroup/ms-mint/actions/workflows/pythonpackage.yml/badge.svg)](https://github.com/LewisResearchGroup/ms-mint/actions/workflows/pythonpackage.yml)
16
16
  ![](https://github.com/LewisResearchGroup/ms-mint/blob/develop/images/coverage.svg)
17
17
  [![CodeQL](https://github.com/lewisresearchgroup/ms-mint/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/lewisresearchgroup/ms-mint/actions/workflows/codeql-analysis.yml)
18
+ ![PyPI](https://img.shields.io/pypi/v/ms-mint?label=pypi%20package)
19
+ ![PyPI - Downloads](https://img.shields.io/pypi/dm/ms-mint)
18
20
 
19
21
  # Wecome to ms-mint
20
22
 
@@ -136,7 +138,7 @@ If you only have retention time (Rt) values for your targets, or if the Rt value
136
138
 
137
139
  To use the `mint.opt.rt_min_max()` function, you will need to provide it with a list of retention times for your targets and the names of the mass spectrometry files containing your data. The function will then search through the data to find the optimal `rt_min` and `rt_max` values, which you can use to refine your analysis. You can then use these optimized values in conjunction with the other functions and methods of the `Mint` class to process and analyze your data.
138
140
 
139
- ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/peak-shapes-before-opt.png)
141
+ ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/img/peak-shapes-before-opt.png)
140
142
 
141
143
  Now, we can run the peak optimization with:
142
144
 
@@ -153,7 +155,7 @@ If you do not provide a list of peak_labels to the `mint.opt.rt_min_max()` funct
153
155
 
154
156
  After running the optimization, it is a good idea to perform a manual fine-tuning of the `rt_min` and `rt_max` values, especially for complicated peaks (peaks with multiple components, noisy peaks, etc.). You can use the `mint.plot.peak_shapes()` function to visualize the peak shapes and identify any areas that may require further attention.
155
157
 
156
- ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/optimize-rt_min_max.png)
158
+ ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/img/optimize-rt_min_max.png)
157
159
 
158
160
  The black lines indicates the average intensity across all files used for the optimization. The orange dotted lines show the shape of the gaussian function used to weight the mean intensities for peak selection. The orange horizontal lines indicate the peak width and the blue `x`s show the identified peak maxima. The green shaded areas show the Rt ranges which were selected by the algorithm.
159
161
 
@@ -162,7 +164,7 @@ Then we apply the changes and plot the new peak shapes:
162
164
  mint.run()
163
165
  mint.plot.peak_shapes(col_wrap=3)
164
166
 
165
- ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/peak-shapes-after-opt.png)
167
+ ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/img/peak-shapes-after-opt.png)
166
168
 
167
169
  As you can see, the shapes of Xanthine, Succinate, Citrulline look much better.
168
170
 
@@ -172,7 +174,7 @@ The `Mint` class has a few convenient methods to visualize and explore the proce
172
174
 
173
175
  ## Plot peak shapes
174
176
 
175
- ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/peak-shapes-after-opt.png)
177
+ ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/img/peak-shapes-after-opt.png)
176
178
 
177
179
  mint.plot.peak_shapes(col_wrap = 3)
178
180
 
@@ -207,7 +209,7 @@ Before clustering the data can be transformed and scaled. By default `log2p1(x)
207
209
  cmap=None # Name of a matplotlib color map
208
210
  )
209
211
 
210
- ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/hierarchical_clustering.png)
212
+ ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/img/hierarchical_clustering.png)
211
213
 
212
214
  ## Principal Components Analysis
213
215
 
@@ -221,7 +223,7 @@ After running the PCA the results can be plotted with:
221
223
 
222
224
  mint.pca.plot.pairplot(n_components=5, interactive=False)
223
225
 
224
- ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/pca-pairplot.png)
226
+ ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/img/pca-pairplot.png)
225
227
 
226
228
  ## FAQ
227
229
  ### What is a target list
@@ -1,6 +1,8 @@
1
1
  [![Python package](https://github.com/LewisResearchGroup/ms-mint/actions/workflows/pythonpackage.yml/badge.svg)](https://github.com/LewisResearchGroup/ms-mint/actions/workflows/pythonpackage.yml)
2
2
  ![](https://github.com/LewisResearchGroup/ms-mint/blob/develop/images/coverage.svg)
3
3
  [![CodeQL](https://github.com/lewisresearchgroup/ms-mint/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/lewisresearchgroup/ms-mint/actions/workflows/codeql-analysis.yml)
4
+ ![PyPI](https://img.shields.io/pypi/v/ms-mint?label=pypi%20package)
5
+ ![PyPI - Downloads](https://img.shields.io/pypi/dm/ms-mint)
4
6
 
5
7
  # Wecome to ms-mint
6
8
 
@@ -122,7 +124,7 @@ If you only have retention time (Rt) values for your targets, or if the Rt value
122
124
 
123
125
  To use the `mint.opt.rt_min_max()` function, you will need to provide it with a list of retention times for your targets and the names of the mass spectrometry files containing your data. The function will then search through the data to find the optimal `rt_min` and `rt_max` values, which you can use to refine your analysis. You can then use these optimized values in conjunction with the other functions and methods of the `Mint` class to process and analyze your data.
124
126
 
125
- ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/peak-shapes-before-opt.png)
127
+ ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/img/peak-shapes-before-opt.png)
126
128
 
127
129
  Now, we can run the peak optimization with:
128
130
 
@@ -139,7 +141,7 @@ If you do not provide a list of peak_labels to the `mint.opt.rt_min_max()` funct
139
141
 
140
142
  After running the optimization, it is a good idea to perform a manual fine-tuning of the `rt_min` and `rt_max` values, especially for complicated peaks (peaks with multiple components, noisy peaks, etc.). You can use the `mint.plot.peak_shapes()` function to visualize the peak shapes and identify any areas that may require further attention.
141
143
 
142
- ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/optimize-rt_min_max.png)
144
+ ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/img/optimize-rt_min_max.png)
143
145
 
144
146
  The black lines indicates the average intensity across all files used for the optimization. The orange dotted lines show the shape of the gaussian function used to weight the mean intensities for peak selection. The orange horizontal lines indicate the peak width and the blue `x`s show the identified peak maxima. The green shaded areas show the Rt ranges which were selected by the algorithm.
145
147
 
@@ -148,7 +150,7 @@ Then we apply the changes and plot the new peak shapes:
148
150
  mint.run()
149
151
  mint.plot.peak_shapes(col_wrap=3)
150
152
 
151
- ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/peak-shapes-after-opt.png)
153
+ ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/img/peak-shapes-after-opt.png)
152
154
 
153
155
  As you can see, the shapes of Xanthine, Succinate, Citrulline look much better.
154
156
 
@@ -158,7 +160,7 @@ The `Mint` class has a few convenient methods to visualize and explore the proce
158
160
 
159
161
  ## Plot peak shapes
160
162
 
161
- ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/peak-shapes-after-opt.png)
163
+ ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/img/peak-shapes-after-opt.png)
162
164
 
163
165
  mint.plot.peak_shapes(col_wrap = 3)
164
166
 
@@ -193,7 +195,7 @@ Before clustering the data can be transformed and scaled. By default `log2p1(x)
193
195
  cmap=None # Name of a matplotlib color map
194
196
  )
195
197
 
196
- ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/hierarchical_clustering.png)
198
+ ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/img/hierarchical_clustering.png)
197
199
 
198
200
  ## Principal Components Analysis
199
201
 
@@ -207,7 +209,7 @@ After running the PCA the results can be plotted with:
207
209
 
208
210
  mint.pca.plot.pairplot(n_components=5, interactive=False)
209
211
 
210
- ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/pca-pairplot.png)
212
+ ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/img/pca-pairplot.png)
211
213
 
212
214
  ## FAQ
213
215
  ### What is a target list
@@ -10,6 +10,8 @@ from pathlib import Path as P
10
10
  from multiprocessing import Pool, Manager, cpu_count
11
11
  from glob import glob
12
12
 
13
+ from sklearn.preprocessing import StandardScaler, RobustScaler
14
+
13
15
  from .standards import MINT_RESULTS_COLUMNS, TARGETS_COLUMNS, DEPRECATED_LABELS
14
16
  from .processing import process_ms1_files_in_parallel, extract_chromatogram_from_ms1
15
17
  from .io import export_to_excel, ms_file_to_df
@@ -21,7 +23,8 @@ from .tools import (
21
23
  get_targets_from_results,
22
24
  scale_dataframe,
23
25
  init_metadata,
24
- fn_to_label
26
+ fn_to_label,
27
+ log2p1
25
28
  )
26
29
  from .pca import PrincipalComponentsAnalyser
27
30
  from .MintPlotter import MintPlotter
@@ -59,7 +62,8 @@ class Mint(object):
59
62
  ):
60
63
  self.verbose = verbose
61
64
  self._version = ms_mint.__version__
62
- print("Mint version:", self.version, "\n")
65
+ if verbose:
66
+ print("Mint version:", self.version, "\n")
63
67
  self.progress_callback = progress_callback
64
68
  self.reset()
65
69
  self.plot = MintPlotter(mint=self)
@@ -381,40 +385,82 @@ class Mint(object):
381
385
  def results(self, df):
382
386
  self._results = df
383
387
 
384
- def crosstab(self, values: str = "peak_max", index: str = None, column: str = None, aggfunc: str = 'mean', apply: Callable = None, scaler: Callable = None):
388
+ def crosstab(self, var_name: str = None, index: str = None, column: str = None, aggfunc: str = 'mean',
389
+ apply: Callable = None, scaler: Callable = None, groupby: str = None):
385
390
  """
386
391
  Create condensed representation of the results.
387
392
  More specifically, a cross-table with filenames as index and target labels.
388
393
  The values in the cells are determined by *col_name*.
389
394
 
390
- :param col_name: Name of the column from *mint.results* table that is used for the cell values.
391
- :type col_name: str
395
+ :param var_name: Name of the column from *mint.results* table that is used for the cell values. If None, defaults to 'peak_area_top3'.
396
+ :type var_name: str, optional
397
+
398
+ :param index: Name of the column to be used as index in the resulting cross-tabulation. If None, defaults to 'ms_file_label'.
399
+ :type index: str, optional
400
+
401
+ :param column: Name of the column to be used as columns in the resulting cross-tabulation. If None, defaults to 'peak_label'.
402
+ :type column: str, optional
403
+
404
+ :param aggfunc: Aggregation function to be used for aggregating values. Defaults to 'mean'.
405
+ :type aggfunc: str, optional
406
+
407
+ :param apply: Function to be applied to the resulting cross-tabulation. If None, no function is applied.
408
+ :type apply: Callable, optional
392
409
 
393
- cells of the returned table.
410
+ :param scaler: Function to scale the data in the resulting cross-tabulation. If None, no scaling is performed.
411
+ :type scaler: Callable, optional
412
+
413
+ :param groupby: Name of the column to group data before scaling. If None, scaling is applied to the whole data, not group-wise.
414
+ :type groupby: str, optional
415
+
416
+ :return: DataFrame representing the cross-tabulation.
417
+ :rtype: pandas.DataFrame
394
418
  """
395
-
396
419
  df_meta = pd.merge(self.meta, self.results, left_index=True, right_on='ms_file_label')
397
-
420
+ # Remove None if in index
421
+ if isinstance(index, list):
422
+ if None in index:
423
+ index.remove(None)
424
+ if isinstance(groupby, str):
425
+ groupby = [groupby]
426
+
398
427
  if index is None:
399
428
  index = 'ms_file_label'
400
429
  if column is None:
401
430
  column = 'peak_label'
402
- if values is None:
403
- values = 'peak_area_top3'
404
-
405
- df = pd.crosstab(
406
- df_meta[index],
407
- df_meta[column],
408
- df_meta[values],
409
- aggfunc=aggfunc,
410
- ).astype(np.float64)
411
-
431
+ if var_name is None:
432
+ var_name = 'peak_area_top3'
412
433
  if apply:
413
- df = df.apply(apply)
434
+ if apply == 'log2p1':
435
+ apply = log2p1
436
+ if apply == 'logp1':
437
+ apply = np.log1p
438
+ df_meta[var_name] = df_meta[var_name].apply(apply)
439
+ if isinstance(scaler, str):
440
+ scaler_dict = {'standard': StandardScaler(),
441
+ 'robust': RobustScaler()}
442
+
443
+ if scaler not in scaler_dict:
444
+ raise ValueError(f"Unsupported scaler: {scaler}")
445
+
446
+ scaler = scaler_dict[scaler]
447
+
414
448
  if scaler:
415
- df = scale_dataframe(df, scaler=scaler)
449
+ if groupby:
450
+ groupby_cols = groupby + [column]
451
+ df_meta[var_name] = df_meta.groupby(groupby_cols)[var_name].transform(lambda x: self._scale_group(x, scaler))
452
+ else:
453
+ df_meta[var_name] = df_meta.groupby(column)[var_name].transform(lambda x: self._scale_group(x, scaler))
454
+
455
+ df = pd.pivot_table(
456
+ df_meta,
457
+ index=index,
458
+ columns=column,
459
+ values=var_name,
460
+ aggfunc=aggfunc,
461
+ ).astype(np.float64)
416
462
  return df
417
-
463
+
418
464
  @property
419
465
  def progress(self):
420
466
  """
@@ -564,3 +610,9 @@ class Mint(object):
564
610
  elif str(fn).endswith('.parquet'):
565
611
  self.meta.to_parquet(fn)
566
612
  return self
613
+
614
+ def _scale_group(self, group, scaler):
615
+ """
616
+ Helper function to scale groups individually.
617
+ """
618
+ return scaler.fit_transform(group.to_numpy().reshape(-1, 1)).flatten()
@@ -1,12 +1,16 @@
1
1
  import numpy as np
2
2
  import seaborn as sns
3
+ import warnings
3
4
 
4
- from warnings import simplefilter
5
5
  from scipy.cluster.hierarchy import ClusterWarning
6
6
 
7
7
  from pathlib import Path as P
8
+
9
+ import matplotlib
8
10
  from matplotlib import pyplot as plt
9
11
 
12
+ from typing import Optional, List, Tuple
13
+
10
14
  from .plotly_tools import plotly_heatmap, plotly_peak_shapes
11
15
  from .matplotlib_tools import (
12
16
  plot_peak_shapes,
@@ -14,6 +18,7 @@ from .matplotlib_tools import (
14
18
  plot_metabolomics_hist2d,
15
19
  )
16
20
 
21
+ import pandas as pd
17
22
  import plotly.express as px
18
23
 
19
24
  from .tools import scale_dataframe, mz_mean_width_to_min_max
@@ -36,103 +41,71 @@ class MintPlotter:
36
41
  :type mint: ms_mint.Mint.Mint
37
42
  """
38
43
  self.mint = mint
39
-
44
+
45
+
40
46
  def hierarchical_clustering(
41
47
  self,
42
- data=None,
43
- peak_labels=None,
44
- ms_files=None,
45
- title=None,
46
- figsize=(8, 8),
47
- targets_var="peak_max",
48
- vmin=-3,
49
- vmax=3,
50
- xmaxticks=None,
51
- ymaxticks=None,
52
- transform_func="log2p1",
53
- scaler_ms_file=None,
54
- scaler_peak_label="standard",
55
- metric="cosine",
56
- transform_filenames_func="basename",
57
- transposed=False,
48
+ data: Optional[pd.DataFrame] = None,
49
+ peak_labels: Optional[List[str]] = None,
50
+ ms_files: Optional[List[str]] = None,
51
+ title: Optional[str] = None,
52
+ figsize: Tuple[int, int] = (8, 8),
53
+ targets_var: Optional[str] = None,
54
+ var_name: str = "peak_max",
55
+ vmin: int = -3,
56
+ vmax: int = 3,
57
+ xmaxticks: Optional[int] = None,
58
+ ymaxticks: Optional[int] = None,
59
+ apply: str = "log2p1",
60
+ metric: str = "cosine",
61
+ scaler: str = "standard",
62
+ groupby: Optional[str] = None,
63
+ transposed: bool = False,
58
64
  **kwargs,
59
- ):
65
+ ) -> matplotlib.figure.Figure:
60
66
  """
61
67
  Performs a cluster analysis and plots a heatmap. If no data is provided,
62
- data is taken form self.mint.crosstab(targets_var).
68
+ data is taken from self.mint.crosstab(var_name).
63
69
  The clustered non-transformed non-scaled data is stored in `self.mint.clustered`.
64
70
 
65
- :param transform_func: default 'log2p1', values: [None, 'log1p', 'log2p1', 'log10p1']
66
- - None: no transformation
67
- - log1p: tranform data with lambda x: np.log1p(x)
68
- - log2p1: transform data with lambda x: log2(x+1)
69
- - log10p1: transform data with lambda x: log10(x+1)
70
-
71
- :param scaler_ms_file: default None, values: [None, 'standard', 'robust']
72
- - scaler used to scale along ms_file axis
73
- - if None no scaling is applied
74
- - if 'standard' use scikit learn StandardScaler()
75
- - if 'robust' use scikit learn RobustScaler()
76
-
77
- :param scaler_peak_label: default 'standard'
78
- - like scaler_ms_file, but scaling along peak_label axis
79
-
80
- :param metric: default 'cosine', can be string or a list of two values:
81
- if two values are provided e.g. ('cosine', 'euclidean') the first
82
- will be used to cluster the x-axis and the second for the y-axis.
83
-
84
- 'braycurtis', 'canberra', 'chebyshev', 'cityblock', 'correlation', 'cosine',
85
- 'dice', 'euclidean', 'hamming', 'jaccard', 'jensenshannon', 'kulsinski', 'mahalanobis',
86
- 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean',
87
- 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule'.
88
- More information:
89
- https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.pdist.html
90
-
91
- :param transpose: bool, default False
92
- - True: transpose the figure
93
- """
94
- if len(self.mint.results) == 0:
95
- return None
71
+ :param data: DataFrame with data to be used for clustering. If None, crosstab of mint instance is used.
72
+ :type data: pandas.DataFrame, optional
96
73
 
97
- simplefilter("ignore", ClusterWarning)
98
- if data is None:
99
- data = self.mint.crosstab(targets_var).copy()
74
+ :param var_name: Name of the column from data to be used for cell values in the heatmap. Defaults to "peak_max".
75
+ :type var_name: str
100
76
 
101
- if peak_labels is not None:
102
- data = data[peak_labels]
77
+ :param apply: Transformation to be applied on the data. Can be "log1p", "log2p1", "log10p1" or None. Defaults to "log2p1".
78
+ :type apply: str, optional
79
+
80
+ :param scaler: Method to scale data along both axes. Can be "standard", "robust" or None. Defaults to "standard".
81
+ :type scaler: str, optional
103
82
 
104
- if ms_files is not None:
105
- data = data.loc[ms_files]
83
+ :param groupby: Name of the column to group data before scaling. If None, scaling is applied to the whole data, not group-wise.
84
+ :type groupby: str, optional
106
85
 
107
- tmp_data = data.copy()
86
+ :param metric: The distance metric to use for the tree. Can be any metric supported by scipy.spatial.distance.pdist.
87
+ :type metric: str, optional
108
88
 
109
- if transform_func == "log1p":
110
- transform_func = np.log1p
111
- if transform_func == "log2p1":
112
- transform_func = lambda x: np.log2(x + 1)
113
- if transform_func == "log10p1":
114
- transform_func = lambda x: np.log10(x + 1)
115
- if transform_func is not None:
116
- tmp_data = tmp_data.apply(transform_func)
89
+ :param transposed: Whether to transpose the figure or not. Defaults to False.
90
+ :type transposed: bool, optional
117
91
 
118
- if transform_filenames_func == "basename":
119
- transform_filenames_func = lambda x: P(x).with_suffix("").name
120
- if transform_filenames_func is not None:
121
- tmp_data.index = [transform_filenames_func(i) for i in tmp_data.index]
92
+ :return: Matplotlib figure representing the clustered heatmap.
93
+ :rtype: matplotlib.figure.Figure
94
+ """
122
95
 
123
- # Scale along ms-files
124
- if scaler_ms_file is not None:
125
- tmp_data = scale_dataframe(tmp_data.T, scaler_ms_file).T
96
+ if targets_var is not None:
97
+ warnings.warn("targets_var is depricated use var_name instead", DeprecationWarning)
98
+ var_name = targets_var
126
99
 
127
- # Scale along peak_labels
128
- if scaler_peak_label is not None:
129
- tmp_data = scale_dataframe(tmp_data, scaler_peak_label)
100
+ warnings.simplefilter("ignore", ClusterWarning)
101
+ if data is None:
102
+ data = self.mint.crosstab(var_name=var_name, apply=apply, scaler=scaler, groupby=groupby)
130
103
 
131
104
  if transposed:
132
- tmp_data = tmp_data.T
105
+ data = data.T
133
106
 
134
107
  _, fig, ndx_x, ndx_y = hierarchical_clustering(
135
- tmp_data,
108
+ data,
136
109
  vmin=vmin,
137
110
  vmax=vmax,
138
111
  figsize=figsize,
@@ -142,10 +115,8 @@ class MintPlotter:
142
115
  **kwargs,
143
116
  )
144
117
 
145
- if not transposed:
146
- self.mint.clustered = data.iloc[ndx_x, ndx_y]
147
- else:
148
- self.mint.clustered = data.iloc[ndx_y, ndx_x]
118
+ self.mint.clustered = data.iloc[ndx_x, ndx_y]
119
+
149
120
  return fig
150
121
 
151
122
 
@@ -162,11 +133,11 @@ class MintPlotter:
162
133
  if len(self.mint.results) > 0:
163
134
  if not interactive:
164
135
  return plot_peak_shapes(
165
- self.mint.results, fns=fns, peak_labels=peak_labels, **kwargs
136
+ self.mint.results, mint_metadata=self.mint.meta, fns=fns, peak_labels=peak_labels, **kwargs
166
137
  )
167
138
  else:
168
139
  return plotly_peak_shapes(
169
- self.mint.results, fns=fns, peak_labels=peak_labels, **kwargs
140
+ self.mint.results, mint_metadata=self.mint.meta, fns=fns, peak_labels=peak_labels, **kwargs
170
141
  )
171
142
 
172
143
  def heatmap(
@@ -8,11 +8,11 @@ import json
8
8
 
9
9
  version_json = '''
10
10
  {
11
- "date": "2023-07-12T09:44:18-0600",
11
+ "date": "2023-08-18T12:58:02-0600",
12
12
  "dirty": false,
13
13
  "error": null,
14
- "full-revisionid": "7cbe79c73d391939c5b0c475118bd3f68f274928",
15
- "version": "v0.3.0"
14
+ "full-revisionid": "2563246318a0e00988500da34daed80721f81b98",
15
+ "version": "v0.3.2"
16
16
  }
17
17
  ''' # END VERSION_JSON
18
18
 
@@ -64,7 +64,10 @@ def ms_file_to_df(fn, read_only: bool = False):
64
64
  except IndexError as e:
65
65
  logging.warning(f"{e}: {fn}")
66
66
  return None
67
- if not read_only:
67
+
68
+ if read_only:
69
+ return df
70
+ else:
68
71
  # Compatibility with old schema
69
72
  df = df.rename(
70
73
  columns={
@@ -73,9 +76,12 @@ def ms_file_to_df(fn, read_only: bool = False):
73
76
  "m/z array": "mz",
74
77
  }
75
78
  )
79
+ if 'scan_id' not in df.columns:
80
+ df['scan_id'] = 0
81
+ if 'ms_level' not in df.columns:
82
+ df['ms_level'] = 1
76
83
  # Set datatypes
77
84
  set_dtypes(df)
78
- print(df.columns)
79
85
  return df
80
86
 
81
87
 
@@ -130,17 +130,19 @@ def hierarchical_clustering(
130
130
 
131
131
  def plot_peak_shapes(
132
132
  mint_results,
133
+ mint_metadata=None,
133
134
  fns=None,
134
135
  peak_labels=None,
135
136
  height=3,
136
137
  aspect=1.5,
137
138
  legend=False,
138
139
  col_wrap=4,
139
- hue="ms_file",
140
+ hue="ms_file_label",
140
141
  title=None,
141
142
  dpi=None,
142
143
  sharex=False,
143
144
  sharey=False,
145
+ kind='line',
144
146
  **kwargs,
145
147
  ):
146
148
  """
@@ -148,6 +150,8 @@ def plot_peak_shapes(
148
150
 
149
151
  :param mint_results: DataFrame in Mint results format.
150
152
  :type mint_results: pandas.DataFrame
153
+ :param mint_metadata: DataFrame in Mint metadata format.
154
+ :type mint_metadata: pandas.DataFrame
151
155
  :param fns: Filenames to include, defaults to None
152
156
  :type fns: list, optional
153
157
  :param peak_labels: Peak-labels to include, defaults to None
@@ -170,6 +174,8 @@ def plot_peak_shapes(
170
174
  :type sharex: bool, optional
171
175
  :param sharey: Whether or not to share y-axis range between subplots, defaults to False
172
176
  :type sharey: bool, optional
177
+ :param kind: Kind of seaborn relplot
178
+ :type kind: str, optional
173
179
  :return: Generated figure object.
174
180
  :rtype: matplotlib.pyplot.Figure
175
181
  """
@@ -197,7 +203,7 @@ def plot_peak_shapes(
197
203
  ].iterrows():
198
204
  peak_rt = [float(i) for i in row.peak_shape_rt.split(",")]
199
205
  peak_int = [float(i) for i in row.peak_shape_int.split(",")]
200
- ms_file = row.ms_file
206
+ ms_file_label = row.ms_file_label
201
207
  mz = row.mz_mean
202
208
  rt = row.rt
203
209
 
@@ -205,7 +211,7 @@ def plot_peak_shapes(
205
211
  {
206
212
  "Scan time [s]": peak_rt,
207
213
  "Intensity": peak_int,
208
- "ms_file": ms_file,
214
+ "ms_file_label": ms_file_label,
209
215
  "peak_label": peak_label + f"\nm/z={mz:.3f}",
210
216
  "Expected Scan time [s]": rt,
211
217
  }
@@ -214,13 +220,17 @@ def plot_peak_shapes(
214
220
 
215
221
  df = pd.concat(dfs).reset_index(drop=True)
216
222
 
223
+ # Add metadata
224
+ if mint_metadata is not None:
225
+ df = pd.merge(df, mint_metadata, left_on='ms_file_label', right_index=True)
226
+
217
227
  g = sns.relplot(
218
228
  data=df,
219
229
  x="Scan time [s]",
220
230
  y="Intensity",
221
231
  hue=hue,
222
232
  col="peak_label",
223
- kind="line",
233
+ kind=kind,
224
234
  col_wrap=col_wrap,
225
235
  height=height,
226
236
  aspect=aspect,
@@ -2,6 +2,8 @@ import numpy as np
2
2
  import pandas as pd
3
3
  import matplotlib.pyplot as plt
4
4
  import seaborn as sns
5
+ import warnings
6
+
5
7
  import plotly.figure_factory as ff
6
8
  from plotly import express as px
7
9
 
@@ -25,7 +27,7 @@ class PrincipalComponentsAnalyser:
25
27
  self.results = None
26
28
  self.plot = PCA_Plotter(self)
27
29
 
28
- def run(self, n_components=3, on="peak_max", fillna="median", scaler="standard"):
30
+ def run(self, n_components=3, on=None, var_name="peak_max", fillna="median", apply=None, groupby=None, scaler="standard"):
29
31
  """
30
32
  Run Principal Component Analysis on current results. Results are stored in
31
33
  self.decomposition_results.
@@ -39,8 +41,12 @@ class PrincipalComponentsAnalyser:
39
41
  :param scaler: Method to scale the columns, defaults to "standard"
40
42
  :type scaler: str, optional
41
43
  """
42
-
43
- df = self.mint.crosstab(on).fillna(fillna)
44
+
45
+ if on is not None:
46
+ warnings.warn("on is depricated use var_name instead", DeprecationWarning)
47
+ var_name = on
48
+
49
+ df = self.mint.crosstab(var_name=var_name, apply=apply, scaler=scaler, groupby=groupby)
44
50
 
45
51
  if fillna == "median":
46
52
  fillna = df.median()
@@ -50,8 +56,6 @@ class PrincipalComponentsAnalyser:
50
56
  fillna = 0
51
57
 
52
58
  df = df.fillna(fillna)
53
- if scaler is not None:
54
- df = scale_dataframe(df, scaler)
55
59
 
56
60
  min_dim = min(df.shape)
57
61
  n_components = min(n_components, min_dim)
@@ -1,6 +1,7 @@
1
1
  import logging
2
2
 
3
3
  import numpy as np
4
+ import pandas as pd
4
5
  import colorlover as cl
5
6
 
6
7
  import plotly.graph_objects as go
@@ -222,6 +223,8 @@ def plotly_heatmap(
222
223
 
223
224
  def plotly_peak_shapes(
224
225
  mint_results,
226
+ mint_metadata=None,
227
+ color='ms_file_label', # Add the new argument for specifying color column
225
228
  fns=None,
226
229
  col_wrap=1,
227
230
  peak_labels=None,
@@ -229,52 +232,90 @@ def plotly_peak_shapes(
229
232
  verbose=False,
230
233
  legend_orientation="v",
231
234
  call_show=False,
235
+ palette='Plasma',
232
236
  ):
233
- """
234
- Returns a plotly multiplost of all peak_shapes in mint.results
235
- grouped by peak_label.
237
+ """
238
+ Plot peak shapes of mint results.
239
+
240
+ :param mint_results: DataFrame in Mint results format.
241
+ :type mint_results: pandas.DataFrame
242
+ :param mint_metadata: DataFrame in Mint metadata format, defaults to None.
243
+ :type mint_metadata: pandas.DataFrame, optional
244
+ :param color: Column name determining color-coding of plots, defaults to 'ms_file_label'.
245
+ :type color: str, optional
246
+ :param fns: Filenames to include, defaults to None.
247
+ :type fns: list, optional
248
+ :param col_wrap: Maximum number of subplot columns, defaults to 1.
249
+ :type col_wrap: int, optional
250
+ :param peak_labels: Peak-labels to include, defaults to None.
251
+ :type peak_labels: list, optional
252
+ :param legend: Whether to display legend, defaults to True.
253
+ :type legend: bool, optional
254
+ :param verbose: If True, prints additional details, defaults to False.
255
+ :type verbose: bool, optional
256
+ :param legend_orientation: Legend orientation, defaults to 'v'.
257
+ :type legend_orientation: str, optional
258
+ :param call_show: If True, displays the plot immediately, defaults to False.
259
+ :type call_show: bool, optional
260
+ :param palette: Color palette to use, defaults to 'Plasma'.
261
+ :type palette: str, optional
262
+
263
+ :return: Plotly Figure object or None if call_show is True.
264
+ :rtype: plotly.graph_objs._figure.Figure or None
236
265
  """
237
266
  mint_results = mint_results.copy()
238
267
 
268
+ # Merge with metadata if provided
269
+ if mint_metadata is not None:
270
+ mint_results = pd.merge(mint_results, mint_metadata, left_on='ms_file_label', right_index=True)
239
271
 
272
+ # Filter by filenames
240
273
  if fns is not None:
241
274
  fns = [fn_to_label(fn) for fn in fns]
242
275
  mint_results = mint_results[mint_results.ms_file_label.isin(fns)]
276
+ else:
277
+ fns = mint_results.ms_file_label.unique()
278
+
279
+ # Filter by peak_labels
280
+ if peak_labels is not None:
281
+ if isinstance(peak_labels, str):
282
+ peak_labels = [peak_labels]
283
+ mint_results = mint_results[mint_results.peak_label.isin(peak_labels)]
284
+ else:
285
+ peak_labels = mint_results.results.peak_label.unique()
286
+
287
+ # Handle colors based on metadata or fall back to default behavior
288
+ colors = None
289
+ if color:
290
+ unique_hues = mint_results[color].unique()
291
+
292
+ colors = get_palette_colors(palette, len(unique_hues))
293
+
294
+ color_mapping = dict(zip(unique_hues, colors))
295
+
296
+ if color == 'ms_file_label':
297
+ hue_column = [color_mapping[fn] for fn in fns]
298
+ else:
299
+ # Existing logic remains the same for the else part
300
+ hue_column = mint_results.drop_duplicates('ms_file_label').set_index('ms_file_label')[color].map(color_mapping).reindex(fns).tolist()
243
301
 
244
- mint_results.ms_file = [P(fn).name for fn in mint_results.ms_file]
245
-
246
- logging.warning("TEST")
302
+ else:
303
+ hue_column = colors
247
304
 
305
+ # Rest of the plotting process
248
306
  res = mint_results[mint_results.peak_max > 0]
249
-
250
- fns = res.ms_file_label.unique()
251
307
  labels = mint_results.peak_label.unique()
252
-
253
308
  res = res.set_index(["peak_label", "ms_file_label"]).sort_index()
254
309
 
255
- if isinstance(peak_labels, str):
256
- peak_labels = [peak_labels]
257
-
258
- # Calculate neccessary number of rows
310
+ # Calculate necessary number of rows
259
311
  n_rows = max(1, len(labels) // col_wrap)
260
312
  if n_rows * col_wrap < len(labels):
261
313
  n_rows += 1
262
314
 
263
- if verbose:
264
- print(n_rows, col_wrap)
265
- print("ms_files:", fns)
266
- print("peak_labels:", peak_labels)
267
- print("Data:", res)
268
-
269
315
  fig = make_subplots(
270
316
  rows=max(1, n_rows), cols=max(1, col_wrap), subplot_titles=peak_labels
271
317
  )
272
- if len(fns) < 13:
273
- colors = cl.scales["12"]["qual"]["Paired"]
274
- else:
275
- colors = cl.interp(cl.scales["12"]["qual"]["Paired"], len(fns))
276
318
 
277
- # Create sub-plots
278
319
  for label_i, label in enumerate(peak_labels):
279
320
  for file_i, fn in enumerate(fns):
280
321
  try:
@@ -282,9 +323,9 @@ def plotly_peak_shapes(
282
323
  except KeyError as e:
283
324
  logging.warning(e)
284
325
  continue
326
+
285
327
  if not isinstance(x, Iterable):
286
328
  continue
287
-
288
329
  if isinstance(x, str):
289
330
  x = x.split(",")
290
331
  y = y.split(",")
@@ -297,6 +338,8 @@ def plotly_peak_shapes(
297
338
  else:
298
339
  mode = "lines"
299
340
 
341
+ trace_color = trace_color = hue_column[file_i]
342
+
300
343
  fig.add_trace(
301
344
  go.Scatter(
302
345
  x=x,
@@ -305,7 +348,7 @@ def plotly_peak_shapes(
305
348
  mode=mode,
306
349
  legendgroup=file_i,
307
350
  showlegend=(label_i == 0),
308
- marker_color=colors[file_i],
351
+ marker_color=trace_color,
309
352
  text=fn,
310
353
  ),
311
354
  row=ndx_r,
@@ -315,10 +358,10 @@ def plotly_peak_shapes(
315
358
  fig.update_xaxes(title_text="Scan time [s]", row=ndx_r, col=ndx_c)
316
359
  fig.update_yaxes(title_text="Intensity", row=ndx_r, col=ndx_c)
317
360
 
318
- # Layout
361
+ # Layout updates
319
362
  if legend:
320
363
  fig.update_layout(legend_orientation=legend_orientation)
321
-
364
+
322
365
  fig.update_layout(showlegend=legend)
323
366
  fig.update_layout(height=400 * n_rows, title_text="Peak Shapes")
324
367
 
@@ -326,3 +369,17 @@ def plotly_peak_shapes(
326
369
  fig.show(config={"displaylogo": False})
327
370
  else:
328
371
  return fig
372
+
373
+
374
+ def get_palette_colors(palette_name, num_colors):
375
+ # Categories in the colorlover package
376
+ categories = ["qual", "seq", "div"]
377
+
378
+ num_colors = max(num_colors, 3)
379
+ # Check in which category our palette resides
380
+ for category in categories:
381
+ if palette_name in cl.scales[f"{num_colors}"][category]:
382
+ return cl.scales[f"{num_colors}"][category][palette_name]
383
+
384
+ # If palette not found in any category, return a default one or raise an error
385
+ return cl.scales[f"{num_colors}"]["qual"]["Paired"]
@@ -89,7 +89,7 @@ def process_ms1_file(filename, targets):
89
89
  results["ms_file"] = filename
90
90
  results["ms_file_label"] = P(filename).with_suffix('').name
91
91
  results["ms_file_size_MB"] = os.path.getsize(filename) / 1024 / 1024
92
- results["peak_score"] = score_peaks(results)
92
+ results["peak_score"] = 0 # score_peaks(results)
93
93
  return results[MINT_RESULTS_COLUMNS]
94
94
 
95
95
 
@@ -58,4 +58,18 @@ DEPRECATED_LABELS = {
58
58
  "ms_file_size": "ms_file_size_MB",
59
59
  }
60
60
 
61
+ MINT_METADATA_COLUMNS = [
62
+ 'ms_file_label',
63
+ 'label',
64
+ 'group',
65
+ 'batch',
66
+ 'sample_type',
67
+ 'run_order',
68
+ 'plate',
69
+ 'plate_row',
70
+ 'plate_col',
71
+ 'lc_column',
72
+ 'polarity'
73
+ ]
74
+
61
75
  M_PROTON = 1.00782503223
@@ -8,11 +8,15 @@ from molmass import Formula, FormulaError
8
8
  from sklearn.preprocessing import MinMaxScaler, StandardScaler, RobustScaler
9
9
  from scipy.signal import find_peaks, peak_widths
10
10
 
11
- from .standards import M_PROTON, TARGETS_COLUMNS
11
+ from .standards import M_PROTON, TARGETS_COLUMNS, MINT_METADATA_COLUMNS
12
12
  from .filelock import FileLock
13
13
  from .matplotlib_tools import plot_peaks
14
14
 
15
15
 
16
+ def log2p1(x):
17
+ return np.log2(x+1)
18
+
19
+
16
20
  def lock(fn):
17
21
  """
18
22
  File lock to ensure safe writing to file.
@@ -226,18 +230,9 @@ def mz_mean_width_to_min_max(mz_mean, mz_width):
226
230
  mz_max = mz_mean + delta_mass
227
231
  return mz_min, mz_max
228
232
 
233
+
229
234
  def init_metadata():
230
- cols = [
231
- 'ms_file_label',
232
- 'ms_file',
233
- 'label',
234
- 'group',
235
- 'type',
236
- 'run_order',
237
- 'plate',
238
- 'plate_row',
239
- 'plate_col'
240
- ]
235
+ cols = MINT_METADATA_COLUMNS
241
236
  return pd.DataFrame(columns=cols).set_index('ms_file_label')
242
237
 
243
238
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ms-mint
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: Metabolomics Integrator (Mint)
5
5
  Home-page: https://github.com/LewisResearchGroup/ms-mint
6
6
  Author: Soren Wacker
@@ -15,6 +15,8 @@ License-File: LICENSE
15
15
  [![Python package](https://github.com/LewisResearchGroup/ms-mint/actions/workflows/pythonpackage.yml/badge.svg)](https://github.com/LewisResearchGroup/ms-mint/actions/workflows/pythonpackage.yml)
16
16
  ![](https://github.com/LewisResearchGroup/ms-mint/blob/develop/images/coverage.svg)
17
17
  [![CodeQL](https://github.com/lewisresearchgroup/ms-mint/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/lewisresearchgroup/ms-mint/actions/workflows/codeql-analysis.yml)
18
+ ![PyPI](https://img.shields.io/pypi/v/ms-mint?label=pypi%20package)
19
+ ![PyPI - Downloads](https://img.shields.io/pypi/dm/ms-mint)
18
20
 
19
21
  # Wecome to ms-mint
20
22
 
@@ -136,7 +138,7 @@ If you only have retention time (Rt) values for your targets, or if the Rt value
136
138
 
137
139
  To use the `mint.opt.rt_min_max()` function, you will need to provide it with a list of retention times for your targets and the names of the mass spectrometry files containing your data. The function will then search through the data to find the optimal `rt_min` and `rt_max` values, which you can use to refine your analysis. You can then use these optimized values in conjunction with the other functions and methods of the `Mint` class to process and analyze your data.
138
140
 
139
- ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/peak-shapes-before-opt.png)
141
+ ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/img/peak-shapes-before-opt.png)
140
142
 
141
143
  Now, we can run the peak optimization with:
142
144
 
@@ -153,7 +155,7 @@ If you do not provide a list of peak_labels to the `mint.opt.rt_min_max()` funct
153
155
 
154
156
  After running the optimization, it is a good idea to perform a manual fine-tuning of the `rt_min` and `rt_max` values, especially for complicated peaks (peaks with multiple components, noisy peaks, etc.). You can use the `mint.plot.peak_shapes()` function to visualize the peak shapes and identify any areas that may require further attention.
155
157
 
156
- ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/optimize-rt_min_max.png)
158
+ ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/img/optimize-rt_min_max.png)
157
159
 
158
160
  The black lines indicates the average intensity across all files used for the optimization. The orange dotted lines show the shape of the gaussian function used to weight the mean intensities for peak selection. The orange horizontal lines indicate the peak width and the blue `x`s show the identified peak maxima. The green shaded areas show the Rt ranges which were selected by the algorithm.
159
161
 
@@ -162,7 +164,7 @@ Then we apply the changes and plot the new peak shapes:
162
164
  mint.run()
163
165
  mint.plot.peak_shapes(col_wrap=3)
164
166
 
165
- ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/peak-shapes-after-opt.png)
167
+ ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/img/peak-shapes-after-opt.png)
166
168
 
167
169
  As you can see, the shapes of Xanthine, Succinate, Citrulline look much better.
168
170
 
@@ -172,7 +174,7 @@ The `Mint` class has a few convenient methods to visualize and explore the proce
172
174
 
173
175
  ## Plot peak shapes
174
176
 
175
- ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/peak-shapes-after-opt.png)
177
+ ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/img/peak-shapes-after-opt.png)
176
178
 
177
179
  mint.plot.peak_shapes(col_wrap = 3)
178
180
 
@@ -207,7 +209,7 @@ Before clustering the data can be transformed and scaled. By default `log2p1(x)
207
209
  cmap=None # Name of a matplotlib color map
208
210
  )
209
211
 
210
- ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/hierarchical_clustering.png)
212
+ ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/img/hierarchical_clustering.png)
211
213
 
212
214
  ## Principal Components Analysis
213
215
 
@@ -221,7 +223,7 @@ After running the PCA the results can be plotted with:
221
223
 
222
224
  mint.pca.plot.pairplot(n_components=5, interactive=False)
223
225
 
224
- ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/pca-pairplot.png)
226
+ ![](https://raw.githubusercontent.com/LewisResearchGroup/ms-mint/develop/notebooks/img/pca-pairplot.png)
225
227
 
226
228
  ## FAQ
227
229
  ### What is a target list
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes