Browse code

Commit made by the Bioconductor Git-SVN bridge. Consists of 3 commits.

Commit information:

Commit id: 2b2d46de53ab6db1651df3979bec62c4be1b4d02

Merge pull request #20 from thirdwing/master

Fix #18
Committed by: Laurent Gatto
Author Name: Laurent Gatto
Commit date: 2015-02-08 10:02:30 +0000
Author date: 2015-02-08 10:02:30 +0000

Commit id: bf3803db2da39fa34a5622568576e44934e27233

remove ListBuilder

Committed by: thirdwing
Author Name: thirdwing
Commit date: 2015-02-07 16:29:54 -0500
Author date: 2015-02-07 16:29:54 -0500

Commit id: a6d4cc7a972c43947a3f7c9f1aed1b5418b4aabf

fix #18

Committed by: thirdwing
Author Name: thirdwing
Commit date: 2015-02-07 15:44:30 -0500
Author date: 2015-02-07 15:44:30 -0500


git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/mzR@99206 bc3139a8-67e5-0310-9ffc-ced21a209358

s.neumann authored on 08/02/2015 10:03:17
Showing 4 changed files

1 1
deleted file mode 100644
... ...
@@ -1,61 +0,0 @@
1
-//
2
-// Based on code sent by Kevin Ushey
3
-// to Rcpp-devel on Tue, 8 Jul 2014
4
-//
5
-
6
-#ifndef LIST_BUILDER_H
7
-#define LIST_BUILDER_H
8
-
9
-#include <Rcpp.h>
10
-using namespace Rcpp;
11
-
12
-class ListBuilder
13
-{
14
-
15
-public:
16
-
17
-    ListBuilder() {};
18
-    ~ListBuilder() {};
19
-
20
-    inline ListBuilder& add(std::string name, SEXP x)
21
-    {
22
-        names.push_back(name);
23
-        elements.push_back(x);
24
-        return *this;
25
-    }
26
-
27
-    inline List get() const
28
-    {
29
-        return static_cast<List>(*this);
30
-    }
31
-
32
-    inline operator List() const
33
-    {
34
-        List result(elements.size());
35
-        for (size_t i = 0; i < elements.size(); ++i)
36
-        {
37
-            result[i] = elements[i];
38
-        }
39
-        result.attr("names") = wrap(names);
40
-        return result;
41
-    }
42
-
43
-    inline operator DataFrame() const
44
-    {
45
-        List result = static_cast<List>(*this);
46
-        result.attr("class") = "data.frame";
47
-        result.attr("row.names") = IntegerVector::create(NA_INTEGER, XLENGTH(elements[0]));
48
-        return result;
49
-    }
50
-
51
-private:
52
-
53
-    std::vector<std::string> names;
54
-    std::vector<SEXP> elements;
55
-
56
-    ListBuilder(ListBuilder const&) {};
57
-
58
-};
59
-
60
-
61
-#endif
... ...
@@ -1,5 +1,4 @@
1 1
 #include "RcppIdent.h"
2
-#include "ListBuilder.h"
3 2
 
4 3
 RcppIdent::RcppIdent()
5 4
 {
... ...
@@ -184,7 +183,6 @@ Rcpp::DataFrame RcppIdent::getPsmInfo(  )
184 183
 
185 184
 Rcpp::DataFrame RcppIdent::getModInfo(  )
186 185
 {
187
-    ListBuilder res;
188 186
 
189 187
     vector<SpectrumIdentificationResultPtr> spectrumIdResult = mzid->analysisCollection.spectrumIdentification[0]->spectrumIdentificationListPtr->spectrumIdentificationResult;
190 188
     vector<string> spectrumID;
... ...
@@ -303,50 +301,72 @@ Rcpp::DataFrame RcppIdent::getScore(  )
303 301
             }
304 302
         }
305 303
 
306
-        ListBuilder res;
307
-        res.add("spectrumID", Rcpp::wrap(spectrumID));
304
+        Rcpp::List res(score.size() + 1);
305
+        
306
+        names.insert(names.begin(), "spectrumID");
307
+        
308
+        res[0] = Rcpp::wrap(spectrumID);
309
+        
308 310
         for(size_t i = 0; i < score.size(); i++)
309 311
         {
310
-            res.add(underscore(names[i]), Rcpp::wrap(score[i]));
312
+			res[i + 1] = Rcpp::wrap(score[i]);
311 313
         }
314
+        
315
+        res.attr("names") = names;
316
+        Rcpp::DataFrame out(res);
312 317
 
313
-        return res;
318
+        return out;
314 319
     }
315
-
316
-
317 320
 }
318 321
 
319 322
 Rcpp::List RcppIdent::getPara(  )
320 323
 {
321
-    ListBuilder para;
322
-    vector<SpectrumIdentificationProtocolPtr> sip = mzid->analysisProtocolCollection.spectrumIdentificationProtocol;
323 324
 
324
-    para.add("searchType", Rcpp::wrap(underscore(cvTermInfo(sip[0]->searchType.cvid).name)));
325
+    std::vector<SpectrumIdentificationProtocolPtr> sip = mzid->analysisProtocolCollection.spectrumIdentificationProtocol;
326
+	std::vector<std::string> names, values;
325 327
 
328
+	names.push_back("searchType");
329
+	values.push_back(underscore(cvTermInfo(sip[0]->searchType.cvid).name));
330
+	
326 331
     for(int i = 0 ; i < sip[0]->additionalSearchParams.cvParams.size(); i++)
327 332
     {
328
-        para.add(underscore(cvTermInfo(sip[0]->additionalSearchParams.cvParams[i].cvid).name), Rcpp::wrap((bool) 1));
329
-    }
333
+		names.push_back(underscore(cvTermInfo(sip[0]->additionalSearchParams.cvParams[i].cvid).name));
334
+		values.push_back("true");
335
+	}
330 336
 
331 337
     for(int i = 0; i < sip[0]->additionalSearchParams.userParams.size(); i++)
332 338
     {
339
+		names.push_back(underscore(sip[0]->additionalSearchParams.userParams[i].name));
333 340
         if(sip[0]->additionalSearchParams.userParams[i].value.empty())
334 341
         {
335
-            para.add(underscore(sip[0]->additionalSearchParams.userParams[i].name), Rcpp::wrap((bool) 1));
336
-        }
337
-        else if(isNumber(sip[0]->additionalSearchParams.userParams[i].value))
338
-        {
339
-            para.add(underscore(sip[0]->additionalSearchParams.userParams[i].name), Rcpp::wrap(lexical_cast<double>(sip[0]->additionalSearchParams.userParams[i].value)));
342
+			values.push_back("true");
340 343
         }
341
-        else if(isBool(sip[0]->additionalSearchParams.userParams[i].value))
344
+        else
342 345
         {
343
-            para.add(underscore(sip[0]->additionalSearchParams.userParams[i].name), Rcpp::wrap(toBool(sip[0]->additionalSearchParams.userParams[i].value)));
346
+			values.push_back(sip[0]->additionalSearchParams.userParams[i].value);
344 347
         }
345
-        else
346
-            para.add(underscore(sip[0]->additionalSearchParams.userParams[i].name), Rcpp::wrap(sip[0]->additionalSearchParams.userParams[i].value));
347 348
     }
348
-
349
-    return para;
349
+    
350
+    Rcpp::List res(names.size());
351
+    
352
+    for (size_t i = 0; i < names.size(); i++)
353
+    {
354
+		if (isNumber(values[i]))
355
+		{
356
+			res[i] = Rcpp::wrap(lexical_cast<double>(values[i]));
357
+		}
358
+		else if (isBool(values[i]))
359
+		{
360
+			res[i] = Rcpp::wrap(toBool(values[i]));
361
+		}
362
+		else
363
+		{
364
+			res[i] = Rcpp::wrap(values[i]);
365
+		}
366
+	}
367
+    
368
+    res.attr("names") = names;
369
+    return res;
350 370
 }
351 371
 
352 372
 Rcpp::DataFrame RcppIdent::getDB(  )
... ...
@@ -1,7 +1,5 @@
1 1
 #include "RcppPwiz.h"
2 2
 
3
-#include "ListBuilder.h"
4
-
5 3
 RcppPwiz::RcppPwiz()
6 4
 {
7 5
     msd = NULL;
... ...
@@ -140,30 +138,54 @@ Rcpp::List RcppPwiz::getScanHeaderInfo ( int whichScan  )
140 138
         ScanHeaderStruct header;
141 139
         adapter->getScanHeader(whichScan - 1, header);
142 140
 
143
-        ListBuilder res;
144
-
145
-        res.add("seqNum",				Rcpp::wrap(header.seqNum));
146
-        res.add("acquisitionNum",		Rcpp::wrap(header.acquisitionNum));
147
-        res.add("msLevel",				Rcpp::wrap(header.msLevel));
148
-        res.add("polarity",				Rcpp::wrap(header.polarity));
149
-        res.add("peaksCount",			Rcpp::wrap(header.peaksCount));
150
-        res.add("totIonCurrent",		Rcpp::wrap(header.totIonCurrent));
151
-        res.add("retentionTime",		Rcpp::wrap(header.retentionTime));
152
-        res.add("basePeakMZ",			Rcpp::wrap(header.basePeakMZ));
153
-        res.add("basePeakIntensity",	Rcpp::wrap(header.basePeakIntensity));
154
-        res.add("collisionEnergy",		Rcpp::wrap(header.collisionEnergy));
155
-        res.add("ionisationEnergy",		Rcpp::wrap(header.ionisationEnergy));
156
-        res.add("lowMZ",				Rcpp::wrap(header.lowMZ));
157
-        res.add("highMZ",				Rcpp::wrap(header.highMZ));
158
-        res.add("precursorScanNum",		Rcpp::wrap(header.precursorScanNum));
159
-        res.add("precursorMZ",			Rcpp::wrap(header.precursorMZ));
160
-        res.add("precursorCharge",		Rcpp::wrap(header.precursorCharge));
161
-        res.add("precursorIntensity",	Rcpp::wrap(header.precursorIntensity));
162
-        res.add("mergedScan",			Rcpp::wrap(header.mergedScan));
163
-        res.add("mergedResultScanNum",	Rcpp::wrap(header.mergedResultScanNum));
164
-        res.add("mergedResultStartScanNum",	Rcpp::wrap(header.mergedResultStartScanNum));
165
-        res.add("mergedResultEndScanNum",	Rcpp::wrap(header.mergedResultEndScanNum));
166
-
141
+        Rcpp::List res(21);
142
+        std::vector<std::string> names;
143
+        int i = 0;
144
+
145
+        names.push_back("seqNum");
146
+        res[i++] = Rcpp::wrap(header.seqNum);
147
+        names.push_back("acquisitionNum");
148
+        res[i++] = Rcpp::wrap(header.acquisitionNum);
149
+        names.push_back("msLevel");
150
+        res[i++] = Rcpp::wrap(header.msLevel);
151
+        names.push_back("polarity");
152
+        res[i++] = Rcpp::wrap(header.polarity);
153
+        names.push_back("peaksCount");
154
+        res[i++] = Rcpp::wrap(header.peaksCount);
155
+        names.push_back("totIonCurrent");
156
+        res[i++] = Rcpp::wrap(header.totIonCurrent);
157
+        names.push_back("retentionTime");
158
+        res[i++] = Rcpp::wrap(header.retentionTime);
159
+        names.push_back("basePeakMZ");
160
+        res[i++] = Rcpp::wrap(header.basePeakMZ);
161
+        names.push_back("basePeakIntensity");
162
+        res[i++] = Rcpp::wrap(header.basePeakIntensity);
163
+        names.push_back("collisionEnergy");
164
+        res[i++] = Rcpp::wrap(header.collisionEnergy);
165
+        names.push_back("ionisationEnergy");
166
+        res[i++] = Rcpp::wrap(header.ionisationEnergy);
167
+        names.push_back("lowMZ");
168
+        res[i++] = Rcpp::wrap(header.lowMZ);
169
+        names.push_back("highMZ");
170
+        res[i++] = Rcpp::wrap(header.highMZ);
171
+        names.push_back("precursorScanNum");
172
+        res[i++] = Rcpp::wrap(header.precursorScanNum);
173
+        names.push_back("precursorMZ");
174
+        res[i++] = Rcpp::wrap(header.precursorMZ);
175
+        names.push_back("precursorCharge");
176
+        res[i++] = Rcpp::wrap(header.precursorCharge);
177
+        names.push_back("precursorIntensity");
178
+        res[i++] = Rcpp::wrap(header.precursorIntensity);
179
+        names.push_back("mergedScan");
180
+        res[i++] = Rcpp::wrap(header.mergedScan);
181
+        names.push_back("mergedResultScanNum");
182
+        res[i++] = Rcpp::wrap(header.mergedResultScanNum);
183
+        names.push_back("mergedResultStartScanNum");
184
+        res[i++] = Rcpp::wrap(header.mergedResultStartScanNum);
185
+        names.push_back("mergedResultEndScanNum");
186
+        res[i++] = Rcpp::wrap(header.mergedResultEndScanNum);
187
+
188
+        res.attr("names") = names;
167 189
         return res;
168 190
     }
169 191
     else
... ...
@@ -237,30 +259,55 @@ Rcpp::DataFrame RcppPwiz::getAllScanHeaderInfo ( )
237 259
                 mergedResultEndScanNum[whichScan-1] = scanHeader.mergedResultEndScanNum;
238 260
             }
239 261
 
240
-            ListBuilder header;
241
-            header.add("seqNum", seqNum);
242
-            header.add("acquisitionNum",	acquisitionNum);
243
-            header.add("msLevel",           msLevel);
244
-            header.add("polarity",          polarity);
245
-            header.add("peaksCount",        peaksCount);
246
-            header.add("totIonCurrent",     totIonCurrent);
247
-            header.add("retentionTime",     retentionTime);
248
-            header.add("basePeakMZ",        basePeakMZ);
249
-            header.add("basePeakIntensity", basePeakIntensity);
250
-            header.add("collisionEnergy",   collisionEnergy);
251
-            header.add("ionisationEnergy",  ionisationEnergy);
252
-            header.add("lowMZ",             lowMZ);
253
-            header.add("highMZ",            highMZ);
254
-            header.add("precursorScanNum",  precursorScanNum);
255
-            header.add("precursorMZ",       precursorMZ);
256
-            header.add("precursorCharge",   precursorCharge);
257
-            header.add("precursorIntensity",precursorIntensity);
258
-            header.add("mergedScan",        mergedScan);
259
-            header.add("mergedResultScanNum",      mergedResultScanNum);
260
-            header.add("mergedResultStartScanNum", mergedResultStartScanNum);
261
-            header.add("mergedResultEndScanNum",   mergedResultEndScanNum);
262
-
263
-            allScanHeaderInfo = header.get();
262
+            Rcpp::List header(21);
263
+            std::vector<std::string> names;
264
+            int i = 0;
265
+            names.push_back("seqNum");
266
+            header[i++] = Rcpp::wrap(seqNum);
267
+            names.push_back("acquisitionNum");
268
+            header[i++] = Rcpp::wrap(acquisitionNum);
269
+            names.push_back("msLevel");
270
+            header[i++] = Rcpp::wrap(msLevel);
271
+            names.push_back("polarity");
272
+            header[i++] = Rcpp::wrap(polarity);
273
+            names.push_back("peaksCount");
274
+            header[i++] = Rcpp::wrap(peaksCount);
275
+            names.push_back("totIonCurrent");
276
+            header[i++] = Rcpp::wrap(totIonCurrent);
277
+            names.push_back("retentionTime");
278
+            header[i++] = Rcpp::wrap(retentionTime);
279
+            names.push_back("basePeakMZ");
280
+            header[i++] = Rcpp::wrap(basePeakMZ);
281
+            names.push_back("basePeakIntensity");
282
+            header[i++] = Rcpp::wrap(basePeakIntensity);
283
+            names.push_back("collisionEnergy");
284
+            header[i++] = Rcpp::wrap(collisionEnergy);
285
+            names.push_back("ionisationEnergy");
286
+            header[i++] = Rcpp::wrap(ionisationEnergy);
287
+            names.push_back("lowMZ");
288
+            header[i++] = Rcpp::wrap(lowMZ);
289
+            names.push_back("highMZ");
290
+            header[i++] = Rcpp::wrap(highMZ);
291
+            names.push_back("precursorScanNum");
292
+            header[i++] = Rcpp::wrap(precursorScanNum);
293
+            names.push_back("precursorMZ");
294
+            header[i++] = Rcpp::wrap(precursorMZ);
295
+            names.push_back("precursorCharge");
296
+            header[i++] = Rcpp::wrap(precursorCharge);
297
+            names.push_back("precursorIntensity");
298
+            header[i++] = Rcpp::wrap(precursorIntensity);
299
+            names.push_back("mergedScan");
300
+            header[i++] = Rcpp::wrap(mergedScan);
301
+            names.push_back("mergedResultScanNum");
302
+            header[i++] = Rcpp::wrap(mergedResultScanNum);
303
+            names.push_back("mergedResultStartScanNum");
304
+            header[i++] = Rcpp::wrap(mergedResultStartScanNum);
305
+            names.push_back("mergedResultEndScanNum");
306
+            header[i++] = Rcpp::wrap(mergedResultEndScanNum);
307
+
308
+			header.attr("names") = names;
309
+
310
+            allScanHeaderInfo = header;
264 311
             isInCacheAllScanHeaderInfo = TRUE;
265 312
         }
266 313
         return(allScanHeaderInfo);
... ...
@@ -1,8 +1,5 @@
1 1
 #include "RcppRamp.h"
2 2
 
3
-#include "ListBuilder.h"
4
-
5
-
6 3
 RcppRamp::RcppRamp()
7 4
 {
8 5
     ramp = NULL;
... ...
@@ -150,37 +147,54 @@ Rcpp::List RcppRamp::getScanHeaderInfo ( int whichScan  )
150 147
         ScanHeaderStruct data = info->m_data;
151 148
         delete info;
152 149
 
153
-        //    Rcpp::List header = Rcpp::List::create();
154
-        ListBuilder header;
150
+        std::vector<std::string> names;
151
+        Rcpp::List header(21);
152
+        int i = 0;
155 153
 
156
-        header.add("seqNum",  Rcpp::wrap(data.seqNum));
157
-        header.add("acquisitionNum", Rcpp::wrap(data.acquisitionNum));
158
-        header.add("msLevel",       Rcpp::wrap(data.msLevel));
159
-        header.add("polarity",       Rcpp::wrap(data.polarity));
160
-        header.add("peaksCount",       Rcpp::wrap(data.peaksCount));
161
-        header.add("totIonCurrent",       Rcpp::wrap(data.totIonCurrent));
162
-        header.add("retentionTime",       Rcpp::wrap(data.retentionTime));
163
-        header.add("basePeakMZ",       Rcpp::wrap(data.basePeakMZ));
164
-        header.add("basePeakIntensity",       Rcpp::wrap(data.basePeakIntensity));
165
-        header.add("collisionEnergy",       Rcpp::wrap(data.collisionEnergy));
166
-        header.add("ionisationEnergy",       Rcpp::wrap(data.ionisationEnergy));
167
-        header.add("lowMZ",       Rcpp::wrap(data.lowMZ));
168
-        header.add("highMZ",       Rcpp::wrap(data.highMZ));
169
-        header.add("precursorScanNum",       Rcpp::wrap(data.precursorScanNum));
170
-        header.add("precursorMZ",       Rcpp::wrap(data.precursorMZ));
171
-        header.add("precursorCharge",       Rcpp::wrap(data.precursorCharge));
172
-        header.add("precursorIntensity",       Rcpp::wrap(data.precursorIntensity));
173
-        //  header.add("scanType",       Rcpp::wrap(data.scanType));
174
-        //  header.add("activationMethod",       Rcpp::wrap(data.activationMethod));
175
-        //  header.add("possibleCharges",       Rcpp::wrap(data.possibleCharges));
176
-        // header.add("numPossibleCharges",       Rcpp::wrap(data.numPossibleCharges));
177
-        //  header.add("possibleChargesArray",       Rcpp::wrap(data.possibleChargesArray));
178
-        header.add("mergedScan",       Rcpp::wrap(data.mergedScan));
179
-        header.add("mergedResultScanNum",       Rcpp::wrap(data.mergedResultScanNum));
180
-        header.add("mergedResultStartScanNum",       Rcpp::wrap(data.mergedResultStartScanNum));
181
-        header.add("mergedResultEndScanNum",       Rcpp::wrap(data.mergedResultEndScanNum));
182
-        //			     header.add("filePosition",       data.filePosition
154
+        names.push_back("seqNum");
155
+        header[i++] = Rcpp::wrap(data.seqNum);
156
+        names.push_back("acquisitionNum");
157
+        header[i++] = Rcpp::wrap(data.acquisitionNum);
158
+        names.push_back("msLevel");
159
+        header[i++] = Rcpp::wrap(data.msLevel);
160
+        names.push_back("polarity");
161
+        header[i++] = Rcpp::wrap(data.polarity);
162
+        names.push_back("peaksCount");
163
+        header[i++] = Rcpp::wrap(data.peaksCount);
164
+        names.push_back("totIonCurrent");
165
+        header[i++] = Rcpp::wrap(data.totIonCurrent);
166
+        names.push_back("retentionTime");
167
+        header[i++] = Rcpp::wrap(data.retentionTime);
168
+        names.push_back("basePeakMZ");
169
+        header[i++] = Rcpp::wrap(data.basePeakMZ);
170
+        names.push_back("basePeakIntensity");
171
+        header[i++] = Rcpp::wrap(data.basePeakIntensity);
172
+        names.push_back("collisionEnergy");
173
+        header[i++] = Rcpp::wrap(data.collisionEnergy);
174
+        names.push_back("ionisationEnergy");
175
+        header[i++] = Rcpp::wrap(data.ionisationEnergy);
176
+        names.push_back("lowMZ");
177
+        header[i++] = Rcpp::wrap(data.lowMZ);
178
+        names.push_back("highMZ");
179
+        header[i++] = Rcpp::wrap(data.highMZ);
180
+        names.push_back("precursorScanNum");
181
+        header[i++] = Rcpp::wrap(data.precursorScanNum);
182
+        names.push_back("precursorMZ");
183
+        header[i++] = Rcpp::wrap(data.precursorMZ);
184
+        names.push_back("precursorCharge");
185
+        header[i++] = Rcpp::wrap(data.precursorCharge);
186
+        names.push_back("precursorIntensity");
187
+        header[i++] = Rcpp::wrap(data.precursorIntensity);
188
+        names.push_back("mergedScan");
189
+        header[i++] = Rcpp::wrap(data.mergedScan);
190
+        names.push_back("mergedResultScanNum");
191
+        header[i++] = Rcpp::wrap(data.mergedResultScanNum);
192
+        names.push_back("mergedResultStartScanNum");
193
+        header[i++] = Rcpp::wrap(data.mergedResultStartScanNum);
194
+        names.push_back("mergedResultEndScanNum");
195
+        header[i++] = Rcpp::wrap(data.mergedResultEndScanNum);
183 196
 
197
+        header.attr("names") = names;
184 198
 
185 199
         return  header;
186 200
     }
... ...
@@ -215,11 +229,6 @@ Rcpp::DataFrame RcppRamp::getAllScanHeaderInfo ( )
215 229
             Rcpp::NumericVector precursorMZ(N);  /* only if MS level > 1 */
216 230
             Rcpp::IntegerVector precursorCharge(N);  /* only if MS level > 1 */
217 231
             Rcpp::NumericVector precursorIntensity(N);  /* only if MS level > 1 */
218
-            // char scanType[SCANTYPE_LENGTH];
219
-            // char activationMethod[SCANTYPE_LENGTH];
220
-            // char possibleCharges[SCANTYPE_LENGTH];
221
-            // int numPossibleCharges;
222
-            // bool possibleChargesArray[CHARGEARRAY_LENGTH]; /* NOTE: does NOT include "precursorCharge" information; only from "possibleCharges" */
223 232
             Rcpp::IntegerVector mergedScan(N);  /* only if MS level > 1 */
224 233
             Rcpp::IntegerVector mergedResultScanNum(N); /* scan number of the resultant merged scan */
225 234
             Rcpp::IntegerVector mergedResultStartScanNum(N); /* smallest scan number of the scanOrigin for merged scan */
... ...
@@ -251,35 +260,56 @@ Rcpp::DataFrame RcppRamp::getAllScanHeaderInfo ( )
251 260
                 mergedResultEndScanNum[whichScan-1] = scanHeader.mergedResultEndScanNum;
252 261
             }
253 262
 
254
-            ListBuilder header;
255
-            header.add("seqNum", seqNum);
256
-            header.add("acquisitionNum",           acquisitionNum);
257
-            header.add("msLevel",                  msLevel);
258
-            header.add("polarity",               polarity);
259
-            header.add("peaksCount",               peaksCount);
260
-            header.add("totIonCurrent",            totIonCurrent);
261
-            header.add("retentionTime",            retentionTime);
262
-            header.add("basePeakMZ",               basePeakMZ);
263
-            header.add("basePeakIntensity",        basePeakIntensity);
264
-            header.add("collisionEnergy",          collisionEnergy);
265
-            header.add("ionisationEnergy",         ionisationEnergy);
266
-            header.add("lowMZ",                    lowMZ);
267
-            header.add("highMZ",                   highMZ);
268
-            header.add("precursorScanNum",         precursorScanNum);
269
-            header.add("precursorMZ",              precursorMZ);
270
-            header.add("precursorCharge",          precursorCharge);
271
-            header.add("precursorIntensity",       precursorIntensity);
272
-            //  header.add("scanType",                 scanType);
273
-            //  header.add("activationMethod",         activationMethod);
274
-            //  header.add("possibleCharges",          possibleCharges);
275
-            //  header.add("numPossibleCharges",       numPossibleCharges);
276
-            //  header.add("possibleChargesArray",     possibleChargesArray);
277
-            header.add("mergedScan",               mergedScan);
278
-            header.add("mergedResultScanNum",      mergedResultScanNum);
279
-            header.add("mergedResultStartScanNum", mergedResultStartScanNum);
280
-            header.add("mergedResultEndScanNum",   mergedResultEndScanNum);
263
+            Rcpp::List header(21);
264
+            std::vector<std::string> names;
265
+            int i = 0;
281 266
 
282
-            allScanHeaderInfo = header.get();
267
+            names.push_back("seqNum");
268
+            header[i++] =Rcpp::wrap(seqNum);
269
+            names.push_back("acquisitionNum");
270
+            header[i++] =Rcpp::wrap( acquisitionNum);
271
+            names.push_back("msLevel");
272
+            header[i++] =Rcpp::wrap(msLevel);
273
+            names.push_back("polarity");
274
+            header[i++] =Rcpp::wrap(polarity);
275
+            names.push_back("peaksCount");
276
+            header[i++] =Rcpp::wrap(peaksCount);
277
+            names.push_back("totIonCurrent");
278
+            header[i++] =Rcpp::wrap(totIonCurrent);
279
+            names.push_back("retentionTime");
280
+            header[i++] =Rcpp::wrap(retentionTime);
281
+            names.push_back("basePeakMZ");
282
+            header[i++] =Rcpp::wrap(basePeakMZ);
283
+            names.push_back("basePeakIntensity");
284
+            header[i++] =Rcpp::wrap(basePeakIntensity);
285
+            names.push_back("collisionEnergy");
286
+            header[i++] =Rcpp::wrap(collisionEnergy);
287
+            names.push_back("ionisationEnergy");
288
+            header[i++] =Rcpp::wrap(ionisationEnergy);
289
+            names.push_back("lowMZ");
290
+            header[i++] =Rcpp::wrap(lowMZ);
291
+            names.push_back("highMZ");
292
+            header[i++] =Rcpp::wrap(highMZ);
293
+            names.push_back("precursorScanNum");
294
+            header[i++] =Rcpp::wrap(precursorScanNum);
295
+            names.push_back("precursorMZ");
296
+            header[i++] =Rcpp::wrap(precursorMZ);
297
+            names.push_back("precursorCharge");
298
+            header[i++] =Rcpp::wrap(precursorCharge);
299
+            names.push_back("precursorIntensity");
300
+            header[i++] =Rcpp::wrap(precursorIntensity);
301
+            names.push_back("mergedScan");
302
+            header[i++] =Rcpp::wrap(mergedScan);
303
+            names.push_back("mergedResultScanNum");
304
+            header[i++] =Rcpp::wrap(mergedResultScanNum);
305
+            names.push_back("mergedResultStartScanNum");
306
+            header[i++] =Rcpp::wrap(mergedResultStartScanNum);
307
+            names.push_back("mergedResultEndScanNum");
308
+            header[i++] =Rcpp::wrap(mergedResultEndScanNum);
309
+            
310
+			header.attr("names") = names;
311
+			
312
+            allScanHeaderInfo = header;
283 313
             isInCacheAllScanHeaderInfo = TRUE;
284 314
         }
285 315
         else