IsoSpecPy 2.5.0__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.
Files changed (45) hide show
  1. IsoSpecPy/Advanced.py +32 -0
  2. IsoSpecPy/Distributions.py +93 -0
  3. IsoSpecPy/Formulas.py +71 -0
  4. IsoSpecPy/IsoSpec++/aligned_ptr.h +638 -0
  5. IsoSpecPy/IsoSpec++/allocator.h +69 -0
  6. IsoSpecPy/IsoSpec++/btrd.h +206 -0
  7. IsoSpecPy/IsoSpec++/composition.h +126 -0
  8. IsoSpecPy/IsoSpec++/conf.h +38 -0
  9. IsoSpecPy/IsoSpec++/cwrapper.h +271 -0
  10. IsoSpecPy/IsoSpec++/dirtyAllocator.h +58 -0
  11. IsoSpecPy/IsoSpec++/element_lookup.h +36 -0
  12. IsoSpecPy/IsoSpec++/element_tables.h +50 -0
  13. IsoSpecPy/IsoSpec++/fasta.h +70 -0
  14. IsoSpecPy/IsoSpec++/fasta_mods.h +70 -0
  15. IsoSpecPy/IsoSpec++/fixedEnvelopes.h +418 -0
  16. IsoSpecPy/IsoSpec++/isa_kernel_impl.h +192 -0
  17. IsoSpecPy/IsoSpec++/isa_kernels.h +172 -0
  18. IsoSpecPy/IsoSpec++/isoMath.h +121 -0
  19. IsoSpecPy/IsoSpec++/isoSpec++.h +801 -0
  20. IsoSpecPy/IsoSpec++/iso_simd.h +48 -0
  21. IsoSpecPy/IsoSpec++/marginalTrek++.h +614 -0
  22. IsoSpecPy/IsoSpec++/misc.h +229 -0
  23. IsoSpecPy/IsoSpec++/mman.h +67 -0
  24. IsoSpecPy/IsoSpec++/operators.h +150 -0
  25. IsoSpecPy/IsoSpec++/platform.h +180 -0
  26. IsoSpecPy/IsoSpec++/platform_incl.h +33 -0
  27. IsoSpecPy/IsoSpec++/pod_vector.h +400 -0
  28. IsoSpecPy/IsoSpec++/summator.h +118 -0
  29. IsoSpecPy/IsoSpec++/unimod.h +80 -0
  30. IsoSpecPy/IsoSpec++/unimod_support.h +2169 -0
  31. IsoSpecPy/IsoSpec++/unimod_table_data.h +1027 -0
  32. IsoSpecPy/IsoSpecPy.py +1088 -0
  33. IsoSpecPy/IsoSpecPyOld.py +290 -0
  34. IsoSpecPy/PeriodicTbl.py +51 -0
  35. IsoSpecPy/__init__.py +19 -0
  36. IsoSpecPy/__main__.py +25 -0
  37. IsoSpecPy/approximations.py +122 -0
  38. IsoSpecPy/confs_passthrough.py +16 -0
  39. IsoSpecPy/isoFFI.py +290 -0
  40. bin/IsoSpecCppPy.dll +0 -0
  41. isospecpy-2.5.0.dist-info/METADATA +220 -0
  42. isospecpy-2.5.0.dist-info/RECORD +45 -0
  43. isospecpy-2.5.0.dist-info/WHEEL +5 -0
  44. isospecpy-2.5.0.dist-info/licenses/LICENCE +35 -0
  45. lib/IsoSpecCppPy.lib +0 -0
@@ -0,0 +1,58 @@
1
+ /*
2
+ * Copyright (C) 2015-2020 Mateusz Łącki and Michał Startek.
3
+ *
4
+ * This file is part of IsoSpec.
5
+ *
6
+ * IsoSpec is free software: you can redistribute it and/or modify
7
+ * it under the terms of the Simplified ("2-clause") BSD licence.
8
+ *
9
+ * IsoSpec is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
+ *
13
+ * You should have received a copy of the Simplified BSD Licence
14
+ * along with IsoSpec. If not, see <https://opensource.org/licenses/BSD-2-Clause>.
15
+ */
16
+
17
+ #pragma once
18
+
19
+ #include <cstring>
20
+ #include "pod_vector.h"
21
+
22
+ namespace IsoSpec
23
+ {
24
+
25
+ class DirtyAllocator
26
+ {
27
+ private:
28
+ void* currentTab;
29
+ void* currentConf;
30
+ void* endOfTablePtr;
31
+ const int tabSize;
32
+ int cellSize;
33
+ pod_vector<void*> prevTabs;
34
+
35
+ public:
36
+ explicit DirtyAllocator(const int dim, const int tabSize = 10000);
37
+ ~DirtyAllocator();
38
+
39
+ DirtyAllocator(const DirtyAllocator& other) = delete;
40
+ DirtyAllocator& operator=(const DirtyAllocator& other) = delete;
41
+
42
+ void shiftTables();
43
+
44
+ inline void* newConf()
45
+ {
46
+ if (currentConf >= endOfTablePtr)
47
+ {
48
+ shiftTables();
49
+ }
50
+
51
+ void* ret = currentConf;
52
+ currentConf = reinterpret_cast<char*>(currentConf) + cellSize;
53
+
54
+ return ret;
55
+ }
56
+ };
57
+
58
+ } // namespace IsoSpec
@@ -0,0 +1,36 @@
1
+ /*
2
+ * Copyright (C) 2015-2026 Mateusz Łącki and Michał Startek.
3
+ *
4
+ * This file is part of IsoSpec.
5
+ *
6
+ * IsoSpec is free software: you can redistribute it and/or modify
7
+ * it under the terms of the Simplified ("2-clause") BSD licence.
8
+ *
9
+ * IsoSpec is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
+ *
13
+ * You should have received a copy of the Simplified BSD Licence
14
+ * along with IsoSpec. If not, see <https://opensource.org/licenses/BSD-2-Clause>.
15
+ */
16
+
17
+ #pragma once
18
+
19
+ #include <cstddef>
20
+
21
+ namespace IsoSpec {
22
+
23
+ //! Row index of `symbol`'s first isotope in element_tables.h's flat
24
+ //! elem_table_* arrays (grouped by element, contiguous), or -1 if `symbol`
25
+ //! isn't a known element. `len` must be 1 or 2 -- IsoSpec's own
26
+ //! element_tables.cpp never uses longer symbols. A direct-indexed
27
+ //! [26][27] table (first letter x optional second letter), built once,
28
+ //! backs this -- no scan, no map.
29
+ int find_element_table_first_index(const char* symbol, size_t len);
30
+
31
+ //! How many contiguous isotope rows starting at `first_index` belong to
32
+ //! that element (elem_table_ID stays constant over that run). Returns 0 for
33
+ //! a negative `first_index`.
34
+ int element_isotope_count(int first_index);
35
+
36
+ } // namespace IsoSpec
@@ -0,0 +1,50 @@
1
+ /*
2
+ * Copyright (C) 2015-2020 Mateusz Łącki and Michał Startek.
3
+ *
4
+ * This file is part of IsoSpec.
5
+ *
6
+ * IsoSpec is free software: you can redistribute it and/or modify
7
+ * it under the terms of the Simplified ("2-clause") BSD licence.
8
+ *
9
+ * IsoSpec is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
+ *
13
+ * You should have received a copy of the Simplified BSD Licence
14
+ * along with IsoSpec. If not, see <https://opensource.org/licenses/BSD-2-Clause>.
15
+ */
16
+
17
+ #pragma once
18
+
19
+ #include <stddef.h>
20
+
21
+ #include "platform.h"
22
+
23
+ namespace IsoSpec
24
+ {
25
+
26
+ #ifdef __cplusplus
27
+ extern "C" {
28
+ #endif
29
+
30
+
31
+ #define ISOSPEC_NUMBER_OF_ISOTOPIC_ENTRIES 293
32
+ ISOSPEC_C_API extern const size_t isospec_number_of_isotopic_entries;
33
+
34
+ ISOSPEC_C_API extern const int elem_table_ID[ISOSPEC_NUMBER_OF_ISOTOPIC_ENTRIES];
35
+ ISOSPEC_C_API extern const int elem_table_atomicNo[ISOSPEC_NUMBER_OF_ISOTOPIC_ENTRIES];
36
+ ISOSPEC_C_API extern const double elem_table_probability[ISOSPEC_NUMBER_OF_ISOTOPIC_ENTRIES];
37
+ ISOSPEC_C_API extern const double elem_table_mass[ISOSPEC_NUMBER_OF_ISOTOPIC_ENTRIES];
38
+ ISOSPEC_C_API extern const double elem_table_massNo[ISOSPEC_NUMBER_OF_ISOTOPIC_ENTRIES];
39
+ ISOSPEC_C_API extern const int elem_table_extraNeutrons[ISOSPEC_NUMBER_OF_ISOTOPIC_ENTRIES];
40
+ ISOSPEC_C_API extern const char* elem_table_element[ISOSPEC_NUMBER_OF_ISOTOPIC_ENTRIES];
41
+ ISOSPEC_C_API extern const char* elem_table_symbol[ISOSPEC_NUMBER_OF_ISOTOPIC_ENTRIES];
42
+ ISOSPEC_C_API extern const bool elem_table_Radioactive[ISOSPEC_NUMBER_OF_ISOTOPIC_ENTRIES];
43
+ ISOSPEC_C_API extern const double elem_table_log_probability[ISOSPEC_NUMBER_OF_ISOTOPIC_ENTRIES];
44
+
45
+
46
+ #ifdef __cplusplus
47
+ }
48
+ #endif
49
+
50
+ } // namespace IsoSpec
@@ -0,0 +1,70 @@
1
+ /*
2
+ * Copyright (C) 2015-2020 Mateusz Łącki and Michał Startek.
3
+ *
4
+ * This file is part of IsoSpec.
5
+ *
6
+ * IsoSpec is free software: you can redistribute it and/or modify
7
+ * it under the terms of the Simplified ("2-clause") BSD licence.
8
+ *
9
+ * IsoSpec is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
+ *
13
+ * You should have received a copy of the Simplified BSD Licence
14
+ * along with IsoSpec. If not, see <https://opensource.org/licenses/BSD-2-Clause>.
15
+ */
16
+
17
+
18
+ #pragma once
19
+
20
+ #include <cstddef>
21
+ #include <cstring>
22
+
23
+ namespace IsoSpec{
24
+
25
+ // We will work with C H N O S Se tuples */
26
+ extern const int aa_isotope_numbers[6];
27
+
28
+ extern const double aa_elem_masses[19];
29
+
30
+ extern const double aa_elem_nominal_masses[19];
31
+
32
+ extern const double aa_elem_probabilities[19];
33
+
34
+ extern const int aa_symbol_to_elem_counts[256*6];
35
+
36
+ //! Count elemental composition of an unmodificed sequence of amino acids, resulting in CHNOSSe counts.
37
+ /*!
38
+ WARNING!!! This function does not add the terminating H and OH groups, resulting in a residue backbone skeleton formula.
39
+ If you don't know what that means, you should probably be using parse_fasta_full function.
40
+ */
41
+ inline void parse_fasta(const char* fasta, int atomCounts[6])
42
+ {
43
+ memset(atomCounts, 0, sizeof(decltype(atomCounts[0]))*6);
44
+
45
+ for(size_t idx = 0; fasta[idx] != '\0'; ++idx)
46
+ {
47
+ const int* counts = &aa_symbol_to_elem_counts[static_cast<unsigned char>(fasta[idx])*6];
48
+ for(int ii = 0; ii < 6; ++ii)
49
+ atomCounts[ii] += counts[ii];
50
+ }
51
+ }
52
+
53
+ //! Turn an input FASTA aminoacid sequence into atom counts, in CHNOSSe order.
54
+ /*!
55
+ Unlike parse_fasta, this function includes the H and OH groups at the N- and C- termini of the skeleton, resulting in a formula of a full (inert) molecule.
56
+ */
57
+ inline void parse_fasta_full(const char* fasta, int atomCounts[6])
58
+ {
59
+ parse_fasta(fasta, atomCounts);
60
+ // Add terminal water (H2O) for either precursor or fragment.
61
+ const int H_INDEX = 1; // Indexing: 0=C, 1=H, 2=N, 3=O, 4=S, 5=Se
62
+ const int O_INDEX = 3;
63
+
64
+ atomCounts[H_INDEX] += 2;
65
+ atomCounts[O_INDEX] += 1;
66
+ }
67
+
68
+
69
+
70
+ } // namespace IsoSpec
@@ -0,0 +1,70 @@
1
+ /*
2
+ * Copyright (C) 2015-2026 Mateusz Łącki and Michał Startek.
3
+ *
4
+ * This file is part of IsoSpec.
5
+ *
6
+ * IsoSpec is free software: you can redistribute it and/or modify
7
+ * it under the terms of the Simplified ("2-clause") BSD licence.
8
+ *
9
+ * IsoSpec is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
+ *
13
+ * You should have received a copy of the Simplified BSD Licence
14
+ * along with IsoSpec. If not, see <https://opensource.org/licenses/BSD-2-Clause>.
15
+ */
16
+
17
+ #pragma once
18
+
19
+ #include <vector>
20
+
21
+ #include "composition.h"
22
+ #include "isoSpec++.h"
23
+ #include "unimod.h"
24
+
25
+ namespace IsoSpec {
26
+
27
+ //! Parses `sequence` for [UNIMOD:<id>] modification brackets in exactly the
28
+ //! notation this monorepo's SAGE fork writes (crates/sage/src/peptide.rs):
29
+ //! `[UNIMOD:<id>]-SEQUENCE` for an N-terminal mod, `X[UNIMOD:<id>]` for an
30
+ //! internal one (immediately after the modified residue), `SEQUENCE-
31
+ //! [UNIMOD:<id>]` for a C-terminal one. Parsing needs no position-awareness
32
+ //! to get this right: a `[UNIMOD:<id>]` bracket has the same effect (add
33
+ //! that modification's composition delta) wherever it appears, and the
34
+ //! surrounding '-' either side of a terminal bracket is just an ordinary
35
+ //! ignored character, exactly as it always was in a plain sequence (see
36
+ //! parse_fasta's "unrecognized characters are silently ignored" contract,
37
+ //! which this function preserves for everything except '[' itself -- a
38
+ //! literal '[' or a digit outside a bracket was never valid input before
39
+ //! either way).
40
+ //!
41
+ //! Base residue composition comes from fasta.h's existing
42
+ //! aa_symbol_to_elem_counts (CHNOSSe); each recognized mod's resolved
43
+ //! composition (from `mods`) is added on top, so the result can include
44
+ //! elements no plain amino-acid sequence ever needs (P, Br, Ca, Fe, ...).
45
+ //!
46
+ //! Throws std::invalid_argument on a malformed bracket (missing "UNIMOD:"
47
+ //! prefix, missing/non-numeric id, missing closing ']') or an id not present
48
+ //! in `mods` -- covers both a genuinely-unknown id and one of the ids
49
+ //! data/unimod.csv deliberately excludes (isotope-labeled, glycan/
50
+ //! derivatization "brick" entries) alike, same error, no special-casing.
51
+ ElementComposition parse_fasta_with_mods(const char* sequence, const UnimodTable& mods = embedded_unimod_table());
52
+
53
+ //! As above, plus terminal H2O -- mirrors parse_fasta_full's role for the
54
+ //! mods-unaware path.
55
+ ElementComposition parse_fasta_with_mods_full(const char* sequence, const UnimodTable& mods = embedded_unimod_table());
56
+
57
+ //! Same as parse_fasta_with_mods, but fills a caller-owned `out` in place
58
+ //! (cleared first) instead of returning a fresh ElementComposition -- the
59
+ //! allocation-free form for a hot loop over many sequences (a single `out`
60
+ //! reused across the whole loop reallocates at most a handful of times, not
61
+ //! once per call). parse_fasta_with_mods/_full are thin convenience wrappers
62
+ //! around this pair for one-off callers.
63
+ void parse_fasta_with_mods_into(const char* sequence, ElementComposition& out,
64
+ const UnimodTable& mods = embedded_unimod_table());
65
+
66
+ //! As above, plus terminal H2O.
67
+ void parse_fasta_with_mods_full_into(const char* sequence, ElementComposition& out,
68
+ const UnimodTable& mods = embedded_unimod_table());
69
+
70
+ } // namespace IsoSpec