IsoSpecPy 2.3.0.dev11__cp313-cp313-win_arm64.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.
IsoSpecPy/isoFFI.py ADDED
@@ -0,0 +1,223 @@
1
+ import cffi
2
+ import platform
3
+ import sys
4
+ import glob
5
+ from pathlib import Path
6
+ if False:
7
+ import IsoSpecCppPy
8
+
9
+ class IsoFFI:
10
+ def __init__(self):
11
+ self.ffi = cffi.FFI()
12
+ self.ffi.cdef('''
13
+ void * setupIso(int dimNumber,
14
+ const int* isotopeNumbers,
15
+ const int* atomCounts,
16
+ const double* isotopeMasses,
17
+ const double* isotopeProbabilities);
18
+
19
+ void * isoFromFasta(const char* fasta, bool use_nominal_masses, bool add_water);
20
+
21
+ double getLightestPeakMassIso(void* iso);
22
+ double getHeaviestPeakMassIso(void* iso);
23
+ double getMonoisotopicPeakMassIso(void* iso);
24
+ double getModeLProbIso(void* iso);
25
+ double getModeMassIso(void* iso);
26
+ double getTheoreticalAverageMassIso(void* iso);
27
+ double getIsoVariance(void* iso);
28
+ double getIsoStddev(void* iso);
29
+ double* getMarginalLogSizeEstimates(void* iso, double target_total_prob);
30
+
31
+ void deleteIso(void* iso);
32
+
33
+ void* setupIsoThresholdGenerator(void* iso,
34
+ double threshold,
35
+ bool _absolute,
36
+ int _tabSize,
37
+ int _hashSize,
38
+ bool reorder_marginals);
39
+ double massIsoThresholdGenerator(void* generator);
40
+ double lprobIsoThresholdGenerator(void* generator);
41
+ double probIsoThresholdGenerator(void* generator);
42
+ bool advanceToNextConfigurationIsoThresholdGenerator(void* generator);
43
+ void deleteIsoThresholdGenerator(void* generator);
44
+ void get_conf_signatureIsoThresholdGenerator(void* generator, int* space);
45
+
46
+
47
+
48
+ void* setupIsoLayeredGenerator(void* iso,
49
+ int _tabSize,
50
+ int _hashSize,
51
+ bool reorder_marginals,
52
+ double t_prob_hint);
53
+ double massIsoLayeredGenerator(void* generator);
54
+ double lprobIsoLayeredGenerator(void* generator);
55
+ double probIsoLayeredGenerator(void* generator);
56
+ bool advanceToNextConfigurationIsoLayeredGenerator(void* generator);
57
+ void deleteIsoLayeredGenerator(void* generator);
58
+ void get_conf_signatureIsoLayeredGenerator(void* generator, int* space);
59
+
60
+
61
+ void* setupIsoOrderedGenerator(void* iso,
62
+ int _tabSize,
63
+ int _hashSize);
64
+ double massIsoOrderedGenerator(void* generator);
65
+ double lprobIsoOrderedGenerator(void* generator);
66
+ double probIsoOrderedGenerator(void* generator);
67
+ bool advanceToNextConfigurationIsoOrderedGenerator(void* generator);
68
+ void deleteIsoOrderedGenerator(void* generator);
69
+ void get_conf_signatureIsoOrderedGenerator(void* generator, int* space);
70
+
71
+ void* setupIsoStochasticGenerator(void* iso,
72
+ size_t no_molecules,
73
+ double precision,
74
+ double beta_bias);
75
+ double massIsoStochasticGenerator(void* generator);
76
+ double lprobIsoStochasticGenerator(void* generator);
77
+ double probIsoStochasticGenerator(void* generator);
78
+ bool advanceToNextConfigurationIsoStochasticGenerator(void* generator);
79
+ void deleteIsoStochasticGenerator(void* generator);
80
+ void get_conf_signatureIsoStochasticGenerator(void* generator, int* space);
81
+
82
+ void* setupThresholdFixedEnvelope(void* iso,
83
+ double threshold,
84
+ bool absolute,
85
+ bool get_confs);
86
+
87
+ void* setupTotalProbFixedEnvelope(void* iso,
88
+ double taget_coverage,
89
+ bool optimize,
90
+ bool get_confs);
91
+
92
+ void* setupStochasticFixedEnvelope(void* iso,
93
+ size_t no_molecules,
94
+ double precision,
95
+ double beta_bias,
96
+ bool get_confs);
97
+
98
+ void* setupBinnedFixedEnvelope(void* iso,
99
+ double target_total_prob,
100
+ double bin_width,
101
+ double bin_middle);
102
+
103
+ void* setupFixedEnvelope(double* masses, double* probs, size_t size, bool mass_sorted, bool prob_sorted, double total_prob);
104
+ void* copyFixedEnvelope(void* other);
105
+ void deleteFixedEnvelope(void* tabulator, bool releaseEverything);
106
+
107
+ const double* massesFixedEnvelope(void* tabulator);
108
+ const double* probsFixedEnvelope(void* tabulator);
109
+ const int* confsFixedEnvelope(void* tabulator);
110
+ size_t confs_noFixedEnvelope(void* tabulator);
111
+
112
+ double empiricAverageMass(void* tabulator);
113
+ double empiricVariance(void* tabulator);
114
+ double empiricStddev(void* tabulator);
115
+
116
+ double wassersteinDistance(void* tabulator1, void* tabulator2);
117
+ double orientedWassersteinDistance(void* tabulator1, void* tabulator2);
118
+ double abyssalWassersteinDistance(void* tabulator1, void* tabulator2, double abyss_depth, double other_scale);
119
+ // double abyssalWassersteinDistanceGrad(void* const* envelopes, const double* scales, double* ret_gradient, size_t N, double abyss_depth_exp, double abyss_depth_the);
120
+
121
+ struct ws_match_res{
122
+ double res1;
123
+ double res2;
124
+ double flow;
125
+ };
126
+
127
+ struct ws_match_res wassersteinMatch(void* tabulator1, void* tabulator2, double flow_dist, double other_scale);
128
+
129
+ void* addEnvelopes(void* tabulator1, void* tabulator2);
130
+ void* convolveEnvelopes(void* tabulator1, void* tabulator2);
131
+
132
+ double getTotalProbOfEnvelope(void* envelope);
133
+ void scaleEnvelope(void* envelope, double factor);
134
+ void normalizeEnvelope(void* envelope);
135
+ void shiftMassEnvelope(void* envelope, double d_mass);
136
+ void resampleEnvelope(void* envelope, size_t ionic_current, double beta_bias);
137
+ void* binnedEnvelope(void* envelope, double width, double middle);
138
+ void* linearCombination(void* const * const envelopes, const double* intensities, size_t count);
139
+
140
+ void sortEnvelopeByMass(void* envelope);
141
+ void sortEnvelopeByProb(void* envelope);
142
+
143
+ void freeReleasedArray(void* array);
144
+ void array_add(double* array, size_t N, double what);
145
+ void array_mul(double* array, size_t N, double what);
146
+ void array_fma(double* array, size_t N, double mul, double add);
147
+
148
+ void parse_fasta_c(const char* fasta, int atomCounts[6]);
149
+
150
+ #define NUMBER_OF_ISOTOPIC_ENTRIES 292
151
+ extern const size_t isospec_number_of_isotopic_entries;
152
+ extern const int elem_table_atomicNo[NUMBER_OF_ISOTOPIC_ENTRIES];
153
+ extern const double elem_table_probability[NUMBER_OF_ISOTOPIC_ENTRIES];
154
+ extern const double elem_table_mass[NUMBER_OF_ISOTOPIC_ENTRIES];
155
+ extern const double elem_table_massNo[NUMBER_OF_ISOTOPIC_ENTRIES];
156
+ extern const int elem_table_extraNeutrons[NUMBER_OF_ISOTOPIC_ENTRIES];
157
+ extern const char* elem_table_element[NUMBER_OF_ISOTOPIC_ENTRIES];
158
+ extern const char* elem_table_symbol[NUMBER_OF_ISOTOPIC_ENTRIES];
159
+ extern const bool elem_table_Radioactive[NUMBER_OF_ISOTOPIC_ENTRIES];
160
+ ''');
161
+
162
+ mod_dir = Path(__file__).resolve().parent
163
+
164
+ if (mod_dir.parent / 'setup.py').exists():
165
+ raise ImportError('''Attempted to load IsoSpecPy module from its build directory. This usually
166
+ won't work and is generally a Bad Idea. Please cd somewhere else, or, if you're really
167
+ sure you want to do that, edit the source and disable this check.''')
168
+
169
+ libnames = ['IsoSpecCppPy*', 'IsoSpec++*']
170
+ libprefix = ['', 'lib', 'Lib']
171
+ extension = ['.so', '.dylib', '.dll']
172
+ try:
173
+ if platform.system() == 'Linux':
174
+ extension = ['.so', 'pyd']
175
+ elif platform.system() == 'Windows':
176
+ extension = ['.dll', '.pyd']
177
+ except:
178
+ pass
179
+
180
+ prebuilt = ['', 'prebuilt-']
181
+
182
+ def cprod(ll1, ll2):
183
+ res = []
184
+ for l1 in ll1:
185
+ for l2 in ll2:
186
+ res.append(l1+l2)
187
+ return res
188
+
189
+ paths_to_check = cprod(prebuilt, cprod(libprefix, cprod(libnames, extension)))
190
+ dpc = []
191
+
192
+ for dirpath in [mod_dir, mod_dir.parent, mod_dir.parent / 'bin', mod_dir.parent / 'lib']:
193
+ dpc.extend([dirpath / p for p in paths_to_check])
194
+
195
+ paths_to_check = dpc
196
+ # expand glob patterns using pathlib (keep only actual matches, like glob.glob did)
197
+ expanded = []
198
+ for p in paths_to_check:
199
+ expanded.extend(p.parent.glob(p.name))
200
+ paths_to_check = expanded
201
+ try:
202
+ import importlib
203
+ paths_to_check.insert(0, Path(importlib.util.find_spec("IsoSpecCppPy").origin))
204
+ except (ImportError, AttributeError):
205
+ pass
206
+
207
+ errors = []
208
+
209
+ self.clib = None
210
+ for libpath in set(paths_to_check):
211
+ try:
212
+ self.clib = self.ffi.dlopen(str(libpath))
213
+ self.libpath = libpath
214
+ break
215
+ except (IndexError, OSError) as e:
216
+ errmsg = "Load libIsoSpec++.so, tried: " + libpath + '\n' + "Got error: " + str(type(e)) + ": " + str(e)
217
+ errors.append(errmsg)
218
+
219
+ if self.clib == None:
220
+ raise ImportError("Cannot find or load the C++ part of the library\n" + '\n'.join(errors))
221
+
222
+
223
+ isoFFI = IsoFFI() # This is done while including the module
bin/IsoSpecCppPy.dll ADDED
Binary file
@@ -0,0 +1,43 @@
1
+ Metadata-Version: 2.4
2
+ Name: IsoSpecPy
3
+ Version: 2.3.0.dev11
4
+ Summary: IsoSpecPy is a Python library for computing isotopic distributions of molecules.
5
+ Keywords: isotopic distribution,mass spectrometry,chemistry,isotopic envelope,isotopologues
6
+ Author: Michał Startek, Mateusz Łącki
7
+ License-Expression: BSD-2-Clause
8
+ License-File: LICENCE
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.6
11
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Operating System :: OS Independent
14
+ Project-URL: Homepage, https://github.com/MatteoLacki/IsoSpec
15
+ Project-URL: Repository, https://github.com/MatteoLacki/IsoSpec
16
+ Requires-Python: >=3.6
17
+ Requires-Dist: cffi
18
+ Provides-Extra: testing
19
+ Requires-Dist: pytest; extra == "testing"
20
+ Requires-Dist: OldIsoSpecPy; extra == "testing"
21
+ Description-Content-Type: text/markdown
22
+
23
+ IsoSpec, the isotopic fine structure calculator
24
+ ===============================================
25
+
26
+ The main purpose of this software package is to be used as a library,
27
+ mostly in mass spectrometry software. We do not provide any standalone
28
+ programs, except for those in Examples directory which are intended to
29
+ showcase the usage of the library.
30
+
31
+ Please see the code in Examples directory for example usage.
32
+
33
+ The software is publically available under a 2-clause BSD licence. If
34
+ you require other licensing terms, please contact the authors. See
35
+ LICENCE file for more details.
36
+
37
+ More details about the program may be found in the following Analytical
38
+ Chemistry publications:
39
+
40
+ https://pubs.acs.org/doi/10.1021/acs.analchem.0c00959
41
+ https://pubs.acs.org/doi/abs/10.1021/acs.analchem.6b01459
42
+
43
+ See especially the Supporting Information for details about the algorithm.
@@ -0,0 +1,35 @@
1
+ bin/IsoSpecCppPy.dll,sha256=vzvzp3J8AWrWMOWP4lv9iF7XoVoRIatONAzx5EPwW8I,125952
2
+ IsoSpecPy/__init__.py,sha256=Tjgv2E5pcPq4iSFiuZD4oJiOpqzaMuzkvzQVU843rrE,504
3
+ IsoSpecPy/__main__.py,sha256=Xr6SHPmCkpA3rPFbSBwxd2xl85eEKs6XDTLVWKZxcp4,1034
4
+ IsoSpecPy/Advanced.py,sha256=70LP-AOVr3lsfmCP_zivaXU0auhKWfgt6I8icbptxxg,1090
5
+ IsoSpecPy/approximations.py,sha256=nLrXdS3YH15IWBItPFG4qb5qflswMuuDN_5g79yKP08,4499
6
+ IsoSpecPy/confs_passthrough.py,sha256=Ythe_zSlI2Z69ajCCftubZSqLvHKz2kSRjF1Vc-pE6M,284
7
+ IsoSpecPy/Distributions.py,sha256=-Rp1RBxXGIZuWrsAF8Ayd1_vJV1z2LEoeKCgV-XdWyE,2613
8
+ IsoSpecPy/Formulas.py,sha256=blOy63xIfJcfR5WDYHNSCX3CMsdsOvVWpcAraKm67uE,1730
9
+ IsoSpecPy/isoFFI.py,sha256=GHDznav2_zleGN-qY8cfDTJawRc2fvq8hCB5drr_gcY,10121
10
+ IsoSpecPy/IsoSpec++/allocator.h,sha256=dyWhQvpCZnDEby0YMyFbA_dVhYrKwMv8Pk4hLubYaLw,1662
11
+ IsoSpecPy/IsoSpec++/btrd.h,sha256=ZhOCBYgQJ5O6riTdzQaRZiF2UUtDm5gxjmWP6thEbYg,6190
12
+ IsoSpecPy/IsoSpec++/conf.h,sha256=N_dBUbO3RVO9LoSAvjRWtnrjVOqMbcKgbp5q9bJp93M,1008
13
+ IsoSpecPy/IsoSpec++/cwrapper.h,sha256=3lyMAnbPYdepULpQFxA1Y6trZ605SwXs5C_ZGki-SNc,8308
14
+ IsoSpecPy/IsoSpec++/dirtyAllocator.h,sha256=aB1ebPacCfIPtGXmcxfCP7XJZpu7AuNQrsKlcOE48aI,1472
15
+ IsoSpecPy/IsoSpec++/element_tables.h,sha256=i-ImST2Wgl5WqPOfymndqZSV6UOvHwRWKiiKems4TPM,1844
16
+ IsoSpecPy/IsoSpec++/fasta.h,sha256=sRvMG_-ND1tVIEHSils3Sk2KJ0kFxzhYqTSV_PIcHtY,2254
17
+ IsoSpecPy/IsoSpec++/fixedEnvelopes.h,sha256=EYJnD5pbNcq7hTtBJtDczhtPeT_05LpQzZRQKG4GQwc,8911
18
+ IsoSpecPy/IsoSpec++/isoMath.h,sha256=t2pq01F-U4N0cKFAR3vK8LHoAu5PK6cHUXCDWC_DPjE,2849
19
+ IsoSpecPy/IsoSpec++/isoSpec++.h,sha256=hUt57tLBKuw625Vj0hqJ3N3Xy91ewmgwUPU0TUe5nSw,30758
20
+ IsoSpecPy/IsoSpec++/marginalTrek++.h,sha256=ex2V2Ao7iDzJxLKdTRLXImAwxaBFOdzSReSa0p35RMk,26345
21
+ IsoSpecPy/IsoSpec++/misc.h,sha256=wY2AjRC8GvJq2fpWyUqPklQJXom8FRaWCqPw44IktUs,5205
22
+ IsoSpecPy/IsoSpec++/mman.h,sha256=RxwibELl7IRwWbn672Gg4-DeDGXXL6tFhM12kIMx5EE,1751
23
+ IsoSpecPy/IsoSpec++/operators.h,sha256=tD5hL-lPpLQ_LOEZMH61eenn-5L67Io-JJ8v7NovUpc,4131
24
+ IsoSpecPy/IsoSpec++/platform.h,sha256=BtPgGRiUoyoa0S0RqsKGMeM2_ZSjcWvHW4xzHP3BYf0,3672
25
+ IsoSpecPy/IsoSpec++/platform_incl.h,sha256=6MW4V759ZXdHaHtfH9o5nNmOXj2kCx8E_SiRO1mgBiM,966
26
+ IsoSpecPy/IsoSpec++/pod_vector.h,sha256=CUb7QjA2BDynLNFkMC-86TzMqdZZPejjck5JwQO2QdU,11693
27
+ IsoSpecPy/IsoSpec++/summator.h,sha256=M-2IV9NU4PTWXIa3fq9Nz3StR9ZT22cZFH1utnmcf98,2425
28
+ IsoSpecPy/IsoSpecPy.py,sha256=jZ1HM1kZt5-rc_4qlrsgdyhZWehQYxFGBIryjnGTfeU,35224
29
+ IsoSpecPy/IsoSpecPyOld.py,sha256=lvdI552Ofk50RF1inA9ISakPKDOg7q5rj2gRDMMd7es,11447
30
+ IsoSpecPy/PeriodicTbl.py,sha256=n5BSJJ60-tiesrOibkwDcysv1eB_BsYqy0zDq8xNzAo,1422
31
+ lib/IsoSpecCppPy.lib,sha256=NaVh3FhEkrer40yYCbaQ8J5ovMCEm73xPIZtlAi4m64,21638
32
+ isospecpy-2.3.0.dev11.dist-info/METADATA,sha256=J0W1PhwwllUCSuF1jJDNj0K0APBnC3NuOuwz7PC6BgE,1799
33
+ isospecpy-2.3.0.dev11.dist-info/WHEEL,sha256=266RCsY4qAtM89uC1krYhRjJfQnBNRbrvh__ATdOf54,106
34
+ isospecpy-2.3.0.dev11.dist-info/licenses/LICENCE,sha256=gfZw5llAwrHH4rkp5FJuq9VAuamp1x7x8MDmDjj8dpw,1705
35
+ isospecpy-2.3.0.dev11.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: scikit-build-core 0.11.6
3
+ Root-Is-Purelib: false
4
+ Tag: cp313-cp313-win_arm64
5
+
@@ -0,0 +1,35 @@
1
+ IsoSpec is provided under the terms of 2-clause BSD licence.
2
+ If you require other licensing terms, please contact the authors.
3
+
4
+ We would appreciate if you let us know if you use this library in
5
+ your own software, but you are under no legal obligation to do so.
6
+
7
+
8
+ -------------------------------------------------------------------------
9
+
10
+
11
+ Copyright (c) 2015-2025, Michał Startek and Mateusz Łącki
12
+
13
+ All rights reserved.
14
+
15
+ Redistribution and use in source and binary forms, with or without
16
+ modification, are permitted provided that the following conditions are met:
17
+
18
+ 1. Redistributions of source code must retain the above copyright notice, this
19
+ list of conditions and the following disclaimer.
20
+ 2. Redistributions in binary form must reproduce the above copyright notice,
21
+ this list of conditions and the following disclaimer in the documentation
22
+ and/or other materials provided with the distribution.
23
+
24
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
25
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
28
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+
35
+
lib/IsoSpecCppPy.lib ADDED
Binary file