Changeset 4311


Ignore:
Timestamp:
Mar 26, 2012, 4:52:31 PM (11 years ago)
Author:
Fredrik Levander
Message:
 
Location:
trunk
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/api/core/src/org/proteios/core/File.java

    r4179 r4311  
    4848import java.net.URISyntaxException;
    4949import java.net.URL;
     50import java.net.URLConnection;
    5051import java.security.MessageDigest;
    5152import java.text.SimpleDateFormat;
     
    279280        "https://srm.swegrid.se/snic/bils");
    280281    }
     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    }
    281298    return uri;
    282299  }
     
    298315      if (uniformResourceIdentifier != null)
    299316      {
    300         if (!(uniformResourceIdentifier.startsWith("http://") || uniformResourceIdentifier
    301           .startsWith("https://")))
    302         {
    303           throw new 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         */
    306323        new URI(uniformResourceIdentifier);
    307324      }
     
    770787
    771788  /**
    772    * Set the mime type for this <code>File</code> item. It can be any
    773    * mimetype or 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.
    774791   *
    775792   * @param mimeType The new mime type for this item
     
    10821099
    10831100  /**
    1084    * Get an <code>InputStream</code> that can be used to download the
    1085    * physical file for this file item. The client application should call
    1086    * <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 the
    1088    * file 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.
    10891106   *
    10901107   * @param offset Start reading the physical at the specified offset, use 0
     
    10991116    if (getInternalName() == null)
    11001117    {
    1101       if (getUniformResourceIdentifier() != null)
     1118      if (getUniformResourceIdentifier() != null && !getUniformResourceIdentifier()
     1119        .startsWith("file://"))
    11021120      {
    11031121        try
    11041122        {
    1105           HttpURLConnection connection = getConnection(getUniformResourceIdentifier());
     1123          URLConnection connection = getConnection(getUniformResourceIdentifier());
    11061124          InputStream fis = connection.getInputStream();
    11071125          if (isCompressed())
     
    11201138        }
    11211139      }
     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      }
    11221164      else
    11231165      {
     
    11541196
    11551197  /**
    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.
    11631204   *
    11641205   * @param offset Start reading the physical at the specified offset, use 0
     
    11771218        try
    11781219        {
    1179           HttpURLConnection connection = getConnection(getUniformResourceIdentifier());
     1220          URLConnection connection = getConnection(getUniformResourceIdentifier());
    11801221          InputStream fis = connection.getInputStream();
    11811222          if (offset > 0)
  • trunk/api/core/src/org/proteios/core/data/FeatureData.java

    r4208 r4311  
    6666   * Project origin reference.
    6767   *
    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"
    6969   */
    7070  public ProjectData getProject()
  • trunk/client/servlet/src/content/openms_featurefinder_centroided_ini_file_template.ini

    r4213 r4311  
    11<?xml version="1.0" encoding="ISO-8859-1"?>
    22<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 &apos;1&apos; section for &apos;FeatureFinder&apos;">
     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 &apos;1&apos; section for &apos;FeatureFinderCentroided&apos;">
    66      <ITEM name="in" value="" type="string" description="input file (valid formats: &apos;mzML&apos;)" tags="input file" />
    77      <ITEM name="out" value="" type="string" description="output file (valid formats: &apos;featureXML&apos;)" tags="output file" />
    88      <ITEM name="seeds" value="" type="string" description="User-specified seed list. This feature is not supported by all algorithms! (valid formats: &apos;featureXML&apos;)" tags="input file" />
    9       <ITEM name="type" value="centroided" type="string" description="FeatureFinder algorithm type" restrictions="centroided,isotope_wavelet,mrm" />
    109      <ITEM name="log" value="" type="string" description="Name of log file (created only when specified)" tags="advanced" />
    1110      <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  
    4747import se.lu.thep.waf.constraints.InvalidParameterValue;
    4848import se.lu.thep.waf.constraints.VBoolean;
    49 import se.lu.thep.waf.constraints.VFloat;
    50 import se.lu.thep.waf.constraints.VInteger;
    5149import se.lu.thep.waf.constraints.VString;
    5250
     
    174172    validStringParam = RunOpenMs.VOPENMS_PEAKPICKER_ALGORITHM;
    175173    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");
    179177    Select<VString> peakPickerAlgorithmSelectBox = new Select<VString>(validStringParam, optionList);
    180178    peakPickerAlgorithmSelectBox.selectOption(selected);
     
    200198    validStringParam = RunOpenMs.VOPENMS_FEATUREFINDER_ALGORITHM;
    201199    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");
    205203    Select<VString> featureFinderAlgorithmSelectBox = new Select<VString>(validStringParam, optionList);
    206204    featureFinderAlgorithmSelectBox.selectOption(selected);
  • trunk/plugin/src/org/proteios/plugins/RunOpenMsPlugin.java

    r4213 r4311  
    2828package org.proteios.plugins;
    2929
    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;
    3330import org.proteios.core.AbortablePluginInterface;
    3431import org.proteios.core.BaseException;
     
    4037import org.proteios.core.ProgressReporter;
    4138import org.proteios.core.SessionControl;
    42 import org.proteios.core.User;
    4339import org.proteios.core.plugin.About;
    4440import org.proteios.core.plugin.AboutImpl;
     
    9389
    9490
    95     StreamGobbler(InputStream is, String type, OutputStream redirect, ProgressReporter progress)
     91    StreamGobbler(InputStream is, String type, OutputStream redirect,
     92        ProgressReporter progress)
    9693    {
    9794      this.is = is;
     
    157154  }
    158155
    159 
    160156  /**
    161157   * Logger used. Used to log specific events.
     
    190186   * Constants for input data
    191187   */
    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";
    195191  /*
    196192   * OpenMS program specifier.
     
    214210  private String lineSeparator;
    215211
     212
    216213  /**
    217214   * Get size of byte buffer for writing a String to an OutputStream.
     
    349346
    350347  /**
    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.
    354350   *
    355351   * @param openMsIniFilePath String The OpenMS INI file path to set.
     
    373369
    374370  /**
    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.
    378373   *
    379374   * @param lineSeparator String The line separator string to use.
     
    430425    String openMsPeakPickerProgramName;
    431426    String openMsFeatureFinderProgramName;
    432     //Integer openMsMemoryInMegaBytes;
     427    // Integer openMsMemoryInMegaBytes;
    433428    Boolean useExistingTemporaryInputFileFlag;
    434429    String originalSpectrumFilename;
     
    447442
    448443    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");
    452450    tmpDir = (String) job.getValue("tmpDir");
    453451    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");
    457458    spectrumFileId = (Integer) job.getValue("spectrumFileId");
    458459    dirId = (Integer) job.getValue("dirId");
     
    462463    openMsProgram = (String) job.getValue("openMsProgram");
    463464    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");
    468473    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 + "\"");
    471478    log.debug("tmpDir = \"" + tmpDir + "\"");
    472479    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 + "\"");
    476486    log.debug("spectrumFileId = " + spectrumFileId);
    477487    log.debug("dirId = " + dirId);
     
    481491    log.debug("openMsProgram = \"" + openMsProgram + "\"");
    482492    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);
    487501    // Save OpenMS program specifier for use when processing progress info
    488502    setOpenMsProgramSpecifier(openMsProgram);
     
    491505    String programAlgorithm = new String("");
    492506    String outputFileExtension = new String(".txt");
    493     if (openMsProgram != null && openMsProgram.equals(OPENMS_PROGRAM_PEAKPICKER))
     507    if (openMsProgram != null && openMsProgram
     508      .equalsIgnoreCase(OPENMS_PROGRAM_PEAKPICKER))
    494509    {
    495510      openMsProgramName = new String(openMsPeakPickerProgramName);
     
    497512      outputFileExtension = "." + openMsProgram + ".mzML";
    498513    }
    499     else if (openMsProgram != null && openMsProgram.equals(OPENMS_PROGRAM_FEATUREFINDER))
     514    else if (openMsProgram != null && openMsProgram
     515      .equalsIgnoreCase(OPENMS_PROGRAM_FEATUREFINDER))
    500516    {
    501517      openMsProgramName = new String(openMsFeatureFinderProgramName);
     
    507523    log.debug("outputFileExtension = " + outputFileExtension);
    508524    // 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,
    514528      featureFinderIsotopicPatternMzTolerance,
    515       featureFinderFeatureMinRtSpan,
    516       useExistingTemporaryInputFileFlag, originalSpectrumFilename,
    517       temporaryInputFilename,
    518       spectrumFileId, dirId, uploadOutputFileFlag, deleteOutputFileFlag,
     529      featureFinderFeatureMinRtSpan, useExistingTemporaryInputFileFlag,
     530      originalSpectrumFilename, temporaryInputFilename, spectrumFileId,
     531      dirId, uploadOutputFileFlag, deleteOutputFileFlag,
    519532      outputFileExtension, timeStampStr, openMsProgram);
    520533    done();
     
    538551
    539552  /**
    540    * Start a job that performs an OpenMS feature detection using a locally installed
    541    * OpenMS feature detection engine.
     553   * Start a job that performs an OpenMS feature detection using a locally
     554   * installed OpenMS feature detection engine.
    542555   *
    543556   * @param request Request
     
    545558   * @param progress ProgressReporter
    546559   * @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
    548562   * @param openMsInstallPath String The openMs install path
    549563   * @param openMsProgramName String The openMS program name
    550564   * @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.
    555573   * @param originalSpectrumFilename String The original spectrum filename.
    556574   * @param temporaryInputFilename String Optional temporary input filename.
     
    560578   * @param deleteOutputFileFlag Boolean The delete output file flag
    561579   * @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
    563582   * @param openMsProgram String The openMS program specifier
    564583   */
    565584  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,
    571587      String programAlgorithm,
    572588      Integer featureFinderIsotopicPatternChargeHigh,
     
    574590      Float featureFinderFeatureMinRtSpan,
    575591      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)
    584597  {
    585598    log.debug("openMsInstallPath = \"" + openMsInstallPath + "\"");
    586599    log.debug("openMsProgramName = \"" + openMsProgramName + "\"");
    587600    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);
    591607    log.debug("tmpDir = \"" + tmpDir + "\"");
    592608    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 + "\"");
    596615    log.debug("spectrumFileId = " + spectrumFileId);
    597616    log.debug("dirId = " + dirId);
    598617    log.debug("uploadOutputFileFlag = " + uploadOutputFileFlag);
    599618    log.debug("deleteOutputFileFlag = " + deleteOutputFileFlag);
    600     log.debug("outputFileExtension = \"" + outputFileExtension + "\""); 
     619    log.debug("outputFileExtension = \"" + outputFileExtension + "\"");
    601620    log.debug("timeStampStr = \"" + timeStampStr + "\"");
    602621    log.debug("openMsProgram = \"" + openMsProgram + "\"");
     
    613632    log.debug("openMsOutputDirPath = \"" + openMsOutputDirPath + "\"");
    614633    openMsOutputDirPath = tmpDir + "/" + openMsOutputDirPath;
    615     log.debug("openMsOutputDirPath (modified) = \"" + openMsOutputDirPath + "\"");
     634    log
     635      .debug("openMsOutputDirPath (modified) = \"" + openMsOutputDirPath + "\"");
    616636    //
    617637    DbControl dc = sc.newDbControl();
     
    619639    // Create output file type
    620640    FileType outputFileType = null;
    621     if (openMsProgram != null && openMsProgram.equals(OPENMS_PROGRAM_PEAKPICKER))
     641    if (openMsProgram != null && openMsProgram
     642      .equalsIgnoreCase(OPENMS_PROGRAM_PEAKPICKER))
    622643    {
    623644      outputFileType = factory.getBySystemId(FileType.class,
    624645        FileType.MZML);
    625646    }
    626     else if (openMsProgram != null && openMsProgram.equals(OPENMS_PROGRAM_FEATUREFINDER))
     647    else if (openMsProgram != null && openMsProgram
     648      .equalsIgnoreCase(OPENMS_PROGRAM_FEATUREFINDER))
    627649    {
    628650      outputFileType = factory.getBySystemId(FileType.class,
    629651        FileType.OPENMS_FEATURES);
    630652    }
     653    if (programAlgorithm != null && !programAlgorithm.equals(""))
     654    {
     655      openMsProgramPath += programAlgorithm;
     656    }
     657
    631658    /*
    632     // Get spectrum file
    633     File spectrumFile = factory.getById(File.class, spectrumFileId);
    634     log.debug("spectrumFile (original) = " + spectrumFile);
    635     // Get spectrum file size in bytes for progress calculation
    636     long fileSizeInBytes = spectrumFile.getSizeInBytes();
    637     setInputFileSizeInBytes(fileSizeInBytes);
    638     */
    639     // Always use original spectrum filename, even if a converted file is used for OpenMS feature detection
    640     //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();
    641668    String spectrumBaseFilename = new String(originalSpectrumFilename);
    642669    String fileExtension = new String("");
     
    644671    if (dotIndex > 0)
    645672    {
    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);
    648676    }
    649677    // Copy spectrum file item to local file used for OpenMS input
    650678    progress.display(0, "Making local file copy");
    651     String openMsInputBaseFilename = new String(spectrumBaseFilename + "_" + timeStampStr);
     679    String openMsInputBaseFilename = new String(
     680      spectrumBaseFilename + "_" + timeStampStr);
    652681    String openMsInputFilename = new String(openMsInputBaseFilename);
    653682    if (!fileExtension.equals(""))
     
    655684      openMsInputFilename = openMsInputFilename + "." + fileExtension;
    656685    }
    657     //log.debug("originalSpectrumFilename = \"" + originalSpectrumFilename + "\"");
     686    // log.debug("originalSpectrumFilename = \"" + originalSpectrumFilename
     687    // + "\"");
    658688    log.debug("spectrumBaseFilename = \"" + spectrumBaseFilename + "\"");
    659689    log.debug("fileExtension = \"" + fileExtension + "\"");
    660     log.debug("openMsInputBaseFilename = \"" + openMsInputBaseFilename + "\"");
     690    log
     691      .debug("openMsInputBaseFilename = \"" + openMsInputBaseFilename + "\"");
    661692    log.debug("openMsInputFilename = \"" + openMsInputFilename + "\"");
    662693    // Get temporary local input file name to use
     
    674705    log.debug("temporaryInputFilename used = " + temporaryInputFilename);
    675706    // Get input file path
    676     String openMsInputFilePath = new String(tmpDir + "/" + temporaryInputFilename);
     707    String openMsInputFilePath = new String(
     708      tmpDir + "/" + temporaryInputFilename);
    677709    log.debug("openMsInputFilePath = \"" + openMsInputFilePath + "\"");
    678710    // Get temporary local input file
     
    686718      setInputFileSizeInBytes(fileSizeInBytes);
    687719      // 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);
    691724    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);
    693727    // Create OpenMS output file name
    694728    String openMsOutputFilename = openMsInputBaseFilename + outputFileExtension;
     
    699733    }
    700734    String openMsOutputPath = openMsOutputDirPath + delimiter + openMsOutputFilename;
    701     log.debug("openMsOutputFilename = \"" + openMsOutputFilename + "\""); 
     735    log.debug("openMsOutputFilename = \"" + openMsOutputFilename + "\"");
    702736    log.debug("openMsOutputPath = \"" + openMsOutputPath + "\"");
    703737    // Create OpenMS INI file if needed
    704738    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,
    712743      featureFinderIsotopicPatternChargeHigh,
    713744      featureFinderIsotopicPatternMzTolerance,
    714745      featureFinderFeatureMinRtSpan);
    715746    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
    717749    boolean imported = false;
    718750    try
     
    721753      if (!temporaryInputFileExists)
    722754      {
    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.");
    724757      }
    725758      List<String> cmdList = new ArrayList<String>();
     
    729762      cmdList.add("-out");
    730763      cmdList.add(openMsOutputPath);
    731       if (programAlgorithm != null && !programAlgorithm.equals(""))
    732       {
    733         // Add algorithm option
    734         cmdList.add("-type");
    735         cmdList.add(programAlgorithm);
    736       }
    737764      if (openMsIniFilePath != null && !openMsIniFilePath.equals(""))
    738765      {
     
    749776        deleteFile(tmpDir, temporaryInputFilename);
    750777        // Delete other temporary files
    751         cleanUpTemporaryOpenMsFiles(tmpDir, openMsInputBaseFilename, true, outputFileExtension);
     778        cleanUpTemporaryOpenMsFiles(tmpDir, openMsInputBaseFilename,
     779          true, outputFileExtension);
    752780        throw new IOException("Job command is aborted. Closing down.");
    753781      }
     
    759787      Process proc = rt.exec(cmdArr);
    760788      /*
    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       */
    765792      // Parse out stream for progress info
    766793      // any error message?
     
    779806      catch (InterruptedException se)
    780807      {
    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);
    782810        abort();
    783811        proc.destroy();
     
    792820        deleteFile(tmpDir, temporaryInputFilename);
    793821        // Delete other temporary files
    794         cleanUpTemporaryOpenMsFiles(tmpDir, openMsInputBaseFilename, true, outputFileExtension);       
     822        cleanUpTemporaryOpenMsFiles(tmpDir, openMsInputBaseFilename,
     823          true, outputFileExtension);
    795824        throw new IOException("Job command is aborted. Closing down.");
    796825      }
     
    817846      String testOutputFilename = openMsInputBaseFilename + outputFileExtension;
    818847      // 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
    820850      String filenameOfUploadedFile = spectrumBaseFilename + outputFileExtension;
    821851      if (localFileCanBeRead(tmpDir, testOutputFilename))
     
    825855      else
    826856      {
    827         // Test output filename including original file extension in name
     857        // Test output filename including original file extension in
     858        // name
    828859        testOutputFilename = openMsInputFilename + outputFileExtension;
    829860        // 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
    831863        filenameOfUploadedFile = originalSpectrumFilename + outputFileExtension;
    832864        if (localFileCanBeRead(tmpDir, testOutputFilename))
     
    843875        }
    844876      }
    845       log.debug("openMsOutputFilename = \"" + openMsOutputFilename + "\"");
    846       log.debug("openMsOutputPath = \"" + openMsOutputPath + "\"");
     877      log
     878        .debug("openMsOutputFilename = \"" + openMsOutputFilename + "\"");
     879      log.debug("openMsOutputPath = \"" + openMsOutputPath + "\"");
    847880      //
    848881      String programNameStr = "unknown program";
    849       if (openMsProgram.equals(OPENMS_PROGRAM_PEAKPICKER))
     882      if (openMsProgram.equalsIgnoreCase(OPENMS_PROGRAM_PEAKPICKER))
    850883      {
    851884        programNameStr = "PeakPicker";
    852885      }
    853       else if (openMsProgram.equals(OPENMS_PROGRAM_FEATUREFINDER))
     886      else if (openMsProgram
     887        .equalsIgnoreCase(OPENMS_PROGRAM_FEATUREFINDER))
    854888      {
    855889        programNameStr = "FeatureFinder";
    856890      }
    857       String doneMessage = new String("OpenMS feature detection with " + programNameStr + " finished");
     891      String doneMessage = new String(
     892        "OpenMS feature detection with " + programNameStr + " finished");
    858893      //
    859894      doneMessage = doneMessage + "\n" + "OpenMS input file: " + originalSpectrumFilename;
    860895      //
    861       log
    862         .debug("openMsOutputPath = \"" + openMsOutputPath + "\"");
     896      log.debug("openMsOutputPath = \"" + openMsOutputPath + "\"");
    863897      doneMessage = doneMessage + "\n" + "OpenMS output file: " + openMsOutputPath;
    864898      // Optional upload of OpenMS output file
     
    872906          try
    873907          {
    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);
    877913            outputFileUploaded = true;
    878914            doneMessage = doneMessage + "\n" + "Output file uploaded: " + filenameOfUploadedFile;
     
    891927      // Delete temporary input file
    892928      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)
    894931      boolean deleteResultFile = deleteOutputFileFlag;
    895932      if (uploadOutputFileFlag != null && uploadOutputFileFlag)
     
    902939      }
    903940      log.debug("deleteResultFile = " + deleteResultFile);
    904       cleanUpTemporaryOpenMsFiles(tmpDir, openMsInputBaseFilename, deleteResultFile, outputFileExtension);
     941      cleanUpTemporaryOpenMsFiles(tmpDir, openMsInputBaseFilename,
     942        deleteResultFile, outputFileExtension);
    905943      // Delete temporary OpenMS INI file
    906944      deleteOptionalFile(openMsIniFilePath);
     
    921959        programNameStr = "FeatureFinder";
    922960      }
    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);
    924963      //
    925964      errorMessage = errorMessage + "\n" + "OpenMS input file: " + openMsInputFilename;
     
    935974      else
    936975      {
    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"));
    938978        response.setError(errorMessage, err);
    939979      }
     
    941981      deleteFile(tmpDir, temporaryInputFilename);
    942982      // Clean up temporary files
    943       cleanUpTemporaryOpenMsFiles(tmpDir, openMsInputBaseFilename, true, outputFileExtension);
     983      cleanUpTemporaryOpenMsFiles(tmpDir, openMsInputBaseFilename, true,
     984        outputFileExtension);
    944985      // Delete temporary OpenMS INI file
    945       deleteOptionalFile(openMsIniFilePath);
     986      // deleteOptionalFile(openMsIniFilePath);
    946987    }
    947988  }
     
    955996   * @return boolean Returns 'true' if copying was successful, else 'false'.
    956997   */
    957   private boolean makeTemporaryLocalFileCopy(File sourceFile, String localFilePath)
     998  private boolean makeTemporaryLocalFileCopy(File sourceFile,
     999      String localFilePath)
    9581000  {
    9591001    // Perform a number of tries to copy file
     
    9751017        if (numFileCopyAttempts >= MAX_NUMBER_OF_FILE_COPY_ATTEMPTS)
    9761018        {
    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);
    9821026    return fileCopied;
    9831027  }
     
    10961140   *
    10971141   * @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)
    11011147  {
    11021148    // Parse output for progress report
    11031149    if (progress != null)
    11041150    {
    1105       if (getOpenMsProgramSpecifier().equals(OPENMS_PROGRAM_PEAKPICKER))
     1151      if (getOpenMsProgramSpecifier().equalsIgnoreCase(
     1152        OPENMS_PROGRAM_PEAKPICKER))
    11061153      {
    11071154        if (line.contains("Progress of 'loading mzML file':"))
     
    11091156          setCurrentPhase(1);
    11101157          setCurrentPhaseStr("Loading mzML file");
    1111         } 
     1158        }
    11121159        else if (line.contains("Progress of 'loading chromatograms':"))
    11131160        {
    11141161          setCurrentPhase(2);
    11151162          setCurrentPhaseStr("Loading chromatograms");
    1116         } 
     1163        }
    11171164        else if (line.contains("Progress of 'picking peaks':"))
    11181165        {
    11191166          setCurrentPhase(3);
    11201167          setCurrentPhaseStr("Picking peaks");
    1121         } 
     1168        }
    11221169        else if (line.contains("Progress of 'storing mzML file':"))
    11231170        {
    11241171          setCurrentPhase(4);
    11251172          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))
    11291177      {
    11301178        if (line.contains("Progress of 'loading mzML file':"))
     
    11321180          setCurrentPhase(1);
    11331181          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':"))
    11361185        {
    11371186          setCurrentPhase(2);
    11381187          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':"))
    11411191        {
    11421192          setCurrentPhase(3);
    11431193          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':"))
    11461197        {
    11471198          setCurrentPhase(4);
    11481199          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':"))
    11511203        {
    11521204          setCurrentPhase(5);
    11531205          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':"))
    11561209        {
    11571210          setCurrentPhase(6);
    11581211          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':"))
    11611215        {
    11621216          setCurrentPhase(7);
    11631217          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':"))
    11661221        {
    11671222          setCurrentPhase(8);
    11681223          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':"))
    11711227        {
    11721228          setCurrentPhase(9);
    11731229          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':"))
    11761233        {
    11771234          setCurrentPhase(10);
    11781235          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':"))
    11811239        {
    11821240          setCurrentPhase(11);
    11831241          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':"))
    11861245        {
    11871246          setCurrentPhase(12);
    11881247          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':"))
    11911251        {
    11921252          setCurrentPhase(13);
    11931253          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':"))
    11961257        {
    11971258          setCurrentPhase(14);
    11981259          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':"))
    12011263        {
    12021264          setCurrentPhase(15);
    12031265          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':"))
    12061269        {
    12071270          setCurrentPhase(16);
    12081271          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':"))
    12111275        {
    12121276          setCurrentPhase(17);
    12131277          setCurrentPhaseStr("Resolving overlapping features");
    1214         } 
     1278        }
    12151279      }
    12161280      if (line.contains(" %"))
    12171281      {
    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.
    12191285        String testStr = new String(" %");
    12201286        int index = line.indexOf(testStr);
     
    12241290          String percentStr = line.substring(0, index);
    12251291          /*
    1226           System.out
    1227             .println(this.getClass().getSimpleName() + ": percentStr (1) = \"" + percentStr + "\"");
    1228           */
     1292           * System.out .println(this.getClass().getSimpleName() +
     1293           * ": percentStr (1) = \"" + percentStr + "\"");
     1294           */
    12291295          // Convert percent string to double
    12301296          double phasePercentCompleted = 0.0;
     
    12371303          // Construct progress message
    12381304          // Example; progressMessage = "Loading mzML file: 18.15%""
    1239           String progressMessage = new String(getCurrentPhaseStr() + ": " + percentStr + "%");
     1305          String progressMessage = new String(
     1306            getCurrentPhaseStr() + ": " + percentStr + "%");
    12401307          // Total progress includes more than OpenMS analysis
    1241           int percentCompleted = EstimatedTotalPercentage(phasePercentCompleted, getCurrentPhase());
     1308          int percentCompleted = EstimatedTotalPercentage(
     1309            phasePercentCompleted, getCurrentPhase());
    12421310          if (percentCompleted > 99)
    12431311          {
     
    12521320
    12531321  /**
    1254    * Estimates total percentage of time to completion.
    1255    * Assumes a fixed number of phases for each application.
     1322   * Estimates total percentage of time to completion. Assumes a fixed number
     1323   * of phases for each application.
    12561324   *
    12571325   * @param percentage double Percentage in current phase.
     
    12621330  {
    12631331    int numberOfPhases = 17;
    1264     if (getOpenMsProgramSpecifier().equals(OPENMS_PROGRAM_PEAKPICKER))
     1332    if (getOpenMsProgramSpecifier().equalsIgnoreCase(
     1333      OPENMS_PROGRAM_PEAKPICKER))
    12651334    {
    12661335      numberOfPhases = 4;
    12671336    }
    1268     else if (getOpenMsProgramSpecifier().equals(OPENMS_PROGRAM_FEATUREFINDER))
     1337    else if (getOpenMsProgramSpecifier().equalsIgnoreCase(
     1338      OPENMS_PROGRAM_FEATUREFINDER))
    12691339    {
    12701340      numberOfPhases = 17;
     
    12741344      phase = 1;
    12751345    }
    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);
    12801352    if (totalFraction > 1.0)
    12811353    {
    12821354      totalFraction = 1.0;
    12831355    }
    1284     double totalPercentage = 100.0*totalFraction;
     1356    double totalPercentage = 100.0 * totalFraction;
    12851357    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);
    12871364    return totalIntegerPercentage;
    12881365  }
     
    12901367
    12911368  /**
    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
    12961374   * @param outputFileName String Filename of OpenMS result file
    12971375   * @param filenameOfUploadedFile String Filename to use for uploaded file
     
    13081386    log.debug("directoryPath = \"" + directoryPath + "\"");
    13091387    log.debug("outputFileName = \"" + outputFileName + "\"");
    1310     log.debug("filenameOfUploadedFile = \"" + filenameOfUploadedFile + "\"");
     1388    log
     1389      .debug("filenameOfUploadedFile = \"" + filenameOfUploadedFile + "\"");
    13111390    log.debug("dirId = " + dirId);
    13121391    log.debug("descr = \"" + descr + "\"");
     
    13701449   *
    13711450   * @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.
    13741455   * @param resultFileFileExtension String File extension for result file.
    13751456   */
    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);
    13791463    if (dirPath == null || dirPath.equals(""))
    13801464    {
     
    14131497   * @param filenameEnd String End of names of files to delete.
    14141498   */
    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);
    14181504    if (filenameStart == null)
    14191505    {
     
    14331519        log.debug("filename = " + filename);
    14341520        // 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))
    14371523        {
    14381524          String filePath = dirPath + "/" + filename;
     
    14751561   * Delete optional file.
    14761562   *
    1477    * @param filePath String Path of the optional file. 
     1563   * @param filePath String Path of the optional file.
    14781564   */
    14791565  private void deleteOptionalFile(String filePath)
    1480   {   
     1566  {
    14811567    log.debug("filePath = " + filePath);
    14821568    if (filePath != null && !filePath.equals(""))
     
    14931579  /*
    14941580   * Creates a temporary OpenMS INI file with given parameter values.
    1495    *
    14961581   * @param tmpDir String Path to directory for temporary files.
    14971582   * @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
    14991585   * @param openMsProgram String The openMS program specifier
    15001586   * @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
    15041593   * @return String The file path for the created temporary OpenMS INI file.
    15051594   */
    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,
    15121597      Integer featureFinderIsotopicPatternChargeHigh,
    15131598      Float featureFinderIsotopicPatternMzTolerance,
     
    15161601    String openMsIniFilePath = null;
    15171602    // 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))
    15201606    {
    15211607      log.debug("timeStampStr = \"" + timeStampStr + "\"");
     
    15321618      String featureFinderIsotopicPatternMzToleranceStr = "" + featureFinderIsotopicPatternMzTolerance;
    15331619      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");
    15351622      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
    15371625      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));
    15421634      // Add FeatureFinder feature:min_rt_span value to replacement list
    15431635      stringReplaceList.add(new String("__FEATURE_MINRTSPAN__"));
    15441636      stringReplaceList.add(new String(featureFinderFeatureMinRtSpanStr));
    15451637      // Update file with new text data
    1546       updateTextFile(srcOpenMsIniFileUrl.toString(), targetIniDir, targetIniFile, stringReplaceList);
     1638      updateTextFile(srcOpenMsIniFileUrl, targetIniDir,
     1639        targetIniFile, stringReplaceList);
    15471640      openMsIniFilePath = tmpDir + "/" + targetIniFile;
    15481641    }
     
    15521645
    15531646  /**
    1554    * Updates a copy of a file on the server file system by
    1555    * replacing key strings with new text.
     1647   * Updates a copy of a file on the server file system by replacing key
     1648   * strings with new text.
    15561649   *
    15571650   * @param sourceFileURLStr String URL of file to update.
    15581651   * @param targetDir String Target directory path for updated file
    15591652   * @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.
    15611655   * @throws BaseException
    15621656   */
    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
    15651660  {
    15661661    log.debug("sourceFileURLStr = \"" + sourceFileURLStr + "\"");
    15671662    // 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 + "\"");
    15701665    // Get file path
    15711666    String filePath = targetDir + "/" + targetFile;
     
    15741669    // Check for optional string replacement
    15751670    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;
    15791675    }
    15801676    log.debug("nStringPairs = " + nStringPairs);
     
    15911687    catch (IOException e)
    15921688    {
    1593       log.debug("IOException when creating FileWriter for file \"" + textFile + "\": " + e);
     1689      log
     1690        .debug("IOException when creating FileWriter for file \"" + textFile + "\": " + e);
    15941691    }
    15951692    try
    15961693    {
    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())));
    15991698      int lineNumber = 0;
    16001699      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())
    16021703      {
    16031704        lineNumber++;
    1604         // Check for optional string replacement
     1705        log.debug("Ini file line:" + lineNumber);
     1706        // Check for optional string replacement
    16051707        for (int i = 0; i < nStringPairs; i++)
    16061708        {
    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++;
    16191724      }
    16201725    }
     
    16221727    {
    16231728      log.error(e.getMessage(), e);
    1624       //throw new BaseException(e);
     1729      // throw new BaseException(e);
    16251730    }
    16261731    finally
     
    16341739      catch (IOException e)
    16351740      {
    1636         log.debug("IOException when flushing FileWriter for file \"" + textFile + "\": " + e);
     1741        log
     1742          .debug("IOException when flushing FileWriter for file \"" + textFile + "\": " + e);
    16371743        fileSaveOk = false;
    1638       }   
     1744      }
    16391745      try
    16401746      {
     
    16431749      catch (IOException e)
    16441750      {
    1645         log.debug("IOException when closing FileWriter for file \"" + textFile + "\": " + e);
     1751        log
     1752          .debug("IOException when closing FileWriter for file \"" + textFile + "\": " + e);
    16461753        fileSaveOk = false;
    16471754      }
     
    16641771    if (fw == null)
    16651772    {
    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 + "\"");
    16671775      return;
    16681776    }
     
    16731781    catch (IOException e)
    16741782    {
    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);
    16761785    }
    16771786  }
Note: See TracChangeset for help on using the changeset viewer.