From: tva Date: Thu, 6 Jun 2019 14:28:52 +0000 (+0100) Subject: JAL-3285 fix incorrect file paths on HMMAlign/Search results X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=57e8b75999c110509906efa4ec8107f23785739f;p=jalview.git JAL-3285 fix incorrect file paths on HMMAlign/Search results --- diff --git a/src/jalview/hmmer/HMMAlign.java b/src/jalview/hmmer/HMMAlign.java index b5f047e..57e35e7 100644 --- a/src/jalview/hmmer/HMMAlign.java +++ b/src/jalview/hmmer/HMMAlign.java @@ -152,9 +152,9 @@ public class HMMAlign extends HmmerCommand } } args.add("-o"); - args.add(getFilePath(resultFile)); - args.add(getFilePath(modelFile)); - args.add(getFilePath(alignmentFile)); + args.add(getFilePath(resultFile, true)); + args.add(getFilePath(modelFile, true)); + args.add(getFilePath(alignmentFile, true)); return runCommand(args); } @@ -172,7 +172,7 @@ public class HMMAlign extends HmmerCommand private SequenceI[] importData(File resultFile, List allOrders) throws IOException { - StockholmFile file = new StockholmFile(getFilePath(resultFile), + StockholmFile file = new StockholmFile(getFilePath(resultFile, false), DataSourceType.FILE); SequenceI[] result = file.getSeqsAsArray(); AlignmentOrder msaorder = new AlignmentOrder(result); diff --git a/src/jalview/hmmer/HMMBuild.java b/src/jalview/hmmer/HMMBuild.java index ee133ff..0b6e3ee 100644 --- a/src/jalview/hmmer/HMMBuild.java +++ b/src/jalview/hmmer/HMMBuild.java @@ -334,8 +334,8 @@ public class HMMBuild extends HmmerCommand args.add(ARG_DNA); } - args.add(getFilePath(hmmFile)); - args.add(getFilePath(sequencesFile)); + args.add(getFilePath(hmmFile, true)); + args.add(getFilePath(sequencesFile, true)); return runCommand(args); } diff --git a/src/jalview/hmmer/HMMSearch.java b/src/jalview/hmmer/HMMSearch.java index 1883fef..3773e84 100644 --- a/src/jalview/hmmer/HMMSearch.java +++ b/src/jalview/hmmer/HMMSearch.java @@ -181,9 +181,9 @@ public class HMMSearch extends HmmerCommand File hitsAlignmentFile, File hmmFile) throws IOException { args.add("-o"); - args.add(getFilePath(searchOutputFile)); + args.add(getFilePath(searchOutputFile, true)); args.add("-A"); - args.add(getFilePath(hitsAlignmentFile)); + args.add(getFilePath(hitsAlignmentFile, true)); boolean dbFound = false; String dbPath = ""; @@ -314,8 +314,8 @@ public class HMMSearch extends HmmerCommand exportStockholm(copy.getSequencesArray(), databaseFile, null); } - args.add(getFilePath(hmmFile)); - args.add(getFilePath(databaseFile)); + args.add(getFilePath(hmmFile, true)); + args.add(getFilePath(databaseFile, true)); } /** diff --git a/src/jalview/hmmer/HmmerCommand.java b/src/jalview/hmmer/HmmerCommand.java index 73995af..20e0083 100644 --- a/src/jalview/hmmer/HmmerCommand.java +++ b/src/jalview/hmmer/HmmerCommand.java @@ -257,7 +257,8 @@ public abstract class HmmerCommand implements Runnable * @return * @throws IOException */ - protected String getCommandPath(String cmd) throws IOException + protected String getCommandPath(String cmd) + throws IOException { String binariesFolder = Cache.getProperty(Preferences.HMMER_PATH); // ensure any symlink to the directory is resolved: @@ -269,7 +270,7 @@ public abstract class HmmerCommand implements Runnable .formatMessage("label.executable_not_found", cmd)); } - return file == null ? null : getFilePath(file); + return file == null ? null : getFilePath(file, true); } /** @@ -323,12 +324,15 @@ public abstract class HmmerCommand implements Runnable * X with /cygdrive/x. * * @param resultFile + * @param isInCygwin + * True if file is to be read/written from within the Cygwin + * shell. Should be false for any imports. * @return */ - protected String getFilePath(File resultFile) + protected String getFilePath(File resultFile, boolean isInCygwin) { String path = resultFile.getAbsolutePath(); - if (Platform.isWindows()) + if (Platform.isWindows() && isInCygwin) { // the first backslash escapes '\' for the regular expression argument path = path.replaceAll("\\" + File.separator, "/");