IsoSpec  1.95
cwrapper.h
1 /*
2  * Copyright (C) 2015-2019 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 #define ISOSPEC_ALGO_LAYERED 0
20 #define ISOSPEC_ALGO_ORDERED 1
21 #define ISOSPEC_ALGO_THRESHOLD_ABSOLUTE 2
22 #define ISOSPEC_ALGO_THRESHOLD_RELATIVE 3
23 #define ISOSPEC_ALGO_LAYERED_ESTIMATE 4
24 
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #else
29 #include <stdbool.h>
30 #endif
31 
32 void * setupIso(int dimNumber,
33  const int* isotopeNumbers,
34  const int* atomCounts,
35  const double* isotopeMasses,
36  const double* isotopeProbabilities);
37 
38 double getLightestPeakMassIso(void* iso);
39 double getHeaviestPeakMassIso(void* iso);
40 double getMonoisotopicPeakMassIso(void* iso);
41 double getModeLProbIso(void* iso);
42 double getModeMassIso(void* iso);
43 double getTheoreticalAverageMassIso(void* iso);
44 
45 
46 void deleteIso(void* iso);
47 
48 #define ISOSPEC_C_FN_HEADER(generatorType, dataType, method)\
49 dataType method##generatorType(void* generator);
50 
51 #define ISOSPEC_C_FN_HEADER_GET_CONF_SIGNATURE(generatorType)\
52 void method##generatorType(void* generator);
53 
54 #define ISOSPEC_C_FN_HEADERS(generatorType)\
55 ISOSPEC_C_FN_HEADER(generatorType, double, mass) \
56 ISOSPEC_C_FN_HEADER(generatorType, double, lprob) \
57 ISOSPEC_C_FN_HEADER(generatorType, double, prob) \
58 ISOSPEC_C_FN_HEADER_GET_CONF_SIGNATURE(generatorType) \
59 ISOSPEC_C_FN_HEADER(generatorType, bool, advanceToNextConfiguration) \
60 ISOSPEC_C_FN_HEADER(generatorType, void, delete)
61 
62 
63 
64 
65 //______________________________________________________THRESHOLD GENERATOR
66 void* setupIsoThresholdGenerator(void* iso,
67  double threshold,
68  bool _absolute,
69  int _tabSize,
70  int _hashSize);
71 ISOSPEC_C_FN_HEADERS(IsoThresholdGenerator)
72 
73 
74 //______________________________________________________LAYERED GENERATOR
75 void* setupIsoLayeredGenerator(void* iso,
76  int _tabSize,
77  int _hashSize);
78 ISOSPEC_C_FN_HEADERS(IsoLayeredGenerator)
79 
80 //______________________________________________________ORDERED GENERATOR
81 void* setupIsoOrderedGenerator(void* iso,
82  int _tabSize,
83  int _hashSize);
84 ISOSPEC_C_FN_HEADERS(IsoOrderedGenerator)
85 
86 
87 
88 void* setupThresholdFixedEnvelope(void* iso,
89  double threshold,
90  bool absolute,
91  bool get_confs,
92  bool get_lprobs,
93  bool get_masses,
94  bool get_probs);
95 
96 void deleteThresholdFixedEnvelope(void* tabulator);
97 
98 const double* massesThresholdFixedEnvelope(void* tabulator);
99 const double* lprobsThresholdFixedEnvelope(void* tabulator);
100 const double* probsThresholdFixedEnvelope(void* tabulator);
101 const int* confsThresholdFixedEnvelope(void* tabulator);
102 int confs_noThresholdFixedEnvelope(void* tabulator);
103 
104 
105 
106 void* setupTotalProbFixedEnvelope(void* iso,
107  double taget_coverage,
108  bool optimize,
109  bool get_confs,
110  bool get_lprobs,
111  bool get_masses,
112  bool get_probs);
113 
114 void deleteTotalProbFixedEnvelope(void* tabulator);
115 
116 const double* massesTotalProbFixedEnvelope(void* tabulator);
117 const double* lprobsTotalProbFixedEnvelope(void* tabulator);
118 const double* probsTotalProbFixedEnvelope(void* tabulator);
119 const int* confsTotalProbFixedEnvelope(void* tabulator);
120 int confs_noTotalProbFixedEnvelope(void* tabulator);
121 
122 void freeReleasedArray(void* array);
123 
124 #ifdef __cplusplus
125 }
126 #endif
127