git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/Rdisop@50670 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -1,3 +1,12 @@ |
1 |
+2010-11-04 Steffen Neumann <sneumann@ipb-halle.de> |
|
2 |
+ * Corrected bug that leads to wrong monoisotopic masses for molecules |
|
3 |
+ containing elements where the most abundant isotope is not the first one, |
|
4 |
+ discovered by Ralf Tautenhahn |
|
5 |
+ |
|
6 |
+2010-10-22 Steffen Neumann <sneumann@ipb-halle.de> |
|
7 |
+ * R/elements.R: Added remaining elements to PSE, |
|
8 |
+ contributed by Canteri Roberto (http://m2b2.fbk.eu/en/people) |
|
9 |
+ |
|
1 | 10 |
2010-05-18 Steffen Neumann <sneumann@ipb-halle.de> |
2 | 11 |
* added Runit test infrastructure |
3 | 12 |
|
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
Package: Rdisop |
2 | 2 |
Title: Decomposition of Isotopic Patterns |
3 |
-Version: 1.11.0 |
|
4 |
-Date: 2010-04-02 |
|
3 |
+Version: 1.11.2 |
|
4 |
+Date: 2010-11-04 |
|
5 | 5 |
Author: Anton Pervukhin <apervukh@minet.uni-jena.de>, Steffen Neumann <sneumann@ipb-halle.de> |
6 | 6 |
Maintainer: Steffen Neumann <sneumann@ipb-halle.de> |
7 | 7 |
Description: Identification of metabolites using high precision mass |
... | ... |
@@ -2403,7 +2403,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu |
2403 | 2403 |
echo "Configuring libims.a in imslib..." |
2404 | 2404 |
cd src/imslib |
2405 | 2405 |
./configure --enable-shared --disable-static |
2406 |
-make -j 6 src/libims.la |
|
2406 |
+make $MAKEFLAGS src/libims.la |
|
2407 | 2407 |
cd ../../ |
2408 | 2408 |
IMS_CFLAGS=-I./imslib/src/ |
2409 | 2409 |
|
... | ... |
@@ -5,6 +5,7 @@ |
5 | 5 |
#include <ostream> |
6 | 6 |
#include <ims/isotopedistribution.h> |
7 | 7 |
#include <iostream> |
8 |
+#include <float.h> // FLT_MAX |
|
8 | 9 |
|
9 | 10 |
namespace ims { |
10 | 11 |
|
... | ... |
@@ -50,6 +51,11 @@ class Element { |
50 | 51 |
*/ |
51 | 52 |
typedef isotopes_type::size_type size_type; |
52 | 53 |
|
54 |
+ /** |
|
55 |
+ * Special value to detect most abundant isotope automagically |
|
56 |
+ */ |
|
57 |
+ static const size_type MONOISOTOPIC=0; |
|
58 |
+ |
|
53 | 59 |
/** |
54 | 60 |
* Mass of electron. |
55 | 61 |
*/ |
... | ... |
@@ -148,8 +154,34 @@ class Element { |
148 | 154 |
* @param index Index of element's isotope. |
149 | 155 |
* @return mass of element's isotope with a given index. |
150 | 156 |
*/ |
151 |
- mass_type getMass(size_type index = 0) const { |
|
152 |
- return isotopes.getMass(index); |
|
157 |
+ mass_type getMass(size_type index = MONOISOTOPIC) const { |
|
158 |
+ if (index != MONOISOTOPIC) { |
|
159 |
+ return isotopes.getMass(index); |
|
160 |
+ } else { |
|
161 |
+/* std::cerr << std::endl; */ |
|
162 |
+ |
|
163 |
+ IsotopeDistribution::abundance_type maxval=-FLT_MAX; |
|
164 |
+ int maxindex=0; |
|
165 |
+ |
|
166 |
+ for (int i=0; i < IsotopeDistribution::SIZE; i++) { |
|
167 |
+/* std::cerr << "Abundance is " << isotopes.getAbundance(i) << std::endl; */ |
|
168 |
+ |
|
169 |
+ if (isotopes.getAbundance(i) > 0.5) { |
|
170 |
+ // 50% is the absolute majority here, |
|
171 |
+ // skip remaining isotopes |
|
172 |
+/* std::cerr << "Early return mass " */ |
|
173 |
+/* << isotopes.getMass(i) */ |
|
174 |
+/* << " of isotope " << i << std::endl ; */ |
|
175 |
+ return isotopes.getMass(i); |
|
176 |
+ } |
|
177 |
+ if (isotopes.getAbundance(i) > maxval) { |
|
178 |
+ maxval = isotopes.getAbundance(i); |
|
179 |
+ maxindex = i; |
|
180 |
+ } |
|
181 |
+ } |
|
182 |
+ |
|
183 |
+ return isotopes.getMass(maxindex); |
|
184 |
+ } |
|
153 | 185 |
} |
154 | 186 |
|
155 | 187 |
/** |