quantion 0.1.6__py3-none-win_amd64.whl

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.
quantion/__init__.py ADDED
@@ -0,0 +1,156 @@
1
+ from __future__ import annotations
2
+
3
+ from quantion._bridge import _ABI, load_library
4
+ from quantion import api as _api
5
+ from quantion.api import (
6
+ parse_mzml,
7
+ parse_ion,
8
+ ion_to_mzml,
9
+ mzml_to_ion,
10
+ mzml_to_ion_file,
11
+ calculate_eic,
12
+ get_scans,
13
+ find_peaks,
14
+ get_peak,
15
+ fit_peak,
16
+ draw_peak,
17
+ find_noise_level,
18
+ calculate_baseline,
19
+ get_peaks_from_eic,
20
+ get_peaks_from_chrom,
21
+ find_features,
22
+ find_feature,
23
+ get_features,
24
+ load_model,
25
+ load_warp,
26
+ )
27
+ from quantion.file import SampleFile
28
+ from quantion.model import Model
29
+ from quantion.warp_model import WarpModel
30
+ from quantion._pack import pack_peak_options, encode_target_ids, unpack_targets
31
+ from quantion._shared import to_cores
32
+ from quantion._types import FromTo, GroupedFeature, Feature, Peak, Target, TargetPeak
33
+
34
+ __version__ = "0.1.6"
35
+
36
+ __all__ = [
37
+ "Quantion",
38
+ "parse_mzml",
39
+ "parse_ion",
40
+ "ion_to_mzml",
41
+ "mzml_to_ion",
42
+ "mzml_to_ion_file",
43
+ "calculate_eic",
44
+ "get_scans",
45
+ "find_peaks",
46
+ "get_peak",
47
+ "fit_peak",
48
+ "draw_peak",
49
+ "find_noise_level",
50
+ "calculate_baseline",
51
+ "get_peaks_from_eic",
52
+ "get_peaks_from_chrom",
53
+ "find_features",
54
+ "find_feature",
55
+ "get_features",
56
+ "SampleFile",
57
+ "load_model",
58
+ "load_warp",
59
+ "Model",
60
+ "WarpModel",
61
+ "FromTo",
62
+ "Target",
63
+ "Peak",
64
+ "TargetPeak",
65
+ "Feature",
66
+ "GroupedFeature",
67
+ "pack_peak_options",
68
+ "encode_target_ids",
69
+ "unpack_targets",
70
+ "to_cores",
71
+ ]
72
+
73
+
74
+ class Quantion:
75
+ def __init__(self, abi: _ABI) -> None:
76
+ self._abi = abi
77
+ _api._set_abi(abi)
78
+
79
+ def parse_mzml(self, data: bytes) -> SampleFile:
80
+ return parse_mzml(data)
81
+
82
+ def parse_ion(self, source, max_cache_size: int = 0) -> SampleFile:
83
+ return parse_ion(source, max_cache_size)
84
+
85
+ def ion_to_mzml(self, file: SampleFile) -> str:
86
+ return ion_to_mzml(file)
87
+
88
+ def mzml_to_ion(self, file: SampleFile, level: int = 12, f32_compress: bool = False) -> bytes:
89
+ return mzml_to_ion(file, level, f32_compress)
90
+
91
+ def mzml_to_ion_file(self, input_path: str, output_path: str, level: int = 12, f32_compress: bool = False) -> None:
92
+ return mzml_to_ion_file(input_path, output_path, level, f32_compress)
93
+
94
+ def calculate_eic(self, file: SampleFile, target_mz: float, from_to: FromTo, ppm_tol: float = 20.0, mz_tol: float = 0.005):
95
+ return calculate_eic(file, target_mz, from_to, ppm_tol, mz_tol)
96
+
97
+ def get_scans(self, file: SampleFile, *, rt_range=None, rt=None, mz_range=None, mz=None, level: int = 1):
98
+ return get_scans(file, rt_range=rt_range, rt=rt, mz_range=mz_range, mz=mz, level=level)
99
+
100
+ def find_peaks(self, x, y, options=None):
101
+ return find_peaks(x, y, options)
102
+
103
+ def get_peak(self, x, y, rt: float, range: float, options=None):
104
+ return get_peak(x, y, rt, range, options)
105
+
106
+ def fit_peak(self, x, y, rt: float, intensity: float, shape: str = "emg"):
107
+ return fit_peak(x, y, rt, intensity, shape)
108
+
109
+ def draw_peak(self, x, params):
110
+ return draw_peak(x, params)
111
+
112
+ def find_noise_level(self, y) -> dict:
113
+ return find_noise_level(y)
114
+
115
+ def calculate_baseline(self, y, lambda_: int = 0, max_iterations: int = 0):
116
+ return calculate_baseline(y, lambda_, max_iterations)
117
+
118
+ def get_peaks_from_eic(self, file: SampleFile, targets, from_to: FromTo = {"from": 0.5, "to": 5.0}, options=None, cores: int = 1):
119
+ return get_peaks_from_eic(file, targets, from_to, options, cores)
120
+
121
+ def get_peaks_from_chrom(self, file: SampleFile, items, options=None, cores: int = 1):
122
+ return get_peaks_from_chrom(file, items, options, cores)
123
+
124
+ def find_features(self, file: SampleFile, from_to: FromTo, *, eic=None, grid=None, options=None, cores: int = 1):
125
+ return find_features(file, from_to, eic=eic, grid=grid, options=options, cores=cores)
126
+
127
+ def find_feature(self, file: SampleFile, targets, *, scan_eic=None, eic=None, options=None, cores: int = 1):
128
+ return find_feature(file, targets, scan_eic=scan_eic, eic=eic, options=options, cores=cores)
129
+
130
+ def get_features(self, directory_path: str, from_to: FromTo, *, eic=None, grid=None, grouping=None, options=None, cores: int = 1):
131
+ return get_features(directory_path, from_to, eic=eic, grid=grid, grouping=grouping, options=options, cores=cores)
132
+
133
+ def load_model(self, source) -> Model:
134
+ return load_model(source)
135
+
136
+ def load_warp(self, model: Model) -> WarpModel:
137
+ return load_warp(model)
138
+
139
+ def __repr__(self) -> str:
140
+ return "<Quantion ready>"
141
+
142
+
143
+ def __getattr__(name):
144
+ if name == "MsUtils":
145
+ import warnings
146
+ warnings.warn(
147
+ "MsUtils is renamed to Quantion and will be removed in the next breaking release",
148
+ DeprecationWarning,
149
+ stacklevel=2,
150
+ )
151
+ return Quantion
152
+ raise AttributeError(name)
153
+
154
+
155
+ _, _abi = load_library()
156
+ _api._set_abi(_abi)