From fd6ec6e0265ccdeebe7ecd29f6a615553f3878c2 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Fri, 30 Mar 2018 10:36:16 +0100 Subject: [PATCH] JAL-2629 add title to output alignment window --- src/jalview/hmmer/HMMAlign.java | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/src/jalview/hmmer/HMMAlign.java b/src/jalview/hmmer/HMMAlign.java index 942342c..6255e9f 100644 --- a/src/jalview/hmmer/HMMAlign.java +++ b/src/jalview/hmmer/HMMAlign.java @@ -34,8 +34,6 @@ public class HMMAlign extends HmmerCommand private final AlignmentI dataset; - private AlignmentView msa; - /** * Constructor for the HMMAlignThread * @@ -75,8 +73,9 @@ public class HMMAlign extends HmmerCommand long msgId = System.currentTimeMillis(); af.setProgressBar(MessageManager.getString("status.running_hmmalign"), msgId); - prepareAlignment(); - SequenceI[][] subAlignments = msa.getVisibleContigs('-'); + + AlignmentView msa = af.gatherSequencesForAlignment(); + SequenceI[][] subAlignments = msa.getVisibleContigs(alignment.getGapCharacter()); List allOrders = new ArrayList<>(); @@ -115,7 +114,8 @@ public class HMMAlign extends HmmerCommand job++; } - displayResults(allResults, allOrders); + String title = "hmmalign to " + hmm.getConsensusSequence().getName(); + displayResults(allResults, allOrders, msa, title); af.setProgressBar("", msgId); } @@ -134,8 +134,7 @@ public class HMMAlign extends HmmerCommand * @throws IOException */ private boolean runCommand(File modelFile, File alignmentFile, - File resultFile) - throws IOException + File resultFile) throws IOException { String command = getCommandPath(HMMALIGN); if (command == null) @@ -188,26 +187,21 @@ public class HMMAlign extends HmmerCommand } /** - * Gathers the sequences in preparation for the alignment. - */ - private void prepareAlignment() - { - msa = af.gatherSequencesForAlignment(); - } - - /** * Displays the results of all 'jobs' in a new frame * * @param allResults * * @param allOrders + * @param msa + * @param title */ private void displayResults(SequenceI[][] allResults, - List allOrders) + List allOrders, AlignmentView msa, String title) { AlignmentOrder[] arrOrders = allOrders .toArray(new AlignmentOrder[allOrders.size()]); - Object[] newview = msa.getUpdatedView(allResults, arrOrders, '-'); + Object[] newview = msa.getUpdatedView(allResults, arrOrders, + alignment.getGapCharacter()); SequenceI[] seqs = (SequenceI[]) newview[0]; HiddenColumns hidden = (HiddenColumns) newview[1]; Alignment al = new Alignment(seqs); @@ -217,7 +211,7 @@ public class HMMAlign extends HmmerCommand al.setDataset(dataset); } - displayInNewFrame(al, allOrders, hidden); + displayInNewFrame(al, allOrders, hidden, title); } /** @@ -230,12 +224,14 @@ public class HMMAlign extends HmmerCommand * run * @param hidden * Hidden columns in the previous alignment + * @param title */ private void displayInNewFrame(AlignmentI al, - List alorders, HiddenColumns hidden) + List alorders, HiddenColumns hidden, String title) { AlignFrame alignFrame = new AlignFrame(al, hidden, AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); + alignFrame.setTitle(title); FeatureRendererSettings featureSettings = af.getFeatureRenderer() .getSettings(); -- 1.7.10.2