Changeset 4511
- Timestamp:
- Aug 15, 2013, 5:08:09 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugin/src/org/proteios/plugins/MgfToMzDataPlugin.java
r4499 r4511 573 573 int percent = 0; 574 574 String title = ""; 575 Float rtInSeconds = 0f;575 String rtInSeconds = "0"; 576 576 float basePeakIntensity = 0; 577 577 float totalIntensity = 0; 578 Float massToChargeRatio = 0f;579 Float intensity = 0f;578 String massToChargeRatio = "0"; 579 String intensity = "0"; 580 580 Integer chargeState = 0; 581 581 /* … … 595 595 // New spectrum, reset peaklist data 596 596 title = ""; 597 rtInSeconds = 0f;597 rtInSeconds = "0"; 598 598 basePeakIntensity = 0; 599 599 totalIntensity = 0; 600 massToChargeRatio = 0f;601 intensity = 0f;600 massToChargeRatio = "0"; 601 intensity = "0"; 602 602 chargeState = 0; 603 603 dataLength = 0; … … 634 634 if (restLine != null) 635 635 { 636 rtInSeconds = Float.valueOf(restLine);636 rtInSeconds = restLine; 637 637 } 638 638 } … … 645 645 { 646 646 StringTokenizer st = new StringTokenizer(restLine); 647 massToChargeRatio = Float.valueOf(st.nextToken());647 massToChargeRatio = st.nextToken(); 648 648 try 649 649 { 650 intensity = Float.valueOf(st.nextToken());650 intensity = st.nextToken(); 651 651 } 652 652 catch (NoSuchElementException e) 653 653 { 654 intensity = 0f;654 intensity = "0"; 655 655 } 656 656 } … … 1205 1205 */ 1206 1206 private void writeMzDataSpectrumDescBlock(XMLCrudeWriter2 xmlCWriter, 1207 Float massToChargeRatio, Floatintensity, Integer chargeState,1208 FloatrtInSeconds, String title)1207 String massToChargeRatio, String intensity, Integer chargeState, 1208 String rtInSeconds, String title) 1209 1209 throws XMLStreamException 1210 1210 { … … 1241 1241 * @param rtInSeconds Float 1242 1242 */ 1243 private void writeMzDataSpectrumSettingsBlock(XMLCrudeWriter2 xmlCWriter, FloatrtInSeconds)1243 private void writeMzDataSpectrumSettingsBlock(XMLCrudeWriter2 xmlCWriter, String rtInSeconds) 1244 1244 throws XMLStreamException 1245 1245 { … … 1267 1267 * @param rtInSeconds Float 1268 1268 */ 1269 private void writeMzDataSpectrumInstrumentBlock(XMLCrudeWriter2 xmlCWriter, FloatrtInSeconds)1269 private void writeMzDataSpectrumInstrumentBlock(XMLCrudeWriter2 xmlCWriter, String rtInSeconds) 1270 1270 throws XMLStreamException 1271 1271 { … … 1298 1298 */ 1299 1299 XMLExportUtil.writeCvParamBlock(xmlCWriter, "psi", "PSI:1000039", 1300 "TimeInSeconds", Float.toString(rtInSeconds));1300 "TimeInSeconds", rtInSeconds); 1301 1301 /* 1302 1302 * Write spectrumInstrument block end … … 1316 1316 */ 1317 1317 private void writeMzDataPrecursorListBlock(XMLCrudeWriter2 xmlCWriter, 1318 Float massToChargeRatio, Floatintensity, Integer chargeState)1318 String massToChargeRatio, String intensity, Integer chargeState) 1319 1319 throws XMLStreamException 1320 1320 { … … 1346 1346 */ 1347 1347 private void writeMzDataPrecursorBlock(XMLCrudeWriter2 xmlCWriter, 1348 Float massToChargeRatio, Floatintensity, Integer chargeState)1348 String massToChargeRatio, String intensity, Integer chargeState) 1349 1349 throws XMLStreamException 1350 1350 { … … 1387 1387 */ 1388 1388 private void writeMzDataIonSelectionBlock(XMLCrudeWriter2 xmlCWriter, 1389 Float massToChargeRatio, Floatintensity, Integer chargeState)1389 String massToChargeRatio, String intensity, Integer chargeState) 1390 1390 throws XMLStreamException 1391 1391 { … … 1398 1398 * Write cvParam tag 1399 1399 */ 1400 /*1401 * We want massToChargeRatio to be displayed with 2 decimals, even if1402 * the last ones are zeros. GroupingUsed is set to 'false' to avoid e.g.1403 * "2000.000000" being displayed as "2,000.000000". NumberFormat1404 * requires "import java.text.NumberFormat" to work.1405 */1406 NumberFormat massToChargeRatioFormat = NumberFormat.getInstance();1407 massToChargeRatioFormat.setMinimumFractionDigits(2);1408 massToChargeRatioFormat.setMaximumFractionDigits(2);1409 massToChargeRatioFormat.setGroupingUsed(false);1410 1400 XMLExportUtil.writeCvParamBlock(xmlCWriter, "psi", "PSI:1000040", 1411 "MassToChargeRatio", massToChargeRatioFormat.format( 1412 massToChargeRatio).toString()); 1401 "MassToChargeRatio", massToChargeRatio); 1413 1402 /* 1414 1403 * Write cvParam tag … … 1420 1409 */ 1421 1410 XMLExportUtil.writeCvParamBlock(xmlCWriter, "psi", "PSI:1000042", 1422 "Intensity", Float.toString(intensity));1411 "Intensity", intensity); 1423 1412 /* 1424 1413 * Write ionSelection block end
Note: See TracChangeset
for help on using the changeset viewer.