Merge branch 'features/mchmmer' of https://source.jalview.org/git/jalview.git into...
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 17 Apr 2018 17:44:41 +0000 (18:44 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 17 Apr 2018 17:44:41 +0000 (18:44 +0100)
Conflicts:
src/jalview/hmmer/HmmerCommand.java

1  2 
.classpath
src/jalview/hmmer/HMMAlign.java
src/jalview/hmmer/HMMBuild.java
src/jalview/hmmer/HMMSearch.java
src/jalview/hmmer/HmmerCommand.java

diff --cc .classpath
@@@ -66,7 -66,7 +66,7 @@@
        <classpathentry kind="con" path="org.testng.TESTNG_CONTAINER"/>
        <classpathentry kind="lib" path="lib/biojava-core-4.1.0.jar"/>
        <classpathentry kind="lib" path="lib/biojava-ontology-4.1.0.jar"/>
--      <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
++      <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
        <classpathentry kind="lib" path="lib/htsjdk-2.12.0.jar"/>
        <classpathentry kind="lib" path="lib/groovy-all-2.4.12-indy.jar"/>
        <classpathentry kind="output" path="classes"/>
Simple merge
Simple merge
Simple merge
@@@ -254,11 -254,11 +254,11 @@@ public abstract class HmmerCommand impl
      File file = FileUtils.getExecutable(cmd, binariesFolder);
      if (file == null && af != null)
      {
 -        JvOptionPane.showInternalMessageDialog(af,
 -                MessageManager.getString("warn.hmm_command_failed"));
 +      JvOptionPane.showInternalMessageDialog(af, MessageManager
 +              .formatMessage("label.executable_not_found", cmd));
      }
  
-     return file == null ? null : file.getAbsolutePath();
+     return file == null ? null : getFilePath(file);
    }
  
    /**
    }
  
    /**
 +   * Answers the HMM profile for the profile sequence the user selected (default
 +   * is just the first HMM sequence in the alignment)
 +   * 
 +   * @return
 +   */
 +  protected HiddenMarkovModel getHmmProfile()
 +  {
 +    String alignToParamName = MessageManager.getString("label.use_hmm");
 +    for (ArgumentI arg : params)
 +    {
 +      String name = arg.getName();
 +      if (name.equals(alignToParamName))
 +      {
 +        String seqName = arg.getValue();
 +        SequenceI hmmSeq = alignment.findName(seqName);
 +        if (hmmSeq.hasHMMProfile())
 +        {
 +          return hmmSeq.getHMM();
 +        }
 +      }
 +    }
 +    return null;
 +  }
++
++  /**
+    * Answers an absolute path to the given file, in a format suitable for
+    * processing by a hmmer command. On a Windows platform, the native Windows file
+    * path is converted to Cygwin format, by replacing '\'with '/' and drive letter
+    * X with /cygdrive/x.
+    * 
+    * @param resultFile
+    * @return
+    */
+   protected String getFilePath(File resultFile)
+   {
+     String path = resultFile.getAbsolutePath();
+     if (Platform.isWindows())
+     {
+       // the first backslash escapes '\' for the regular expression argument
+       path = path.replaceAll("\\" + File.separator, "/");
+       int colon = path.indexOf(':');
+       if (colon > 0)
+       {
+         String drive = path.substring(0, colon);
+         path = path.replaceAll(drive + ":", "/cygdrive/" + drive);
+       }
+     }
+     return path;
+   }
  }