From: tzvanaalten Date: Tue, 15 Aug 2017 15:18:58 +0000 (+0100) Subject: JAL-2629 fix file loading issues on Mac X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=d1f25a5bd328b4f9a47bf98fe85e00209b91e0f2;p=jalview.git JAL-2629 fix file loading issues on Mac --- diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index 0e418bd..7a231bc 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -694,8 +694,8 @@ public class Preferences extends GPreferences } if (hmmerStatus) { - String ver = getHMMERVersion(); - Cache.setProperty("HMMER_VERSION", ver); + // String ver = getHMMERVersion(); + Cache.setProperty("HMMER_VERSION", "3.1b2"); } @@ -1209,7 +1209,7 @@ public class Preferences extends GPreferences return false; } - File hmmbuild = new File(path + "/binaries/hmmbuild.exe"); + File hmmbuild = new File(path + "/binaries/hmmbuild"); { if (!hmmbuild.canExecute()) { @@ -1219,7 +1219,7 @@ public class Preferences extends GPreferences } } - File hmmalign = new File(path + "/binaries/hmmalign.exe"); + File hmmalign = new File(path + "/binaries/hmmalign"); { if (!hmmalign.canExecute()) { @@ -1229,7 +1229,7 @@ public class Preferences extends GPreferences } } - File hmmsearch = new File(path + "/binaries/hmmsearch.exe"); + File hmmsearch = new File(path + "/binaries/hmmsearch"); { if (!hmmsearch.canExecute()) { @@ -1271,7 +1271,7 @@ public class Preferences extends GPreferences private String getHMMERVersion() { - File file = new File(hmmerPath.getText() + "/release-notes.txt"); + File file = new File(hmmerPath.getText() + "/release-notes"); Scanner scanner = null; try { diff --git a/src/jalview/hmmer/HMMAlignThread.java b/src/jalview/hmmer/HMMAlignThread.java index 3649108..303b58b 100644 --- a/src/jalview/hmmer/HMMAlignThread.java +++ b/src/jalview/hmmer/HMMAlignThread.java @@ -165,7 +165,7 @@ public class HMMAlignThread implements Runnable private boolean runCommand() throws IOException, InterruptedException { - File file = new File(cmds.HMMERFOLDER + "/binaries/hmmalign.exe"); + File file = new File(cmds.HMMERFOLDER + "/binaries/hmmalign"); if (!file.canExecute()) { return false; diff --git a/src/jalview/hmmer/HMMBuildThread.java b/src/jalview/hmmer/HMMBuildThread.java index 853b5f1..5d55f84 100644 --- a/src/jalview/hmmer/HMMBuildThread.java +++ b/src/jalview/hmmer/HMMBuildThread.java @@ -10,6 +10,7 @@ import jalview.gui.JvOptionPane; import jalview.gui.Preferences; import jalview.io.DataSourceType; import jalview.io.FileFormat; +import jalview.io.FileLoader; import jalview.util.MessageManager; import java.io.File; @@ -148,7 +149,7 @@ public class HMMBuildThread implements Runnable private boolean runCommand() throws IOException, InterruptedException { - File file = new File(cmds.HMMERFOLDER + "/binaries/hmmbuild.exe"); + File file = new File(cmds.HMMERFOLDER + "/binaries/hmmbuild"); if (!file.canExecute()) { return false; @@ -185,8 +186,10 @@ public class HMMBuildThread implements Runnable private void importData() throws IOException, InterruptedException { cmds.addHMMConsensusSequences(af); - af.loadJalviewDataFile(hmmTemp.getAbsolutePath(), DataSourceType.FILE, - FileFormat.HMMER3, null); + FileLoader loader = new FileLoader(); + loader.LoadFileOntoAlignmentWaitTillLoaded(af.getViewport(), + hmmTemp.getAbsolutePath(), DataSourceType.FILE, + FileFormat.HMMER3); hmmTemp.delete(); stoTemp.delete(); } diff --git a/src/jalview/io/FileLoader.java b/src/jalview/io/FileLoader.java index f04b88d..088e384 100755 --- a/src/jalview/io/FileLoader.java +++ b/src/jalview/io/FileLoader.java @@ -29,6 +29,8 @@ import jalview.bin.Jalview; import jalview.datamodel.AlignmentI; import jalview.datamodel.HiddenColumns; import jalview.datamodel.PDBEntry; +import jalview.datamodel.Profile; +import jalview.datamodel.Profiles; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; import jalview.gui.AlignFrame; @@ -200,6 +202,32 @@ public class FileLoader implements Runnable return alignFrame; } + public void LoadFileOntoAlignmentWaitTillLoaded(AlignViewport viewport, + String file, DataSourceType sourceType, FileFormatI format) + { + this.viewport = viewport; + this.file = file; + this.protocol = sourceType; + this.format = format; + _LoadAlignmentFileWaitTillLoaded(); + } + + protected void _LoadAlignmentFileWaitTillLoaded() + { + Thread loader = new Thread(this); + loader.start(); + + while (loader.isAlive()) + { + try + { + Thread.sleep(500); + } catch (Exception ex) + { + } + } + } + public void updateRecentlyOpened() { Vector recent = new Vector(); @@ -413,17 +441,11 @@ public class FileLoader implements Runnable } else { - for (int i = 0; i < alignment.getAbsoluteHeight(); i++) - { - if (!alignment.getSequenceAt(i).isHMMConsensusSequence()) - { - alignment.getSequences().add(i, seq); - break; - } - } + alignment.insertSequenceAt(0, seq); } - viewport.setAlignment(alignment); viewport.initInformation(); + viewport.setSequenceInformationHash( + new Profiles(new Profile[1]), 0); viewport.updateInformation(viewport.getAlignPanel()); viewport.getAlignPanel().adjustAnnotationHeight(); viewport.updateSequenceIdColours(); @@ -433,10 +455,8 @@ public class FileLoader implements Runnable viewport.getAlignPanel().alignFrame .setSelectedHMM(seq.getHMM()); } - viewport.getAlignPanel().repaint(); viewport.alignmentChanged(viewport.getAlignPanel()); - } } else