Changeset 4311
- Timestamp:
- Mar 26, 2012, 4:52:31 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/api/core/src/org/proteios/core/File.java
r4179 r4311 48 48 import java.net.URISyntaxException; 49 49 import java.net.URL; 50 import java.net.URLConnection; 50 51 import java.security.MessageDigest; 51 52 import java.text.SimpleDateFormat; … … 279 280 "https://srm.swegrid.se/snic/bils"); 280 281 } 282 if (uri != null && uri 283 .startsWith("https://srm.swegrid.se/snic/bils/lu_proteomics/qtof/mzml/201102/K-M_Andersson")) 284 { 285 uri = uri 286 .replace( 287 "https://srm.swegrid.se/snic/bils/lu_proteomics/qtof/mzml/201102", 288 "http://fileserver.immunoprot.lth.se/tmp"); 289 } 290 if (uri != null && uri 291 .startsWith("https://srm.swegrid.se/snic/bils/lu_proteomics/qtof/mzml/201101/K-M_Andersson")) 292 { 293 uri = uri 294 .replace( 295 "https://srm.swegrid.se/snic/bils/lu_proteomics/qtof/mzml/201101", 296 "http://fileserver.immunoprot.lth.se/tmp"); 297 } 281 298 return uri; 282 299 } … … 298 315 if (uniformResourceIdentifier != null) 299 316 { 300 if (!(uniformResourceIdentifier.startsWith("http://") || uniformResourceIdentifier301 .startsWith("https://")))302 {303 thrownew InvalidDataException(304 "Protocol must be http:// or https://");305 }317 /* 318 * if (!(uniformResourceIdentifier.startsWith("http://") || 319 * uniformResourceIdentifier .startsWith("https://"))) { throw 320 * new InvalidDataException( 321 * "Protocol must be http:// or https://"); } 322 */ 306 323 new URI(uniformResourceIdentifier); 307 324 } … … 770 787 771 788 /** 772 * Set the mime type for this <code>File</code> item. It can be any 773 * mimetypeor one avalible in the mimetype table.789 * Set the mime type for this <code>File</code> item. It can be any mimetype 790 * or one avalible in the mimetype table. 774 791 * 775 792 * @param mimeType The new mime type for this item … … 1082 1099 1083 1100 /** 1084 * Get an <code>InputStream</code> that can be used to download the 1085 * physicalfile for this file item. The client application should call1086 * <code>close()</code> method to finish the download. If the physical 1087 * file isn't at the primary location there is an attempt at downloading the1088 * f ile from the URI. If no URI is given an empty stream is returned.1101 * Get an <code>InputStream</code> that can be used to download the physical 1102 * file for this file item. The client application should call 1103 * <code>close()</code> method to finish the download. If the physical file 1104 * isn't at the primary location there is an attempt at downloading the file 1105 * from the URI. If no URI is given an empty stream is returned. 1089 1106 * 1090 1107 * @param offset Start reading the physical at the specified offset, use 0 … … 1099 1116 if (getInternalName() == null) 1100 1117 { 1101 if (getUniformResourceIdentifier() != null) 1118 if (getUniformResourceIdentifier() != null && !getUniformResourceIdentifier() 1119 .startsWith("file://")) 1102 1120 { 1103 1121 try 1104 1122 { 1105 HttpURLConnection connection = getConnection(getUniformResourceIdentifier());1123 URLConnection connection = getConnection(getUniformResourceIdentifier()); 1106 1124 InputStream fis = connection.getInputStream(); 1107 1125 if (isCompressed()) … … 1120 1138 } 1121 1139 } 1140 else if (getUniformResourceIdentifier() != null && getUniformResourceIdentifier() 1141 .startsWith("file://")) 1142 { 1143 try 1144 { 1145 InputStream fis = new BufferedInputStream( 1146 new FileInputStream(getUniformResourceIdentifier() 1147 .substring(7))); 1148 if (isCompressed()) 1149 { 1150 fis = new GZIPInputStream(fis); 1151 } 1152 if (offset > 0) 1153 { 1154 fis.skip(offset); 1155 } 1156 return fis; 1157 } 1158 catch (Exception e) 1159 { 1160 throw new BaseException(e); 1161 } 1162 1163 } 1122 1164 else 1123 1165 { … … 1154 1196 1155 1197 /** 1156 * Get an <code>InputStream</code> that can be used to download the 1157 * physical file for this file item. The client application should call 1158 * <code>close()</code> method to finish the download. If the physical 1159 * file isn't at the primary location there is an attempt at downloading the 1160 * file from the URI. If no URI is given an empty stream is returned. Does 1161 * not attempt to decompress contents of a file stored compressed 1162 * internally. 1198 * Get an <code>InputStream</code> that can be used to download the physical 1199 * file for this file item. The client application should call 1200 * <code>close()</code> method to finish the download. If the physical file 1201 * isn't at the primary location there is an attempt at downloading the file 1202 * from the URI. If no URI is given an empty stream is returned. Does not 1203 * attempt to decompress contents of a file stored compressed internally. 1163 1204 * 1164 1205 * @param offset Start reading the physical at the specified offset, use 0 … … 1177 1218 try 1178 1219 { 1179 HttpURLConnection connection = getConnection(getUniformResourceIdentifier());1220 URLConnection connection = getConnection(getUniformResourceIdentifier()); 1180 1221 InputStream fis = connection.getInputStream(); 1181 1222 if (offset > 0) -
trunk/api/core/src/org/proteios/core/data/FeatureData.java
r4208 r4311 66 66 * Project origin reference. 67 67 * 68 * @hibernate.many-to-one column="`project`" not-null="true" update="false"68 * @hibernate.many-to-one column="`project`" index=`project_idx` not-null="true" update="false" 69 69 */ 70 70 public ProjectData getProject() -
trunk/client/servlet/src/content/openms_featurefinder_centroided_ini_file_template.ini
r4213 r4311 1 1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 2 <PARAMETERS version="1.3" xsi:noNamespaceSchemaLocation="http://open-ms.sourceforge.net/schemas/Param_1_3.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 3 <NODE name="FeatureFinder " description="Detects two-dimensional features in LC-MS data.">4 <ITEM name="version" value="1. 7.0" type="string" description="Version of the tool that generated this parameters file." tags="advanced" />5 <NODE name="1" description="Instance '1' section for 'FeatureFinder '">3 <NODE name="FeatureFinderCentroided" description="Detects two-dimensional features in LC-MS data."> 4 <ITEM name="version" value="1.9.0" type="string" description="Version of the tool that generated this parameters file." tags="advanced" /> 5 <NODE name="1" description="Instance '1' section for 'FeatureFinderCentroided'"> 6 6 <ITEM name="in" value="" type="string" description="input file (valid formats: 'mzML')" tags="input file" /> 7 7 <ITEM name="out" value="" type="string" description="output file (valid formats: 'featureXML')" tags="output file" /> 8 8 <ITEM name="seeds" value="" type="string" description="User-specified seed list. This feature is not supported by all algorithms! (valid formats: 'featureXML')" tags="input file" /> 9 <ITEM name="type" value="centroided" type="string" description="FeatureFinder algorithm type" restrictions="centroided,isotope_wavelet,mrm" />10 9 <ITEM name="log" value="" type="string" description="Name of log file (created only when specified)" tags="advanced" /> 11 10 <ITEM name="debug" value="0" type="int" description="Sets the debug level" tags="advanced" /> -
trunk/client/servlet/src/org/proteios/action/file/UseSpectrumFileForOpenMsSearchExtension.java
r4213 r4311 47 47 import se.lu.thep.waf.constraints.InvalidParameterValue; 48 48 import se.lu.thep.waf.constraints.VBoolean; 49 import se.lu.thep.waf.constraints.VFloat;50 import se.lu.thep.waf.constraints.VInteger;51 49 import se.lu.thep.waf.constraints.VString; 52 50 … … 174 172 validStringParam = RunOpenMs.VOPENMS_PEAKPICKER_ALGORITHM; 175 173 optionList = new ArrayList<Option>(); 176 optionList.add(new Option(" high_res", "High resolution"));177 optionList.add(new Option(" wavelet", "Wavelet"));178 selected = new String(" high_res");174 optionList.add(new Option("HiRes", "High resolution")); 175 optionList.add(new Option("Wavelet", "Wavelet")); 176 selected = new String("HighRes"); 179 177 Select<VString> peakPickerAlgorithmSelectBox = new Select<VString>(validStringParam, optionList); 180 178 peakPickerAlgorithmSelectBox.selectOption(selected); … … 200 198 validStringParam = RunOpenMs.VOPENMS_FEATUREFINDER_ALGORITHM; 201 199 optionList = new ArrayList<Option>(); 202 optionList.add(new Option(" centroided", "Centroided"));203 optionList.add(new Option(" isotope_wavelet", "Isotope wavelet"));204 selected = new String(" centroided");200 optionList.add(new Option("Centroided", "Centroided")); 201 optionList.add(new Option("IsotopeWavelet", "Isotope wavelet")); 202 selected = new String("Centroided"); 205 203 Select<VString> featureFinderAlgorithmSelectBox = new Select<VString>(validStringParam, optionList); 206 204 featureFinderAlgorithmSelectBox.selectOption(selected); -
trunk/plugin/src/org/proteios/plugins/RunOpenMsPlugin.java
r4213 r4311 28 28 package org.proteios.plugins; 29 29 30 import org.apache.commons.httpclient.methods.multipart.Part;31 import org.apache.commons.httpclient.methods.multipart.PartSource;32 import org.apache.commons.httpclient.methods.multipart.StringPart;33 30 import org.proteios.core.AbortablePluginInterface; 34 31 import org.proteios.core.BaseException; … … 40 37 import org.proteios.core.ProgressReporter; 41 38 import org.proteios.core.SessionControl; 42 import org.proteios.core.User;43 39 import org.proteios.core.plugin.About; 44 40 import org.proteios.core.plugin.AboutImpl; … … 93 89 94 90 95 StreamGobbler(InputStream is, String type, OutputStream redirect, ProgressReporter progress) 91 StreamGobbler(InputStream is, String type, OutputStream redirect, 92 ProgressReporter progress) 96 93 { 97 94 this.is = is; … … 157 154 } 158 155 159 160 156 /** 161 157 * Logger used. Used to log specific events. … … 190 186 * Constants for input data 191 187 */ 192 private final String OPENMS_PROGRAM_PEAKPICKER = " peakpicker";193 private final String OPENMS_PROGRAM_FEATUREFINDER = " featurefinder";194 private final String FEATUREFINDER_ALGORITHM_CENTROIDED = " centroided";188 private final String OPENMS_PROGRAM_PEAKPICKER = "PeakPicker"; 189 private final String OPENMS_PROGRAM_FEATUREFINDER = "FeatureFinder"; 190 private final String FEATUREFINDER_ALGORITHM_CENTROIDED = "Centroided"; 195 191 /* 196 192 * OpenMS program specifier. … … 214 210 private String lineSeparator; 215 211 212 216 213 /** 217 214 * Get size of byte buffer for writing a String to an OutputStream. … … 349 346 350 347 /** 351 * Set OpenMS INI file path. 352 * Note that this method is private, as the value is assumed 353 * to be set by the constructor. 348 * Set OpenMS INI file path. Note that this method is private, as the value 349 * is assumed to be set by the constructor. 354 350 * 355 351 * @param openMsIniFilePath String The OpenMS INI file path to set. … … 373 369 374 370 /** 375 * Set line separator string to use (Internal use only). 376 * Setter method made private to ensure that this 377 * configuration is obtained from this class. 371 * Set line separator string to use (Internal use only). Setter method made 372 * private to ensure that this configuration is obtained from this class. 378 373 * 379 374 * @param lineSeparator String The line separator string to use. … … 430 425 String openMsPeakPickerProgramName; 431 426 String openMsFeatureFinderProgramName; 432 // Integer openMsMemoryInMegaBytes;427 // Integer openMsMemoryInMegaBytes; 433 428 Boolean useExistingTemporaryInputFileFlag; 434 429 String originalSpectrumFilename; … … 447 442 448 443 openMsInstallPath = (String) job.getValue("openMsInstallPath"); 449 openMsPeakPickerProgramName = (String) job.getValue("openMsPeakPickerProgramName"); 450 openMsFeatureFinderProgramName = (String) job.getValue("openMsFeatureFinderProgramName"); 451 //openMsMemoryInMegaBytes = (Integer) job.getValue("openMsMemoryInMegaBytes"); 444 openMsPeakPickerProgramName = (String) job 445 .getValue("openMsPeakPickerProgramName"); 446 openMsFeatureFinderProgramName = (String) job 447 .getValue("openMsFeatureFinderProgramName"); 448 // openMsMemoryInMegaBytes = (Integer) 449 // job.getValue("openMsMemoryInMegaBytes"); 452 450 tmpDir = (String) job.getValue("tmpDir"); 453 451 iniFilenamePrefix = (String) job.getValue("iniFilenamePrefix"); 454 useExistingTemporaryInputFileFlag = (Boolean) job.getValue("useExistingTemporaryInputFileFlag"); 455 originalSpectrumFilename = (String) job.getValue("originalSpectrumFilename"); 456 temporaryInputFilename = (String) job.getValue("temporaryInputFilename"); 452 useExistingTemporaryInputFileFlag = (Boolean) job 453 .getValue("useExistingTemporaryInputFileFlag"); 454 originalSpectrumFilename = (String) job 455 .getValue("originalSpectrumFilename"); 456 temporaryInputFilename = (String) job 457 .getValue("temporaryInputFilename"); 457 458 spectrumFileId = (Integer) job.getValue("spectrumFileId"); 458 459 dirId = (Integer) job.getValue("dirId"); … … 462 463 openMsProgram = (String) job.getValue("openMsProgram"); 463 464 peakPickerAlgorithm = (String) job.getValue("peakPickerAlgorithm"); 464 featureFinderAlgorithm = (String) job.getValue("featureFinderAlgorithm"); 465 featureFinderIsotopicPatternChargeHigh = (Integer) job.getValue("featureFinderIsotopicPatternChargeHigh"); 466 featureFinderIsotopicPatternMzTolerance = (Float) job.getValue("featureFinderIsotopicPatternMzTolerance"); 467 featureFinderFeatureMinRtSpan = (Float) job.getValue("featureFinderFeatureMinRtSpan"); 465 featureFinderAlgorithm = (String) job 466 .getValue("featureFinderAlgorithm"); 467 featureFinderIsotopicPatternChargeHigh = (Integer) job 468 .getValue("featureFinderIsotopicPatternChargeHigh"); 469 featureFinderIsotopicPatternMzTolerance = (Float) job 470 .getValue("featureFinderIsotopicPatternMzTolerance"); 471 featureFinderFeatureMinRtSpan = (Float) job 472 .getValue("featureFinderFeatureMinRtSpan"); 468 473 log.debug("openMsInstallPath = \"" + openMsInstallPath + "\""); 469 log.debug("openMsPeakPickerProgramName = \"" + openMsPeakPickerProgramName + "\""); 470 log.debug("openMsFeatureFinderProgramName = \"" + openMsFeatureFinderProgramName + "\""); 474 log 475 .debug("openMsPeakPickerProgramName = \"" + openMsPeakPickerProgramName + "\""); 476 log 477 .debug("openMsFeatureFinderProgramName = \"" + openMsFeatureFinderProgramName + "\""); 471 478 log.debug("tmpDir = \"" + tmpDir + "\""); 472 479 log.debug("iniFilenamePrefix = \"" + iniFilenamePrefix + "\""); 473 log.debug("useExistingTemporaryInputFileFlag = " + useExistingTemporaryInputFileFlag); 474 log.debug("originalSpectrumFilename = \"" + originalSpectrumFilename + "\""); 475 log.debug("temporaryInputFilename = \"" + temporaryInputFilename + "\""); 480 log 481 .debug("useExistingTemporaryInputFileFlag = " + useExistingTemporaryInputFileFlag); 482 log 483 .debug("originalSpectrumFilename = \"" + originalSpectrumFilename + "\""); 484 log 485 .debug("temporaryInputFilename = \"" + temporaryInputFilename + "\""); 476 486 log.debug("spectrumFileId = " + spectrumFileId); 477 487 log.debug("dirId = " + dirId); … … 481 491 log.debug("openMsProgram = \"" + openMsProgram + "\""); 482 492 log.debug("peakPickerAlgorithm = \"" + peakPickerAlgorithm + "\""); 483 log.debug("featureFinderAlgorithm = \"" + featureFinderAlgorithm + "\""); 484 log.debug("featureFinderIsotopicPatternChargeHigh = " + featureFinderIsotopicPatternChargeHigh); 485 log.debug("featureFinderIsotopicPatternMzTolerance = " + featureFinderIsotopicPatternMzTolerance); 486 log.debug("featureFinderFeatureMinRtSpan = " + featureFinderFeatureMinRtSpan); 493 log 494 .debug("featureFinderAlgorithm = \"" + featureFinderAlgorithm + "\""); 495 log 496 .debug("featureFinderIsotopicPatternChargeHigh = " + featureFinderIsotopicPatternChargeHigh); 497 log 498 .debug("featureFinderIsotopicPatternMzTolerance = " + featureFinderIsotopicPatternMzTolerance); 499 log 500 .debug("featureFinderFeatureMinRtSpan = " + featureFinderFeatureMinRtSpan); 487 501 // Save OpenMS program specifier for use when processing progress info 488 502 setOpenMsProgramSpecifier(openMsProgram); … … 491 505 String programAlgorithm = new String(""); 492 506 String outputFileExtension = new String(".txt"); 493 if (openMsProgram != null && openMsProgram.equals(OPENMS_PROGRAM_PEAKPICKER)) 507 if (openMsProgram != null && openMsProgram 508 .equalsIgnoreCase(OPENMS_PROGRAM_PEAKPICKER)) 494 509 { 495 510 openMsProgramName = new String(openMsPeakPickerProgramName); … … 497 512 outputFileExtension = "." + openMsProgram + ".mzML"; 498 513 } 499 else if (openMsProgram != null && openMsProgram.equals(OPENMS_PROGRAM_FEATUREFINDER)) 514 else if (openMsProgram != null && openMsProgram 515 .equalsIgnoreCase(OPENMS_PROGRAM_FEATUREFINDER)) 500 516 { 501 517 openMsProgramName = new String(openMsFeatureFinderProgramName); … … 507 523 log.debug("outputFileExtension = " + outputFileExtension); 508 524 // Perform OpenMS feature detection using local search engine 509 openMsSearchLocal(request, response, progress, 510 tmpDir, 511 iniFilenamePrefix, 512 openMsInstallPath, openMsProgramName, programAlgorithm, 513 featureFinderIsotopicPatternChargeHigh, 525 openMsSearchLocal(request, response, progress, tmpDir, 526 iniFilenamePrefix, openMsInstallPath, openMsProgramName, 527 programAlgorithm, featureFinderIsotopicPatternChargeHigh, 514 528 featureFinderIsotopicPatternMzTolerance, 515 featureFinderFeatureMinRtSpan, 516 useExistingTemporaryInputFileFlag, originalSpectrumFilename, 517 temporaryInputFilename, 518 spectrumFileId, dirId, uploadOutputFileFlag, deleteOutputFileFlag, 529 featureFinderFeatureMinRtSpan, useExistingTemporaryInputFileFlag, 530 originalSpectrumFilename, temporaryInputFilename, spectrumFileId, 531 dirId, uploadOutputFileFlag, deleteOutputFileFlag, 519 532 outputFileExtension, timeStampStr, openMsProgram); 520 533 done(); … … 538 551 539 552 /** 540 * Start a job that performs an OpenMS feature detection using a locally installed541 * OpenMS feature detection engine.553 * Start a job that performs an OpenMS feature detection using a locally 554 * installed OpenMS feature detection engine. 542 555 * 543 556 * @param request Request … … 545 558 * @param progress ProgressReporter 546 559 * @param tmpDir String Directory for temporary files 547 * @param iniFilenamePrefix String Prefix for filename of temporary OpenMS program INI file 560 * @param iniFilenamePrefix String Prefix for filename of temporary OpenMS 561 * program INI file 548 562 * @param openMsInstallPath String The openMs install path 549 563 * @param openMsProgramName String The openMS program name 550 564 * @param programAlgorithm String The program algorithm. 551 * @param featureFinderIsotopicPatternChargeHigh Integer FeatureFinder isotopic_pattern:charge_high 552 * @param featureFinderIsotopicPatternMzTolerance Float FeatureFinder isotopic_pattern:mz_tolerance 553 * @param featureFinderFeatureMinRtSpan Float FeatureFinder feature:min_rt_span 554 * @param useExistingTemporaryInputFileFlag Boolean Flag indicating that existing temporary input file should be used. 565 * @param featureFinderIsotopicPatternChargeHigh Integer FeatureFinder 566 * isotopic_pattern:charge_high 567 * @param featureFinderIsotopicPatternMzTolerance Float FeatureFinder 568 * isotopic_pattern:mz_tolerance 569 * @param featureFinderFeatureMinRtSpan Float FeatureFinder 570 * feature:min_rt_span 571 * @param useExistingTemporaryInputFileFlag Boolean Flag indicating that 572 * existing temporary input file should be used. 555 573 * @param originalSpectrumFilename String The original spectrum filename. 556 574 * @param temporaryInputFilename String Optional temporary input filename. … … 560 578 * @param deleteOutputFileFlag Boolean The delete output file flag 561 579 * @param outputFileExtension String File extension for the output file. 562 * @param timeStampStr String Time stamp string in YYYY_MM_DD_hh_mm_ss format 580 * @param timeStampStr String Time stamp string in YYYY_MM_DD_hh_mm_ss 581 * format 563 582 * @param openMsProgram String The openMS program specifier 564 583 */ 565 584 private void openMsSearchLocal(Request request, Response response, 566 ProgressReporter progress, 567 String tmpDir, 568 String iniFilenamePrefix, 569 String openMsInstallPath, 570 String openMsProgramName, 585 ProgressReporter progress, String tmpDir, String iniFilenamePrefix, 586 String openMsInstallPath, String openMsProgramName, 571 587 String programAlgorithm, 572 588 Integer featureFinderIsotopicPatternChargeHigh, … … 574 590 Float featureFinderFeatureMinRtSpan, 575 591 Boolean useExistingTemporaryInputFileFlag, 576 String originalSpectrumFilename, 577 String temporaryInputFilename, 578 Integer spectrumFileId, 579 Integer dirId, 580 Boolean uploadOutputFileFlag, 581 Boolean deleteOutputFileFlag, 582 String outputFileExtension, 583 String timeStampStr, String openMsProgram) 592 String originalSpectrumFilename, String temporaryInputFilename, 593 Integer spectrumFileId, Integer dirId, 594 Boolean uploadOutputFileFlag, Boolean deleteOutputFileFlag, 595 String outputFileExtension, String timeStampStr, 596 String openMsProgram) 584 597 { 585 598 log.debug("openMsInstallPath = \"" + openMsInstallPath + "\""); 586 599 log.debug("openMsProgramName = \"" + openMsProgramName + "\""); 587 600 log.debug("programAlgorithm = " + programAlgorithm); 588 log.debug("featureFinderIsotopicPatternChargeHigh = " + featureFinderIsotopicPatternChargeHigh); 589 log.debug("featureFinderIsotopicPatternMzTolerance = " + featureFinderIsotopicPatternMzTolerance); 590 log.debug("featureFinderFeatureMinRtSpan = " + featureFinderFeatureMinRtSpan); 601 log 602 .debug("featureFinderIsotopicPatternChargeHigh = " + featureFinderIsotopicPatternChargeHigh); 603 log 604 .debug("featureFinderIsotopicPatternMzTolerance = " + featureFinderIsotopicPatternMzTolerance); 605 log 606 .debug("featureFinderFeatureMinRtSpan = " + featureFinderFeatureMinRtSpan); 591 607 log.debug("tmpDir = \"" + tmpDir + "\""); 592 608 log.debug("iniFilenamePrefix = \"" + iniFilenamePrefix + "\""); 593 log.debug("useExistingTemporaryInputFileFlag = " + useExistingTemporaryInputFileFlag); 594 log.debug("originalSpectrumFilename = \"" + originalSpectrumFilename + "\""); 595 log.debug("temporaryInputFilename = \"" + temporaryInputFilename + "\""); 609 log 610 .debug("useExistingTemporaryInputFileFlag = " + useExistingTemporaryInputFileFlag); 611 log 612 .debug("originalSpectrumFilename = \"" + originalSpectrumFilename + "\""); 613 log 614 .debug("temporaryInputFilename = \"" + temporaryInputFilename + "\""); 596 615 log.debug("spectrumFileId = " + spectrumFileId); 597 616 log.debug("dirId = " + dirId); 598 617 log.debug("uploadOutputFileFlag = " + uploadOutputFileFlag); 599 618 log.debug("deleteOutputFileFlag = " + deleteOutputFileFlag); 600 log.debug("outputFileExtension = \"" + outputFileExtension + "\""); 619 log.debug("outputFileExtension = \"" + outputFileExtension + "\""); 601 620 log.debug("timeStampStr = \"" + timeStampStr + "\""); 602 621 log.debug("openMsProgram = \"" + openMsProgram + "\""); … … 613 632 log.debug("openMsOutputDirPath = \"" + openMsOutputDirPath + "\""); 614 633 openMsOutputDirPath = tmpDir + "/" + openMsOutputDirPath; 615 log.debug("openMsOutputDirPath (modified) = \"" + openMsOutputDirPath + "\""); 634 log 635 .debug("openMsOutputDirPath (modified) = \"" + openMsOutputDirPath + "\""); 616 636 // 617 637 DbControl dc = sc.newDbControl(); … … 619 639 // Create output file type 620 640 FileType outputFileType = null; 621 if (openMsProgram != null && openMsProgram.equals(OPENMS_PROGRAM_PEAKPICKER)) 641 if (openMsProgram != null && openMsProgram 642 .equalsIgnoreCase(OPENMS_PROGRAM_PEAKPICKER)) 622 643 { 623 644 outputFileType = factory.getBySystemId(FileType.class, 624 645 FileType.MZML); 625 646 } 626 else if (openMsProgram != null && openMsProgram.equals(OPENMS_PROGRAM_FEATUREFINDER)) 647 else if (openMsProgram != null && openMsProgram 648 .equalsIgnoreCase(OPENMS_PROGRAM_FEATUREFINDER)) 627 649 { 628 650 outputFileType = factory.getBySystemId(FileType.class, 629 651 FileType.OPENMS_FEATURES); 630 652 } 653 if (programAlgorithm != null && !programAlgorithm.equals("")) 654 { 655 openMsProgramPath += programAlgorithm; 656 } 657 631 658 /* 632 // Get spectrum file633 File spectrumFile = factory.getById(File.class, spectrumFileId);634 log.debug("spectrumFile (original) = " + spectrumFile);635 // Get spectrum file size in bytes for progress calculation636 long fileSizeInBytes = spectrumFile.getSizeInBytes();637 setInputFileSizeInBytes(fileSizeInBytes);638 */639 // Always use original spectrum filename, even if a converted file isused for OpenMS feature detection640 // String originalSpectrumFilename = spectrumFile.getName();659 * // Get spectrum file File spectrumFile = factory.getById(File.class, 660 * spectrumFileId); log.debug("spectrumFile (original) = " + 661 * spectrumFile); // Get spectrum file size in bytes for progress 662 * calculation long fileSizeInBytes = spectrumFile.getSizeInBytes(); 663 * setInputFileSizeInBytes(fileSizeInBytes); 664 */ 665 // Always use original spectrum filename, even if a converted file is 666 // used for OpenMS feature detection 667 // String originalSpectrumFilename = spectrumFile.getName(); 641 668 String spectrumBaseFilename = new String(originalSpectrumFilename); 642 669 String fileExtension = new String(""); … … 644 671 if (dotIndex > 0) 645 672 { 646 fileExtension = originalSpectrumFilename.substring(dotIndex+1); 647 spectrumBaseFilename = originalSpectrumFilename.substring(0, dotIndex); 673 fileExtension = originalSpectrumFilename.substring(dotIndex + 1); 674 spectrumBaseFilename = originalSpectrumFilename.substring(0, 675 dotIndex); 648 676 } 649 677 // Copy spectrum file item to local file used for OpenMS input 650 678 progress.display(0, "Making local file copy"); 651 String openMsInputBaseFilename = new String(spectrumBaseFilename + "_" + timeStampStr); 679 String openMsInputBaseFilename = new String( 680 spectrumBaseFilename + "_" + timeStampStr); 652 681 String openMsInputFilename = new String(openMsInputBaseFilename); 653 682 if (!fileExtension.equals("")) … … 655 684 openMsInputFilename = openMsInputFilename + "." + fileExtension; 656 685 } 657 //log.debug("originalSpectrumFilename = \"" + originalSpectrumFilename + "\""); 686 // log.debug("originalSpectrumFilename = \"" + originalSpectrumFilename 687 // + "\""); 658 688 log.debug("spectrumBaseFilename = \"" + spectrumBaseFilename + "\""); 659 689 log.debug("fileExtension = \"" + fileExtension + "\""); 660 log.debug("openMsInputBaseFilename = \"" + openMsInputBaseFilename + "\""); 690 log 691 .debug("openMsInputBaseFilename = \"" + openMsInputBaseFilename + "\""); 661 692 log.debug("openMsInputFilename = \"" + openMsInputFilename + "\""); 662 693 // Get temporary local input file name to use … … 674 705 log.debug("temporaryInputFilename used = " + temporaryInputFilename); 675 706 // Get input file path 676 String openMsInputFilePath = new String(tmpDir + "/" + temporaryInputFilename); 707 String openMsInputFilePath = new String( 708 tmpDir + "/" + temporaryInputFilename); 677 709 log.debug("openMsInputFilePath = \"" + openMsInputFilePath + "\""); 678 710 // Get temporary local input file … … 686 718 setInputFileSizeInBytes(fileSizeInBytes); 687 719 // Perform a number of attempts to create local file copy 688 temporaryInputFileExists = makeTemporaryLocalFileCopy(spectrumFile, openMsInputFilePath); 689 } 690 log.debug("temporaryInputFileExists = " + temporaryInputFileExists); 720 temporaryInputFileExists = makeTemporaryLocalFileCopy(spectrumFile, 721 openMsInputFilePath); 722 } 723 log.debug("temporaryInputFileExists = " + temporaryInputFileExists); 691 724 String spectrumPath = new String(openMsInputFilePath); 692 log.debug("spectrumPath for temporary file used for local OpenMS feature detection = " + spectrumPath); 725 log 726 .debug("spectrumPath for temporary file used for local OpenMS feature detection = " + spectrumPath); 693 727 // Create OpenMS output file name 694 728 String openMsOutputFilename = openMsInputBaseFilename + outputFileExtension; … … 699 733 } 700 734 String openMsOutputPath = openMsOutputDirPath + delimiter + openMsOutputFilename; 701 log.debug("openMsOutputFilename = \"" + openMsOutputFilename + "\""); 735 log.debug("openMsOutputFilename = \"" + openMsOutputFilename + "\""); 702 736 log.debug("openMsOutputPath = \"" + openMsOutputPath + "\""); 703 737 // Create OpenMS INI file if needed 704 738 String openMsIniFilePath = null; 705 log.debug("openMsProgram = \"" + openMsProgram + "\" programAlgorithm = \"" + programAlgorithm + "\""); 706 openMsIniFilePath = createOpenMsIniFile( 707 tmpDir, 708 iniFilenamePrefix, 709 timeStampStr, 710 openMsProgram, 711 programAlgorithm, 739 log 740 .debug("openMsProgram = \"" + openMsProgram + "\" programAlgorithm = \"" + programAlgorithm + "\""); 741 openMsIniFilePath = createOpenMsIniFile(tmpDir, iniFilenamePrefix, 742 timeStampStr, openMsProgram, programAlgorithm, 712 743 featureFinderIsotopicPatternChargeHigh, 713 744 featureFinderIsotopicPatternMzTolerance, 714 745 featureFinderFeatureMinRtSpan); 715 746 log.debug("openMsIniFilePath = " + openMsIniFilePath); 716 // Prepare OpenMS feature detection command for use with local installation 747 // Prepare OpenMS feature detection command for use with local 748 // installation 717 749 boolean imported = false; 718 750 try … … 721 753 if (!temporaryInputFileExists) 722 754 { 723 throw new IOException("Temporary spectrum file \"" + spectrumPath + "\" could no be saved. Closing down."); 755 throw new IOException( 756 "Temporary spectrum file \"" + spectrumPath + "\" could no be saved. Closing down."); 724 757 } 725 758 List<String> cmdList = new ArrayList<String>(); … … 729 762 cmdList.add("-out"); 730 763 cmdList.add(openMsOutputPath); 731 if (programAlgorithm != null && !programAlgorithm.equals(""))732 {733 // Add algorithm option734 cmdList.add("-type");735 cmdList.add(programAlgorithm);736 }737 764 if (openMsIniFilePath != null && !openMsIniFilePath.equals("")) 738 765 { … … 749 776 deleteFile(tmpDir, temporaryInputFilename); 750 777 // Delete other temporary files 751 cleanUpTemporaryOpenMsFiles(tmpDir, openMsInputBaseFilename, true, outputFileExtension); 778 cleanUpTemporaryOpenMsFiles(tmpDir, openMsInputBaseFilename, 779 true, outputFileExtension); 752 780 throw new IOException("Job command is aborted. Closing down."); 753 781 } … … 759 787 Process proc = rt.exec(cmdArr); 760 788 /* 761 // any error message? 762 StreamGobbler errorGobbler = new StreamGobbler(proc 763 .getErrorStream(), "ERR"); 764 */ 789 * // any error message? StreamGobbler errorGobbler = new 790 * StreamGobbler(proc .getErrorStream(), "ERR"); 791 */ 765 792 // Parse out stream for progress info 766 793 // any error message? … … 779 806 catch (InterruptedException se) 780 807 { 781 log.warn("InterruptedException when performing OpenMS feature detection via locally installed search engine: " + se); 808 log 809 .warn("InterruptedException when performing OpenMS feature detection via locally installed search engine: " + se); 782 810 abort(); 783 811 proc.destroy(); … … 792 820 deleteFile(tmpDir, temporaryInputFilename); 793 821 // Delete other temporary files 794 cleanUpTemporaryOpenMsFiles(tmpDir, openMsInputBaseFilename, true, outputFileExtension); 822 cleanUpTemporaryOpenMsFiles(tmpDir, openMsInputBaseFilename, 823 true, outputFileExtension); 795 824 throw new IOException("Job command is aborted. Closing down."); 796 825 } … … 817 846 String testOutputFilename = openMsInputBaseFilename + outputFileExtension; 818 847 // Construct filename to use for uploaded result file 819 // Example: Spectrum file sample.mzML gets result file sample.peakpicker.mzML 848 // Example: Spectrum file sample.mzML gets result file 849 // sample.peakpicker.mzML 820 850 String filenameOfUploadedFile = spectrumBaseFilename + outputFileExtension; 821 851 if (localFileCanBeRead(tmpDir, testOutputFilename)) … … 825 855 else 826 856 { 827 // Test output filename including original file extension in name 857 // Test output filename including original file extension in 858 // name 828 859 testOutputFilename = openMsInputFilename + outputFileExtension; 829 860 // Construct filename to use for uploaded result file 830 // Example: Spectrum file sample.mzml gets result file sample.peakpicker.mzml 861 // Example: Spectrum file sample.mzml gets result file 862 // sample.peakpicker.mzml 831 863 filenameOfUploadedFile = originalSpectrumFilename + outputFileExtension; 832 864 if (localFileCanBeRead(tmpDir, testOutputFilename)) … … 843 875 } 844 876 } 845 log.debug("openMsOutputFilename = \"" + openMsOutputFilename + "\""); 846 log.debug("openMsOutputPath = \"" + openMsOutputPath + "\""); 877 log 878 .debug("openMsOutputFilename = \"" + openMsOutputFilename + "\""); 879 log.debug("openMsOutputPath = \"" + openMsOutputPath + "\""); 847 880 // 848 881 String programNameStr = "unknown program"; 849 if (openMsProgram.equals (OPENMS_PROGRAM_PEAKPICKER))882 if (openMsProgram.equalsIgnoreCase(OPENMS_PROGRAM_PEAKPICKER)) 850 883 { 851 884 programNameStr = "PeakPicker"; 852 885 } 853 else if (openMsProgram.equals(OPENMS_PROGRAM_FEATUREFINDER)) 886 else if (openMsProgram 887 .equalsIgnoreCase(OPENMS_PROGRAM_FEATUREFINDER)) 854 888 { 855 889 programNameStr = "FeatureFinder"; 856 890 } 857 String doneMessage = new String("OpenMS feature detection with " + programNameStr + " finished"); 891 String doneMessage = new String( 892 "OpenMS feature detection with " + programNameStr + " finished"); 858 893 // 859 894 doneMessage = doneMessage + "\n" + "OpenMS input file: " + originalSpectrumFilename; 860 895 // 861 log 862 .debug("openMsOutputPath = \"" + openMsOutputPath + "\""); 896 log.debug("openMsOutputPath = \"" + openMsOutputPath + "\""); 863 897 doneMessage = doneMessage + "\n" + "OpenMS output file: " + openMsOutputPath; 864 898 // Optional upload of OpenMS output file … … 872 906 try 873 907 { 874 log.debug("filenameOfUploadedFile = \"" + filenameOfUploadedFile + "\""); 875 uploadOpenMsOutputFile(tmpDir, 876 openMsOutputFilename, filenameOfUploadedFile, dirId, description, outputFileType); 908 log 909 .debug("filenameOfUploadedFile = \"" + filenameOfUploadedFile + "\""); 910 uploadOpenMsOutputFile(tmpDir, openMsOutputFilename, 911 filenameOfUploadedFile, dirId, description, 912 outputFileType); 877 913 outputFileUploaded = true; 878 914 doneMessage = doneMessage + "\n" + "Output file uploaded: " + filenameOfUploadedFile; … … 891 927 // Delete temporary input file 892 928 deleteFile(tmpDir, temporaryInputFilename); 893 // Clean up temporary files (result file only deleted if it could be uploaded) 929 // Clean up temporary files (result file only deleted if it could be 930 // uploaded) 894 931 boolean deleteResultFile = deleteOutputFileFlag; 895 932 if (uploadOutputFileFlag != null && uploadOutputFileFlag) … … 902 939 } 903 940 log.debug("deleteResultFile = " + deleteResultFile); 904 cleanUpTemporaryOpenMsFiles(tmpDir, openMsInputBaseFilename, deleteResultFile, outputFileExtension); 941 cleanUpTemporaryOpenMsFiles(tmpDir, openMsInputBaseFilename, 942 deleteResultFile, outputFileExtension); 905 943 // Delete temporary OpenMS INI file 906 944 deleteOptionalFile(openMsIniFilePath); … … 921 959 programNameStr = "FeatureFinder"; 922 960 } 923 String errorMessage = new String("Nothing searched using OpenMS feature detection with " + programNameStr); 961 String errorMessage = new String( 962 "Nothing searched using OpenMS feature detection with " + programNameStr); 924 963 // 925 964 errorMessage = errorMessage + "\n" + "OpenMS input file: " + openMsInputFilename; … … 935 974 else 936 975 { 937 err.add(new BaseException("No OpenMS feature detection could be performed")); 976 err.add(new BaseException( 977 "No OpenMS feature detection could be performed")); 938 978 response.setError(errorMessage, err); 939 979 } … … 941 981 deleteFile(tmpDir, temporaryInputFilename); 942 982 // Clean up temporary files 943 cleanUpTemporaryOpenMsFiles(tmpDir, openMsInputBaseFilename, true, outputFileExtension); 983 cleanUpTemporaryOpenMsFiles(tmpDir, openMsInputBaseFilename, true, 984 outputFileExtension); 944 985 // Delete temporary OpenMS INI file 945 deleteOptionalFile(openMsIniFilePath);986 // deleteOptionalFile(openMsIniFilePath); 946 987 } 947 988 } … … 955 996 * @return boolean Returns 'true' if copying was successful, else 'false'. 956 997 */ 957 private boolean makeTemporaryLocalFileCopy(File sourceFile, String localFilePath) 998 private boolean makeTemporaryLocalFileCopy(File sourceFile, 999 String localFilePath) 958 1000 { 959 1001 // Perform a number of tries to copy file … … 975 1017 if (numFileCopyAttempts >= MAX_NUMBER_OF_FILE_COPY_ATTEMPTS) 976 1018 { 977 errorInfo = new String("IOException when trying to save temporary file \"" + localFileTmp + "\": " + e); 978 } 979 } 980 } 981 log.debug("fileCopied = " + fileCopied + " numFileCopyAttempts = " + numFileCopyAttempts); 1019 errorInfo = new String( 1020 "IOException when trying to save temporary file \"" + localFileTmp + "\": " + e); 1021 } 1022 } 1023 } 1024 log 1025 .debug("fileCopied = " + fileCopied + " numFileCopyAttempts = " + numFileCopyAttempts); 982 1026 return fileCopied; 983 1027 } … … 1096 1140 * 1097 1141 * @param progress ProgressReporter The progress reporter instance to use. 1098 * @param line String The information string to parse for progress information 1099 */ 1100 private void updateProgressInformation(ProgressReporter progress, String line) 1142 * @param line String The information string to parse for progress 1143 * information 1144 */ 1145 private void updateProgressInformation(ProgressReporter progress, 1146 String line) 1101 1147 { 1102 1148 // Parse output for progress report 1103 1149 if (progress != null) 1104 1150 { 1105 if (getOpenMsProgramSpecifier().equals(OPENMS_PROGRAM_PEAKPICKER)) 1151 if (getOpenMsProgramSpecifier().equalsIgnoreCase( 1152 OPENMS_PROGRAM_PEAKPICKER)) 1106 1153 { 1107 1154 if (line.contains("Progress of 'loading mzML file':")) … … 1109 1156 setCurrentPhase(1); 1110 1157 setCurrentPhaseStr("Loading mzML file"); 1111 } 1158 } 1112 1159 else if (line.contains("Progress of 'loading chromatograms':")) 1113 1160 { 1114 1161 setCurrentPhase(2); 1115 1162 setCurrentPhaseStr("Loading chromatograms"); 1116 } 1163 } 1117 1164 else if (line.contains("Progress of 'picking peaks':")) 1118 1165 { 1119 1166 setCurrentPhase(3); 1120 1167 setCurrentPhaseStr("Picking peaks"); 1121 } 1168 } 1122 1169 else if (line.contains("Progress of 'storing mzML file':")) 1123 1170 { 1124 1171 setCurrentPhase(4); 1125 1172 setCurrentPhaseStr("Storing mzML file"); 1126 } 1127 } 1128 else if (getOpenMsProgramSpecifier().equals(OPENMS_PROGRAM_FEATUREFINDER)) 1173 } 1174 } 1175 else if (getOpenMsProgramSpecifier().equalsIgnoreCase( 1176 OPENMS_PROGRAM_FEATUREFINDER)) 1129 1177 { 1130 1178 if (line.contains("Progress of 'loading mzML file':")) … … 1132 1180 setCurrentPhase(1); 1133 1181 setCurrentPhaseStr("Loading mzML file"); 1134 } 1135 else if (line.contains("Progress of 'Precalculating intensity scores':")) 1182 } 1183 else if (line 1184 .contains("Progress of 'Precalculating intensity scores':")) 1136 1185 { 1137 1186 setCurrentPhase(2); 1138 1187 setCurrentPhaseStr("Precalculating intensity scores"); 1139 } 1140 else if (line.contains("Progress of 'Precalculating mass trace scores':")) 1188 } 1189 else if (line 1190 .contains("Progress of 'Precalculating mass trace scores':")) 1141 1191 { 1142 1192 setCurrentPhase(3); 1143 1193 setCurrentPhaseStr("Precalculating mass trace scores"); 1144 } 1145 else if (line.contains("Progress of 'Precalculating isotope distributions':")) 1194 } 1195 else if (line 1196 .contains("Progress of 'Precalculating isotope distributions':")) 1146 1197 { 1147 1198 setCurrentPhase(4); 1148 1199 setCurrentPhaseStr("Precalculating isotope distributions"); 1149 } 1150 else if (line.contains("Progress of 'Calculating isotope pattern scores for charge 1':")) 1200 } 1201 else if (line 1202 .contains("Progress of 'Calculating isotope pattern scores for charge 1':")) 1151 1203 { 1152 1204 setCurrentPhase(5); 1153 1205 setCurrentPhaseStr("Calculating isotope pattern scores for charge 1"); 1154 } 1155 else if (line.contains(">Progress of 'Finding seeds for charge 1':")) 1206 } 1207 else if (line 1208 .contains(">Progress of 'Finding seeds for charge 1':")) 1156 1209 { 1157 1210 setCurrentPhase(6); 1158 1211 setCurrentPhaseStr("Finding seeds for charge 1"); 1159 } 1160 else if (line.contains("Progress of 'Extending seeds for charge 1':")) 1212 } 1213 else if (line 1214 .contains("Progress of 'Extending seeds for charge 1':")) 1161 1215 { 1162 1216 setCurrentPhase(7); 1163 1217 setCurrentPhaseStr("Extending seeds for charge 1"); 1164 } 1165 else if (line.contains("Progress of 'Calculating isotope pattern scores for charge 2':")) 1218 } 1219 else if (line 1220 .contains("Progress of 'Calculating isotope pattern scores for charge 2':")) 1166 1221 { 1167 1222 setCurrentPhase(8); 1168 1223 setCurrentPhaseStr("Calculating isotope pattern scores for charge 2"); 1169 } 1170 else if (line.contains(">Progress of 'Finding seeds for charge 2':")) 1224 } 1225 else if (line 1226 .contains(">Progress of 'Finding seeds for charge 2':")) 1171 1227 { 1172 1228 setCurrentPhase(9); 1173 1229 setCurrentPhaseStr("Finding seeds for charge 2"); 1174 } 1175 else if (line.contains("Progress of 'Extending seeds for charge 2':")) 1230 } 1231 else if (line 1232 .contains("Progress of 'Extending seeds for charge 2':")) 1176 1233 { 1177 1234 setCurrentPhase(10); 1178 1235 setCurrentPhaseStr("Extending seeds for charge 2"); 1179 } 1180 else if (line.contains("Progress of 'Calculating isotope pattern scores for charge 3':")) 1236 } 1237 else if (line 1238 .contains("Progress of 'Calculating isotope pattern scores for charge 3':")) 1181 1239 { 1182 1240 setCurrentPhase(11); 1183 1241 setCurrentPhaseStr("Calculating isotope pattern scores for charge 3"); 1184 } 1185 else if (line.contains(">Progress of 'Finding seeds for charge 3':")) 1242 } 1243 else if (line 1244 .contains(">Progress of 'Finding seeds for charge 3':")) 1186 1245 { 1187 1246 setCurrentPhase(12); 1188 1247 setCurrentPhaseStr("Finding seeds for charge 3"); 1189 } 1190 else if (line.contains("Progress of 'Extending seeds for charge 3':")) 1248 } 1249 else if (line 1250 .contains("Progress of 'Extending seeds for charge 3':")) 1191 1251 { 1192 1252 setCurrentPhase(13); 1193 1253 setCurrentPhaseStr("Extending seeds for charge 3"); 1194 } 1195 else if (line.contains("Progress of 'Calculating isotope pattern scores for charge 4':")) 1254 } 1255 else if (line 1256 .contains("Progress of 'Calculating isotope pattern scores for charge 4':")) 1196 1257 { 1197 1258 setCurrentPhase(14); 1198 1259 setCurrentPhaseStr("Calculating isotope pattern scores for charge 4"); 1199 } 1200 else if (line.contains(">Progress of 'Finding seeds for charge 4':")) 1260 } 1261 else if (line 1262 .contains(">Progress of 'Finding seeds for charge 4':")) 1201 1263 { 1202 1264 setCurrentPhase(15); 1203 1265 setCurrentPhaseStr("Finding seeds for charge 4"); 1204 } 1205 else if (line.contains("Progress of 'Extending seeds for charge 4':")) 1266 } 1267 else if (line 1268 .contains("Progress of 'Extending seeds for charge 4':")) 1206 1269 { 1207 1270 setCurrentPhase(16); 1208 1271 setCurrentPhaseStr("Extending seeds for charge 4"); 1209 } 1210 else if (line.contains("Progress of 'Resolving overlapping features':")) 1272 } 1273 else if (line 1274 .contains("Progress of 'Resolving overlapping features':")) 1211 1275 { 1212 1276 setCurrentPhase(17); 1213 1277 setCurrentPhaseStr("Resolving overlapping features"); 1214 } 1278 } 1215 1279 } 1216 1280 if (line.contains(" %")) 1217 1281 { 1218 // OpenMS programs typically outputs a percentage phase progress line like "18.15 %", with an optional message after the % sign. 1282 // OpenMS programs typically outputs a percentage phase progress 1283 // line like "18.15 %", with an optional message after the % 1284 // sign. 1219 1285 String testStr = new String(" %"); 1220 1286 int index = line.indexOf(testStr); … … 1224 1290 String percentStr = line.substring(0, index); 1225 1291 /* 1226 System.out1227 .println(this.getClass().getSimpleName() +": percentStr (1) = \"" + percentStr + "\"");1228 */1292 * System.out .println(this.getClass().getSimpleName() + 1293 * ": percentStr (1) = \"" + percentStr + "\""); 1294 */ 1229 1295 // Convert percent string to double 1230 1296 double phasePercentCompleted = 0.0; … … 1237 1303 // Construct progress message 1238 1304 // Example; progressMessage = "Loading mzML file: 18.15%"" 1239 String progressMessage = new String(getCurrentPhaseStr() + ": " + percentStr + "%"); 1305 String progressMessage = new String( 1306 getCurrentPhaseStr() + ": " + percentStr + "%"); 1240 1307 // Total progress includes more than OpenMS analysis 1241 int percentCompleted = EstimatedTotalPercentage(phasePercentCompleted, getCurrentPhase()); 1308 int percentCompleted = EstimatedTotalPercentage( 1309 phasePercentCompleted, getCurrentPhase()); 1242 1310 if (percentCompleted > 99) 1243 1311 { … … 1252 1320 1253 1321 /** 1254 * Estimates total percentage of time to completion. 1255 * Assumes a fixed numberof phases for each application.1322 * Estimates total percentage of time to completion. Assumes a fixed number 1323 * of phases for each application. 1256 1324 * 1257 1325 * @param percentage double Percentage in current phase. … … 1262 1330 { 1263 1331 int numberOfPhases = 17; 1264 if (getOpenMsProgramSpecifier().equals(OPENMS_PROGRAM_PEAKPICKER)) 1332 if (getOpenMsProgramSpecifier().equalsIgnoreCase( 1333 OPENMS_PROGRAM_PEAKPICKER)) 1265 1334 { 1266 1335 numberOfPhases = 4; 1267 1336 } 1268 else if (getOpenMsProgramSpecifier().equals(OPENMS_PROGRAM_FEATUREFINDER)) 1337 else if (getOpenMsProgramSpecifier().equalsIgnoreCase( 1338 OPENMS_PROGRAM_FEATUREFINDER)) 1269 1339 { 1270 1340 numberOfPhases = 17; … … 1274 1344 phase = 1; 1275 1345 } 1276 // Simple estimate of total progress based on all phases taking equally long time 1277 double phaseFraction = percentage/100.0; 1278 // Total fraction is calculated from (phase - 1) finished phases and phaseFraction of current phase 1279 double totalFraction = ((double)(phase - 1) + phaseFraction)/((double) numberOfPhases); 1346 // Simple estimate of total progress based on all phases taking equally 1347 // long time 1348 double phaseFraction = percentage / 100.0; 1349 // Total fraction is calculated from (phase - 1) finished phases and 1350 // phaseFraction of current phase 1351 double totalFraction = ((double) (phase - 1) + phaseFraction) / ((double) numberOfPhases); 1280 1352 if (totalFraction > 1.0) 1281 1353 { 1282 1354 totalFraction = 1.0; 1283 1355 } 1284 double totalPercentage = 100.0 *totalFraction;1356 double totalPercentage = 100.0 * totalFraction; 1285 1357 int totalIntegerPercentage = (int) totalPercentage; 1286 // System.out.println(this.getClass().getSimpleName() + ": percentage = " + percentage + " isAnalysisPhase = " + isAnalysisPhase + " fileSizeInBytes = " + fileSizeInBytes + " analysisIndexingRatio = " + analysisIndexingRatio + " totalPercentage = " + totalPercentage + " totalIntegerPercentage = " + totalIntegerPercentage); 1358 // System.out.println(this.getClass().getSimpleName() + 1359 // ": percentage = " + percentage + " isAnalysisPhase = " + 1360 // isAnalysisPhase + " fileSizeInBytes = " + fileSizeInBytes + 1361 // " analysisIndexingRatio = " + analysisIndexingRatio + 1362 // " totalPercentage = " + totalPercentage + 1363 // " totalIntegerPercentage = " + totalIntegerPercentage); 1287 1364 return totalIntegerPercentage; 1288 1365 } … … 1290 1367 1291 1368 /** 1292 * Uploads output file from locally installed OpenMS feature detection engine into 1293 * Proteios. 1294 * 1295 * @param directoryPath String Path to directory where output file is created 1369 * Uploads output file from locally installed OpenMS feature detection 1370 * engine into Proteios. 1371 * 1372 * @param directoryPath String Path to directory where output file is 1373 * created 1296 1374 * @param outputFileName String Filename of OpenMS result file 1297 1375 * @param filenameOfUploadedFile String Filename to use for uploaded file … … 1308 1386 log.debug("directoryPath = \"" + directoryPath + "\""); 1309 1387 log.debug("outputFileName = \"" + outputFileName + "\""); 1310 log.debug("filenameOfUploadedFile = \"" + filenameOfUploadedFile + "\""); 1388 log 1389 .debug("filenameOfUploadedFile = \"" + filenameOfUploadedFile + "\""); 1311 1390 log.debug("dirId = " + dirId); 1312 1391 log.debug("descr = \"" + descr + "\""); … … 1370 1449 * 1371 1450 * @param dirPath String Path to directory with files to delete. 1372 * @param commonFilenameStart String Common start of filename for files to delete. 1373 * @param deleteResultFile boolean Flag to indicate if OpenMS result file should be deleted. 1451 * @param commonFilenameStart String Common start of filename for files to 1452 * delete. 1453 * @param deleteResultFile boolean Flag to indicate if OpenMS result file 1454 * should be deleted. 1374 1455 * @param resultFileFileExtension String File extension for result file. 1375 1456 */ 1376 private void cleanUpTemporaryOpenMsFiles(String dirPath, String commonFilenameStart, boolean deleteResultFile, String resultFileFileExtension) 1377 { 1378 log.debug("dirPath = " + dirPath + " commonFilenameStart = " + commonFilenameStart + " deleteResultFile = " + deleteResultFile + " resultFileFileExtension = " + resultFileFileExtension); 1457 private void cleanUpTemporaryOpenMsFiles(String dirPath, 1458 String commonFilenameStart, boolean deleteResultFile, 1459 String resultFileFileExtension) 1460 { 1461 log 1462 .debug("dirPath = " + dirPath + " commonFilenameStart = " + commonFilenameStart + " deleteResultFile = " + deleteResultFile + " resultFileFileExtension = " + resultFileFileExtension); 1379 1463 if (dirPath == null || dirPath.equals("")) 1380 1464 { … … 1413 1497 * @param filenameEnd String End of names of files to delete. 1414 1498 */ 1415 private void deleteFiles(String dirPath, String filenameStart, String filenameEnd) 1416 { 1417 log.debug("dirPath = " + dirPath + " filenameStart = " + filenameStart + " filenameEnd = " + filenameEnd); 1499 private void deleteFiles(String dirPath, String filenameStart, 1500 String filenameEnd) 1501 { 1502 log 1503 .debug("dirPath = " + dirPath + " filenameStart = " + filenameStart + " filenameEnd = " + filenameEnd); 1418 1504 if (filenameStart == null) 1419 1505 { … … 1433 1519 log.debug("filename = " + filename); 1434 1520 // Check if file is selected for deletion 1435 if (filename.startsWith(filenameStart) && 1436 filename.endsWith(filenameEnd))1521 if (filename.startsWith(filenameStart) && filename 1522 .endsWith(filenameEnd)) 1437 1523 { 1438 1524 String filePath = dirPath + "/" + filename; … … 1475 1561 * Delete optional file. 1476 1562 * 1477 * @param filePath String Path of the optional file. 1563 * @param filePath String Path of the optional file. 1478 1564 */ 1479 1565 private void deleteOptionalFile(String filePath) 1480 { 1566 { 1481 1567 log.debug("filePath = " + filePath); 1482 1568 if (filePath != null && !filePath.equals("")) … … 1493 1579 /* 1494 1580 * Creates a temporary OpenMS INI file with given parameter values. 1495 *1496 1581 * @param tmpDir String Path to directory for temporary files. 1497 1582 * @param iniFilenamePrefix String Prefix for temporary OpenMS INI file 1498 * @param timeStampStr String Time stamp string in YYYY_MM_DD_hh_mm_ss format 1583 * @param timeStampStr String Time stamp string in YYYY_MM_DD_hh_mm_ss 1584 * format 1499 1585 * @param openMsProgram String The openMS program specifier 1500 1586 * @param programAlgorithm String The program algorithm. 1501 * @param featureFinderIsotopicPatternChargeHigh Integer FeatureFinder isotopic_pattern:charge_high 1502 * @param featureFinderIsotopicPatternMzTolerance Float FeatureFinder isotopic_pattern:mz_tolerance 1503 * @param featureFinderFeatureMinRtSpan Float FeatureFinder feature:min_rt_span 1587 * @param featureFinderIsotopicPatternChargeHigh Integer FeatureFinder 1588 * isotopic_pattern:charge_high 1589 * @param featureFinderIsotopicPatternMzTolerance Float FeatureFinder 1590 * isotopic_pattern:mz_tolerance 1591 * @param featureFinderFeatureMinRtSpan Float FeatureFinder 1592 * feature:min_rt_span 1504 1593 * @return String The file path for the created temporary OpenMS INI file. 1505 1594 */ 1506 private String createOpenMsIniFile( 1507 String tmpDir, 1508 String iniFilenamePrefix, 1509 String timeStampStr, 1510 String openMsProgram, 1511 String programAlgorithm, 1595 private String createOpenMsIniFile(String tmpDir, String iniFilenamePrefix, 1596 String timeStampStr, String openMsProgram, String programAlgorithm, 1512 1597 Integer featureFinderIsotopicPatternChargeHigh, 1513 1598 Float featureFinderIsotopicPatternMzTolerance, … … 1516 1601 String openMsIniFilePath = null; 1517 1602 // Create OpenMS INI file if needed 1518 if (openMsProgram != null && openMsProgram.equals(OPENMS_PROGRAM_FEATUREFINDER) 1519 && programAlgorithm != null && programAlgorithm.equals(FEATUREFINDER_ALGORITHM_CENTROIDED)) 1603 if (openMsProgram != null && openMsProgram 1604 .equalsIgnoreCase(OPENMS_PROGRAM_FEATUREFINDER) && programAlgorithm != null && programAlgorithm 1605 .equalsIgnoreCase(FEATUREFINDER_ALGORITHM_CENTROIDED)) 1520 1606 { 1521 1607 log.debug("timeStampStr = \"" + timeStampStr + "\""); … … 1532 1618 String featureFinderIsotopicPatternMzToleranceStr = "" + featureFinderIsotopicPatternMzTolerance; 1533 1619 String featureFinderFeatureMinRtSpanStr = "" + featureFinderFeatureMinRtSpan; 1534 URL srcOpenMsIniFileUrl = RunOpenMsPlugin.class.getResource("/content/openms_featurefinder_centroided_ini_file_template.ini"); 1620 URL srcOpenMsIniFileUrl = RunOpenMsPlugin.class 1621 .getResource("/content/openms_featurefinder_centroided_ini_file_template.ini"); 1535 1622 List<String> stringReplaceList = new ArrayList<String>(0); 1536 // Add FeatureFinder isotopic_pattern:charge_high value to replacement list 1623 // Add FeatureFinder isotopic_pattern:charge_high value to 1624 // replacement list 1537 1625 stringReplaceList.add(new String("__ISOTOPICPATTERN_CHARGEHIGH__")); 1538 stringReplaceList.add(new String(featureFinderIsotopicPatternChargeHighStr)); 1539 // Add FeatureFinder isotopic_pattern:mz_tolerance value to replacement list 1540 stringReplaceList.add(new String("__ISOTOPICPATTERN_MZTOLERANCE__")); 1541 stringReplaceList.add(new String(featureFinderIsotopicPatternMzToleranceStr)); 1626 stringReplaceList.add(new String( 1627 featureFinderIsotopicPatternChargeHighStr)); 1628 // Add FeatureFinder isotopic_pattern:mz_tolerance value to 1629 // replacement list 1630 stringReplaceList 1631 .add(new String("__ISOTOPICPATTERN_MZTOLERANCE__")); 1632 stringReplaceList.add(new String( 1633 featureFinderIsotopicPatternMzToleranceStr)); 1542 1634 // Add FeatureFinder feature:min_rt_span value to replacement list 1543 1635 stringReplaceList.add(new String("__FEATURE_MINRTSPAN__")); 1544 1636 stringReplaceList.add(new String(featureFinderFeatureMinRtSpanStr)); 1545 1637 // Update file with new text data 1546 updateTextFile(srcOpenMsIniFileUrl.toString(), targetIniDir, targetIniFile, stringReplaceList); 1638 updateTextFile(srcOpenMsIniFileUrl, targetIniDir, 1639 targetIniFile, stringReplaceList); 1547 1640 openMsIniFilePath = tmpDir + "/" + targetIniFile; 1548 1641 } … … 1552 1645 1553 1646 /** 1554 * Updates a copy of a file on the server file system by 1555 * replacing keystrings with new text.1647 * Updates a copy of a file on the server file system by replacing key 1648 * strings with new text. 1556 1649 * 1557 1650 * @param sourceFileURLStr String URL of file to update. 1558 1651 * @param targetDir String Target directory path for updated file 1559 1652 * @param targetFile String Target filename for updated file 1560 * @param stringReplaceList List<String> List with pairs of key String and replacement String. 1653 * @param stringReplaceList List<String> List with pairs of key String and 1654 * replacement String. 1561 1655 * @throws BaseException 1562 1656 */ 1563 private void updateTextFile(String sourceFileURLStr, String targetDir, String targetFile, List<String> stringReplaceList) 1564 throws BaseException 1657 private void updateTextFile(URL sourceFileURLStr, String targetDir, 1658 String targetFile, List<String> stringReplaceList) 1659 throws BaseException 1565 1660 { 1566 1661 log.debug("sourceFileURLStr = \"" + sourceFileURLStr + "\""); 1567 1662 // Get source file path 1568 String sourceFilePath = sourceFileURLStr.replace("file:", "");1569 log.debug("sourceFilePath = \"" + sourceFilePath + "\"");1663 //String sourceFilePath = sourceFileURLStr.replace("file:/", ""); 1664 //log.debug("sourceFilePath = \"" + sourceFilePath + "\""); 1570 1665 // Get file path 1571 1666 String filePath = targetDir + "/" + targetFile; … … 1574 1669 // Check for optional string replacement 1575 1670 int nStringPairs = 0; 1576 if (stringReplaceList != null && stringReplaceList.size() > 0 && stringReplaceList.size()%2 == 0) 1577 { 1578 nStringPairs = stringReplaceList.size()/2; 1671 if (stringReplaceList != null && stringReplaceList.size() > 0 && stringReplaceList 1672 .size() % 2 == 0) 1673 { 1674 nStringPairs = stringReplaceList.size() / 2; 1579 1675 } 1580 1676 log.debug("nStringPairs = " + nStringPairs); … … 1591 1687 catch (IOException e) 1592 1688 { 1593 log.debug("IOException when creating FileWriter for file \"" + textFile + "\": " + e); 1689 log 1690 .debug("IOException when creating FileWriter for file \"" + textFile + "\": " + e); 1594 1691 } 1595 1692 try 1596 1693 { 1597 //BufferedReader reader = new BufferedReader(new InputStreamReader(inStream)); 1598 BufferedReader reader = new BufferedReader(new FileReader(sourceFilePath)); 1694 // BufferedReader reader = new BufferedReader(new 1695 // InputStreamReader(inStream)); 1696 BufferedReader reader = new BufferedReader(new FileReader( 1697 new java.io.File(sourceFileURLStr.toURI()))); 1599 1698 int lineNumber = 0; 1600 1699 int linesCopied = 0; 1601 for (String line = reader.readLine(); line != null; line = reader.readLine()) 1700 log.debug("Reading ini file"); 1701 for (String line = reader.readLine(); line != null; line = reader 1702 .readLine()) 1602 1703 { 1603 1704 lineNumber++; 1604 // Check for optional string replacement 1705 log.debug("Ini file line:" + lineNumber); 1706 // Check for optional string replacement 1605 1707 for (int i = 0; i < nStringPairs; i++) 1606 1708 { 1607 String stringToReplace = stringReplaceList.get(2*i); 1608 String replaceString = stringReplaceList.get(2*i+1); 1609 if (stringToReplace != null && replaceString != null && line.contains(stringToReplace)) 1610 { 1611 log.debug("(1) stringToReplace = \"" + stringToReplace + "\" replaceString = \"" + replaceString + "\" line = \"" + line + "\""); 1612 line = line.replace(stringToReplace, replaceString); 1613 log.debug("(2) stringToReplace = \"" + stringToReplace + "\" replaceString = \"" + replaceString + "\" line = \"" + line + "\""); 1614 } 1615 } 1616 // Store line in file 1617 writeLine(fw, line); 1618 linesCopied++; 1709 String stringToReplace = stringReplaceList.get(2 * i); 1710 String replaceString = stringReplaceList.get(2 * i + 1); 1711 if (stringToReplace != null && replaceString != null && line 1712 .contains(stringToReplace)) 1713 { 1714 log 1715 .debug("(1) stringToReplace = \"" + stringToReplace + "\" replaceString = \"" + replaceString + "\" line = \"" + line + "\""); 1716 line = line.replace(stringToReplace, replaceString); 1717 log 1718 .debug("(2) stringToReplace = \"" + stringToReplace + "\" replaceString = \"" + replaceString + "\" line = \"" + line + "\""); 1719 } 1720 } 1721 // Store line in file 1722 writeLine(fw, line); 1723 linesCopied++; 1619 1724 } 1620 1725 } … … 1622 1727 { 1623 1728 log.error(e.getMessage(), e); 1624 // throw new BaseException(e);1729 // throw new BaseException(e); 1625 1730 } 1626 1731 finally … … 1634 1739 catch (IOException e) 1635 1740 { 1636 log.debug("IOException when flushing FileWriter for file \"" + textFile + "\": " + e); 1741 log 1742 .debug("IOException when flushing FileWriter for file \"" + textFile + "\": " + e); 1637 1743 fileSaveOk = false; 1638 } 1744 } 1639 1745 try 1640 1746 { … … 1643 1749 catch (IOException e) 1644 1750 { 1645 log.debug("IOException when closing FileWriter for file \"" + textFile + "\": " + e); 1751 log 1752 .debug("IOException when closing FileWriter for file \"" + textFile + "\": " + e); 1646 1753 fileSaveOk = false; 1647 1754 } … … 1664 1771 if (fw == null) 1665 1772 { 1666 log.error("No FileWriter instance when trying to write string \"" + string + "\""); 1773 log 1774 .error("No FileWriter instance when trying to write string \"" + string + "\""); 1667 1775 return; 1668 1776 } … … 1673 1781 catch (IOException e) 1674 1782 { 1675 log.debug("IOException when writing to FileWriter for file \"" + getOpenMsIniFilePath() + "\": " + e); 1783 log 1784 .debug("IOException when writing to FileWriter for file \"" + getOpenMsIniFilePath() + "\": " + e); 1676 1785 } 1677 1786 }
Note: See TracChangeset
for help on using the changeset viewer.