Browse code

Fix Warning from Wparentheses

Steffen Neumann authored on 26/01/2022 20:17:58
Showing1 changed files

... ...
@@ -70,7 +70,7 @@ Rcpp::List RcppPwiz::getInstrumentInfo ( )
70 70
       if (!isInCacheInstrumentInfo)
71 71
         {
72 72
 
73
-	  vector<InstrumentConfigurationPtr> icp = msd->instrumentConfigurationPtrs; // NULL for mzData	    
73
+	  vector<InstrumentConfigurationPtr> icp = msd->instrumentConfigurationPtrs; // NULL for mzData
74 74
 	  if (icp.size() != 0)
75 75
             {
76 76
 	      CVTranslator cvTranslator;
... ...
@@ -88,13 +88,13 @@ Rcpp::List RcppPwiz::getInstrumentInfo ( )
88 88
 	      // defined.
89 89
 	      // Have to use try-catch
90 90
 	      try {
91
-		ionisation = std::string(adapter.ionisation());		  
91
+		ionisation = std::string(adapter.ionisation());
92 92
 	      } catch(...) {}
93 93
 	      try {
94
-		analyzer = std::string(adapter.analyzer());		  
94
+		analyzer = std::string(adapter.analyzer());
95 95
 	      } catch(...) {}
96 96
 	      try {
97
-		detector = std::string(adapter.detector());		  
97
+		detector = std::string(adapter.detector());
98 98
 	      } catch(...) {}
99 99
 	      instrumentInfo = Rcpp::List::create(
100 100
 						  Rcpp::_["manufacturer"]  = std::string(adapter.manufacturer()),
... ...
@@ -200,7 +200,7 @@ Rcpp::DataFrame RcppPwiz::getScanHeaderInfo (Rcpp::IntegerVector whichScan) {
200 200
     Rcpp::NumericVector isolationWindowUpperOffset(N_scans);
201 201
     Rcpp::NumericVector scanWindowLowerLimit(N_scans);
202 202
     Rcpp::NumericVector scanWindowUpperLimit(N_scans);
203
-    
203
+
204 204
     for (size_t i = 0; i < N_scans; i++) {
205 205
       int current_scan = whichScan[i];
206 206
       size_t current_index = static_cast<size_t>(current_scan - 1);
... ...
@@ -236,7 +236,7 @@ Rcpp::DataFrame RcppPwiz::getScanHeaderInfo (Rcpp::IntegerVector whichScan) {
236 236
       polarity[i] = (param.cvid==MS_negative_scan ? 0 : (param.cvid==MS_positive_scan ? +1 : -1 ) );
237 237
       // centroided
238 238
       param = sp->cvParamChild(MS_spectrum_representation);
239
-      centroided[i] = (param.cvid==MS_centroid_spectrum ? TRUE : (param.cvid==MS_profile_spectrum ? FALSE : NA_LOGICAL));      
239
+      centroided[i] = (param.cvid==MS_centroid_spectrum ? TRUE : (param.cvid==MS_profile_spectrum ? FALSE : NA_LOGICAL));
240 240
       // retentionTime
241 241
       retentionTime[i] = scan.cvParam(MS_scan_start_time).timeInSeconds();
242 242
       // ionInjectionTime
... ...
@@ -301,7 +301,7 @@ Rcpp::DataFrame RcppPwiz::getScanHeaderInfo (Rcpp::IntegerVector whichScan) {
301 301
 	isolationWindowUpperOffset[i] = NA_REAL;
302 302
       }
303 303
     }
304
-    
304
+
305 305
     Rcpp::List header(31);
306 306
     std::vector<std::string> names;
307 307
     size_t i = 0;
... ...
@@ -356,19 +356,19 @@ Rcpp::DataFrame RcppPwiz::getScanHeaderInfo (Rcpp::IntegerVector whichScan) {
356 356
     names.push_back("centroided");
357 357
     header[i++] = Rcpp::wrap(centroided);
358 358
     names.push_back("ionMobilityDriftTime");
359
-    header[i++] = Rcpp::wrap(ionMobilityDriftTime);      
359
+    header[i++] = Rcpp::wrap(ionMobilityDriftTime);
360 360
     names.push_back("isolationWindowTargetMZ");
361
-    header[i++] = Rcpp::wrap(isolationWindowTargetMZ);      
361
+    header[i++] = Rcpp::wrap(isolationWindowTargetMZ);
362 362
     names.push_back("isolationWindowLowerOffset");
363
-    header[i++] = Rcpp::wrap(isolationWindowLowerOffset);      
363
+    header[i++] = Rcpp::wrap(isolationWindowLowerOffset);
364 364
     names.push_back("isolationWindowUpperOffset");
365
-    header[i++] = Rcpp::wrap(isolationWindowUpperOffset);      
365
+    header[i++] = Rcpp::wrap(isolationWindowUpperOffset);
366 366
     names.push_back("scanWindowLowerLimit");
367
-    header[i++] = Rcpp::wrap(scanWindowLowerLimit);      
367
+    header[i++] = Rcpp::wrap(scanWindowLowerLimit);
368 368
     names.push_back("scanWindowUpperLimit");
369
-    header[i++] = Rcpp::wrap(scanWindowUpperLimit);      
369
+    header[i++] = Rcpp::wrap(scanWindowUpperLimit);
370 370
     header.attr("names") = names;
371
-    
371
+
372 372
     return header;
373 373
   }
374 374
   Rf_warningcall(R_NilValue, "pwiz not yet initialized.");
... ...
@@ -380,9 +380,9 @@ Rcpp::DataFrame RcppPwiz::getAllScanHeaderInfo ( ) {
380 380
     if (!isInCacheAllScanHeaderInfo) {
381 381
       SpectrumListPtr slp = msd->run.spectrumListPtr;
382 382
       size_t N = slp->size();
383
-      
383
+
384 384
       allScanHeaderInfo = getScanHeaderInfo(Rcpp::seq(1, N));
385
-      isInCacheAllScanHeaderInfo = TRUE;	    
385
+      isInCacheAllScanHeaderInfo = TRUE;
386 386
     }
387 387
     return allScanHeaderInfo ;
388 388
   }
... ...
@@ -496,7 +496,7 @@ void RcppPwiz::copyWriteMSfile(const string& file, const string& format,
496 496
       addDataProcessing(newmsd, Rcpp::as<Rcpp::StringVector>(software_processing(sp)));
497 497
     }
498 498
   }
499
-  
499
+
500 500
   // o run
501 501
   // Initialize the run and fill with data from the original file.
502 502
   Run &original_run = msd->run;
... ...
@@ -510,7 +510,7 @@ void RcppPwiz::copyWriteMSfile(const string& file, const string& format,
510 510
   }
511 511
   // Now filling with new data
512 512
   addSpectrumList(newmsd, spctr_header, spctr_data, rtime_seconds);
513
-  
513
+
514 514
   if (format == "mgf") {
515 515
     std::ofstream* mgfOutFileP = new std::ofstream(file.c_str());
516 516
     Serializer_MGF serializerMGF;
... ...
@@ -536,7 +536,7 @@ void RcppPwiz::copyWriteMSfile(const string& file, const string& format,
536 536
   }
537 537
   else
538 538
     Rcpp::Rcerr << format << " format not supported! Please try mgf, mzML, mzXML or mz5." << std::endl;
539
-  
539
+
540 540
   // Cleanup.
541 541
   delete msd;
542 542
 }
... ...
@@ -570,7 +570,7 @@ void RcppPwiz::writeSpectrumList(const string& file, const string& format,
570 570
       addDataProcessing(newmsd, Rcpp::as<Rcpp::StringVector>(software_processing(sp)));
571 571
     }
572 572
   }
573
-  
573
+
574 574
   newmsd.run.id = "Experiment_1";
575 575
 
576 576
   // Now filling with new data
... ...
@@ -607,9 +607,9 @@ void RcppPwiz::writeSpectrumList(const string& file, const string& format,
607 607
  * o soft_proc: is supposed to be a character vector of length >= 2:
608 608
  *   soft_proc[0]: The software name (required).
609 609
  *   soft_proc[1]: The software version (required).
610
- *   soft_proc[2]: The CV ID of the software. Use "MS:-1" if not known, in 
610
+ *   soft_proc[2]: The CV ID of the software. Use "MS:-1" if not known, in
611 611
  *                 which case we are NOT writing the corresponding CV element.
612
- *   soft_proc[3-length]: CV IDs of the processing steps (optional). 
612
+ *   soft_proc[3-length]: CV IDs of the processing steps (optional).
613 613
  */
614 614
 void RcppPwiz::addDataProcessing(MSData& msd, Rcpp::StringVector soft_proc) {
615 615
   SoftwarePtr new_soft(new Software);
... ...
@@ -689,7 +689,7 @@ void RcppPwiz::addSpectrumList(MSData& msd,
689 689
   Rcpp::NumericVector isolationWindowUpperOffset = spctr_header["isolationWindowUpperOffset"];
690 690
   Rcpp::NumericVector scanWindowLowerLimit = spctr_header["scanWindowLowerLimit"];
691 691
   Rcpp::NumericVector scanWindowUpperLimit = spctr_header["scanWindowUpperLimit"];
692
-  
692
+
693 693
   // From MSnbase::Spectrum        Column in the header
694 694
   // msLevel integer               $msLevel
695 695
   // peaksCount integer
... ...
@@ -710,7 +710,7 @@ void RcppPwiz::addSpectrumList(MSData& msd,
710 710
   // precursorIntensity numeric    $precursorIntensity
711 711
   // precursorCharge integer       $precursorCharge
712 712
   // collisionEnergy numeric       $collisionEnergy
713
-  
713
+
714 714
   // Now filling with new data
715 715
   shared_ptr<SpectrumListSimple> spectrumList(new SpectrumListSimple);
716 716
   // Add the default Processing pointer (fix issue #151
... ...
@@ -771,7 +771,7 @@ void RcppPwiz::addSpectrumList(MSData& msd,
771 771
       spct_scan.scanWindows.push_back(ScanWindow(scanWindowLowerLimit[i], scanWindowUpperLimit[i], MS_m_z));
772 772
     }
773 773
     // MSn - precursor:
774
-    if (precursorScanNum[i] > 0 | precursorMZ[i] > 0) {
774
+    if ( (precursorScanNum[i] > 0) | (precursorMZ[i] > 0) ) {
775 775
       // Fill precursor data. This preserves the precursor data even if the
776 776
       // precursor scan is not available (e.g. after MS level filtering).
777 777
       spct.precursors.resize(1);
... ...
@@ -814,7 +814,7 @@ void RcppPwiz::addSpectrumList(MSData& msd,
814 814
     // [X] precursorCharge
815 815
     // [X] precursorIntensity
816 816
     // [ ] mergedScan
817
-    
817
+
818 818
     Rcpp::NumericMatrix spct_vals = spctr_data[i];
819 819
     // mz values
820 820
     Rcpp::NumericVector mz_vals = spct_vals( Rcpp::_, 0);
... ...
@@ -886,7 +886,7 @@ Rcpp::DataFrame RcppPwiz::getChromatogramHeaderInfo (Rcpp::IntegerVector whichCh
886 886
       return Rcpp::DataFrame::create();
887 887
     }
888 888
 
889
-    int N = clp->size();  
889
+    int N = clp->size();
890 890
     int N_chrom = whichChrom.size();
891 891
 
892 892
     Rcpp::StringVector chromatogramId(N_chrom); // the ID from the chrom
... ...
@@ -902,7 +902,7 @@ Rcpp::DataFrame RcppPwiz::getChromatogramHeaderInfo (Rcpp::IntegerVector whichCh
902 902
     Rcpp::NumericVector productIsolationWindowTargetMZ(N_chrom);
903 903
     Rcpp::NumericVector productIsolationWindowLowerOffset(N_chrom);
904 904
     Rcpp::NumericVector productIsolationWindowUpperOffset(N_chrom);
905
-        
905
+
906 906
     for (int i = 0; i < N_chrom; i++) {
907 907
       int current_chrom = whichChrom[i];
908 908
       if (current_chrom < 0 || current_chrom > N) {
... ...
@@ -918,7 +918,7 @@ Rcpp::DataFrame RcppPwiz::getChromatogramHeaderInfo (Rcpp::IntegerVector whichCh
918 918
 	precursorIsolationWindowTargetMZ[i] = ch->precursor.isolationWindow.cvParam(MS_isolation_window_target_m_z).value.empty() ? NA_REAL : ch->precursor.isolationWindow.cvParam(MS_isolation_window_target_m_z).valueAs<double>();
919 919
 	precursorIsolationWindowLowerOffset[i] = ch->precursor.isolationWindow.cvParam(MS_isolation_window_lower_offset).value.empty() ? NA_REAL : ch->precursor.isolationWindow.cvParam(MS_isolation_window_lower_offset).valueAs<double>();
920 920
 	precursorIsolationWindowUpperOffset[i] = ch->precursor.isolationWindow.cvParam(MS_isolation_window_upper_offset).value.empty() ? NA_REAL : ch->precursor.isolationWindow.cvParam(MS_isolation_window_upper_offset).valueAs<double>();
921
-	precursorCollisionEnergy[i] = ch->precursor.activation.cvParam(MS_collision_energy).value.empty() ? NA_REAL : ch->precursor.activation.cvParam(MS_collision_energy).valueAs<double>(); 
921
+	precursorCollisionEnergy[i] = ch->precursor.activation.cvParam(MS_collision_energy).value.empty() ? NA_REAL : ch->precursor.activation.cvParam(MS_collision_energy).valueAs<double>();
922 922
       } else {
923 923
 	precursorIsolationWindowTargetMZ[i] = NA_REAL;
924 924
 	precursorIsolationWindowLowerOffset[i] = NA_REAL;
... ...
@@ -958,7 +958,7 @@ Rcpp::DataFrame RcppPwiz::getChromatogramHeaderInfo (Rcpp::IntegerVector whichCh
958 958
     chromHeader[i++] = Rcpp::wrap(productIsolationWindowLowerOffset);
959 959
     names.push_back("productIsolationWindowUpperOffset");
960 960
     chromHeader[i++] = Rcpp::wrap(productIsolationWindowUpperOffset);
961
-    
961
+
962 962
     chromHeader.attr("names") = names;
963 963
     return chromHeader;
964 964
   }