From 19120a9ea7ec552029cfb27269f45fa888fbd1f3 Mon Sep 17 00:00:00 2001 From: Soren Wacker Date: Thu, 9 Feb 2023 14:57:15 -0700 Subject: [PATCH] .. --- README.md | 3 ++- images/coverage.svg | 4 ++-- ms_mint/Mint.py | 6 +++--- ms_mint/pca.py | 7 ++++++- ms_mint/plotting.py | 4 ---- tests/test__integration.py | 2 +- tests/test__targets.py | 2 +- 7 files changed, 15 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 124632e2..f8206961 100644 --- a/README.md +++ b/README.md @@ -256,5 +256,6 @@ The target list can be stored as csv or Excel file. # Release Notes -## 0.1.9 Milestones +## 0.2.0 Milestones - peak_area_top3 comparable to El-Maven PeakAreaTop values + diff --git a/images/coverage.svg b/images/coverage.svg index 5b40c8fe..4b105c68 100644 --- a/images/coverage.svg +++ b/images/coverage.svg @@ -15,7 +15,7 @@ coverage coverage - 83% - 83% + 82% + 82% diff --git a/ms_mint/Mint.py b/ms_mint/Mint.py index 6690adea..5de07afc 100644 --- a/ms_mint/Mint.py +++ b/ms_mint/Mint.py @@ -22,7 +22,7 @@ ) from .pca import PrincipalComponentsAnalyser from .plotting import MintPlotter -from .filter import Resampler +#from .filter import Resampler from .chromatogram import Chromatogram, extract_chromatogram_from_ms1 import ms_mint @@ -497,9 +497,8 @@ def get_chromatograms(self, fns=None, peak_label=None, **kwargs): if peak_label is None: peak_label = self.peak_labels - resampler = Resampler() - data = [] + for fn in self.tqdm(fns): df = ms_file_to_df(fn) for label in peak_label: @@ -515,6 +514,7 @@ def get_chromatograms(self, fns=None, peak_label=None, **kwargs): chrom_data["rt_min"] = rt_min chrom_data["rt_max"] = rt_min data.append(chrom_data) + data = pd.concat(data).reset_index() data["ms_file"] = data["ms_file"].apply(lambda x: P(x).with_suffix("").name) diff --git a/ms_mint/pca.py b/ms_mint/pca.py index f29f7b78..8b18a3b8 100644 --- a/ms_mint/pca.py +++ b/ms_mint/pca.py @@ -110,7 +110,12 @@ def cumulative_variance(self, height=4, aspect=2): n_components = self.pca.results["n_components"] fig = plt.figure(figsize=(height * aspect, height)) cum_expl_var = self.pca.results["cum_expl_var"] - plt.bar(np.arange(n_components) + 1, cum_expl_var, facecolor="grey", edgecolor="none") + plt.bar( + np.arange(n_components) + 1, + cum_expl_var, + facecolor="grey", + edgecolor="none", + ) plt.xlabel("Principal Component") plt.ylabel("Explained variance [%]") plt.title("Cumulative explained variance") diff --git a/ms_mint/plotting.py b/ms_mint/plotting.py index dc17b513..88ca05fb 100644 --- a/ms_mint/plotting.py +++ b/ms_mint/plotting.py @@ -1,6 +1,5 @@ import numpy as np import seaborn as sns -import pandas as pd from warnings import simplefilter from scipy.cluster.hierarchy import ClusterWarning @@ -15,11 +14,8 @@ plot_metabolomics_hist2d, ) -from tqdm import tqdm - import plotly.express as px -from .filter import Resampler from .tools import scale_dataframe, mz_mean_width_to_min_max from .io import ms_file_to_df diff --git a/tests/test__integration.py b/tests/test__integration.py index 467a7c82..603e3f38 100644 --- a/tests/test__integration.py +++ b/tests/test__integration.py @@ -107,7 +107,7 @@ def test__optimize_min_max(): mint.targets["rt_max"] = None print("Before") print(mint.targets[["rt", "rt_min", "rt_max"]]) - result = mint.opt.rt_min_max() + mint.opt.rt_min_max() print("After") print(mint.targets[["rt", "rt_min", "rt_max"]]) n_missing_values_in_rt_cols = mint.targets[["rt_min", "rt_max"]].isna().sum().sum() diff --git a/tests/test__targets.py b/tests/test__targets.py index 0b191496..1764a6ec 100644 --- a/tests/test__targets.py +++ b/tests/test__targets.py @@ -19,7 +19,7 @@ from paths import ( # TEST_TARGETS_FN_V2_CSV_SEC, - TEST_TARGETS_FN_V0_XLSX, + #TEST_TARGETS_FN_V0_XLSX, TEST_TARGETS_FN_V0, TEST_TARGETS_FN_V1, )