From e5c87d2dd1d3ebceea890ef92c8a6374c62d3c83 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Tue, 2 May 2017 10:30:58 +0100 Subject: [PATCH] JAL-2499 JAL-2403 push 'configure for view' inside ScoreModels, defer creating model for PCA/Tree, tidy Javadoc --- src/jalview/analysis/scoremodels/PIDModel.java | 16 ++++--- src/jalview/analysis/scoremodels/ScoreMatrix.java | 31 +++++++++--- src/jalview/analysis/scoremodels/ScoreModels.java | 30 +++++++++++- src/jalview/appletgui/TreePanel.java | 50 +++----------------- src/jalview/gui/AlignFrame.java | 47 ++++-------------- src/jalview/gui/CalculationChooser.java | 21 ++++---- src/jalview/gui/PCAPanel.java | 45 +++++------------- src/jalview/gui/TreePanel.java | 36 +++++--------- src/jalview/io/ScoreMatrixFile.java | 3 +- src/jalview/jbgui/GAlignFrame.java | 15 ------ src/jalview/viewmodel/PCAModel.java | 16 ++----- .../analysis/scoremodels/ScoreMatrixTest.java | 2 - test/jalview/io/ScoreMatrixFileTest.java | 6 +-- 13 files changed, 119 insertions(+), 199 deletions(-) diff --git a/src/jalview/analysis/scoremodels/PIDModel.java b/src/jalview/analysis/scoremodels/PIDModel.java index d537e33..985918b 100644 --- a/src/jalview/analysis/scoremodels/PIDModel.java +++ b/src/jalview/analysis/scoremodels/PIDModel.java @@ -8,15 +8,14 @@ import jalview.math.MatrixI; import jalview.util.Comparison; /** - * A class to provide sequence pairwise similarity based on residue identity + * A class to provide sequence pairwise similarity based on residue identity. + * Instances of this class are immutable and thread-safe. */ public class PIDModel extends SimilarityScoreModel implements PairwiseScoreModelI { private static final String NAME = "PID"; - private String description; - /** * Constructor */ @@ -30,10 +29,14 @@ public class PIDModel extends SimilarityScoreModel implements return NAME; } + /** + * Answers null for description. If a display name is needed, use getName() or + * an internationalized string built from the name. + */ @Override public String getDescription() { - return description; + return null; } @Override @@ -80,7 +83,7 @@ public class PIDModel extends SimilarityScoreModel implements * Computes similarity scores based on pairwise percentage identity of * sequences. For consistency with Jalview 2.10.1's SeqSpace mode PCA * calculation, the percentage scores are rescaled to the width of the - * sequences (as if counts of identical residues). + * sequences (as if counts of identical residues). This method is thread-safe. */ @Override public MatrixI findSimilarities(AlignmentView seqData, @@ -98,7 +101,8 @@ public class PIDModel extends SimilarityScoreModel implements /** * A distance score is computed in the usual way (by reversing the range of * the similarity score results), and then rescaled to percentage values - * (reversing the rescaling to count values done in findSimilarities) + * (reversing the rescaling to count values done in findSimilarities). This + * method is thread-safe. */ @Override public MatrixI findDistances(AlignmentView seqData, diff --git a/src/jalview/analysis/scoremodels/ScoreMatrix.java b/src/jalview/analysis/scoremodels/ScoreMatrix.java index 8b1ad2e..9bec6e4 100644 --- a/src/jalview/analysis/scoremodels/ScoreMatrix.java +++ b/src/jalview/analysis/scoremodels/ScoreMatrix.java @@ -31,7 +31,7 @@ import java.util.Arrays; /** * A class that models a substitution score matrix for any given alphabet of - * symbols + * symbols. Instances of this class are immutable and thread-safe. */ public class ScoreMatrix extends SimilarityScoreModel implements PairwiseScoreModelI @@ -95,7 +95,7 @@ public class ScoreMatrix extends SimilarityScoreModel implements private float minValue; private float maxValue; - + /** * Constructor given a name, symbol alphabet, and matrix of scores for pairs * of symbols. The matrix should be square and of the same size as the @@ -110,6 +110,26 @@ public class ScoreMatrix extends SimilarityScoreModel implements */ public ScoreMatrix(String theName, char[] alphabet, float[][] values) { + this(theName, null, alphabet, values); + } + + /** + * Constructor given a name, description, symbol alphabet, and matrix of + * scores for pairs of symbols. The matrix should be square and of the same + * size as the alphabet, for example 20x20 for a 20 symbol alphabet. + * + * @param theName + * Unique, human readable name for the matrix + * @param theDescription + * descriptive display name suitable for use in menus + * @param alphabet + * the symbols to which scores apply + * @param values + * Pairwise scores indexed according to the symbol alphabet + */ + public ScoreMatrix(String theName, String theDescription, + char[] alphabet, float[][] values) + { if (alphabet.length != values.length) { throw new IllegalArgumentException( @@ -126,6 +146,7 @@ public class ScoreMatrix extends SimilarityScoreModel implements this.matrix = values; this.name = theName; + this.description = theDescription; this.symbols = alphabet; symbolIndex = buildSymbolIndex(alphabet); @@ -410,6 +431,7 @@ public class ScoreMatrix extends SimilarityScoreModel implements *
  • product[0, 1] = F.R + K.- + L.D = -3 + -1 + -3 = -8 *
  • and so on
  • * + * This method is thread-safe. */ @Override public MatrixI findSimilarities(AlignmentView seqstrings, @@ -551,11 +573,6 @@ public class ScoreMatrix extends SimilarityScoreModel implements return new String(symbols); } - public void setDescription(String desc) - { - description = desc; - } - public float getMinimumScore() { return minValue; diff --git a/src/jalview/analysis/scoremodels/ScoreModels.java b/src/jalview/analysis/scoremodels/ScoreModels.java index 494d09f..7146383 100644 --- a/src/jalview/analysis/scoremodels/ScoreModels.java +++ b/src/jalview/analysis/scoremodels/ScoreModels.java @@ -1,6 +1,8 @@ package jalview.analysis.scoremodels; +import jalview.api.AlignmentViewPanel; import jalview.api.analysis.ScoreModelI; +import jalview.api.analysis.ViewBasedAnalysisI; import jalview.io.DataSourceType; import jalview.io.FileParse; import jalview.io.ScoreMatrixFile; @@ -90,9 +92,33 @@ public class ScoreModels return models.values(); } - public ScoreModelI forName(String s) + /** + * Returns an instance of a score model for the given name. If the model is of + * 'view dependent' type (e.g. feature similarity), instantiates a new + * instance configured for the given view. Otherwise returns a cached instance + * of the score model. + * + * @param name + * @param avp + * @return + */ + public ScoreModelI getScoreModel(String name, AlignmentViewPanel avp) { - return models.get(s); + ScoreModelI model = models.get(name); + if (model instanceof ViewBasedAnalysisI) + { + try + { + model = model.getClass().newInstance(); + ((ViewBasedAnalysisI) model).configureFromAlignmentView(avp); + } catch (IllegalAccessException | InstantiationException e) + { + System.err.println("Error creating score model " + name + ": " + + e.getMessage()); + return null; + } + } + return model; } public void registerScoreModel(ScoreModelI sm) diff --git a/src/jalview/appletgui/TreePanel.java b/src/jalview/appletgui/TreePanel.java index 905a54a..70a3c04 100644 --- a/src/jalview/appletgui/TreePanel.java +++ b/src/jalview/appletgui/TreePanel.java @@ -27,8 +27,6 @@ import jalview.analysis.TreeModel; import jalview.analysis.scoremodels.ScoreModels; import jalview.analysis.scoremodels.SimilarityParams; import jalview.api.analysis.ScoreModelI; -import jalview.api.analysis.ViewBasedAnalysisI; -import jalview.bin.Cache; import jalview.datamodel.Alignment; import jalview.datamodel.ColumnSelection; import jalview.datamodel.SequenceI; @@ -83,21 +81,8 @@ public class TreePanel extends EmbmenuFrame implements ActionListener, /** * Creates a new TreePanel object. - * - * @param av - * DOCUMENT ME! - * @param seqVector - * DOCUMENT ME! - * @param type - * DOCUMENT ME! - * @param pwtype - * DOCUMENT ME! - * @param s - * DOCUMENT ME! - * @param e - * DOCUMENT ME! */ - public TreePanel(AlignmentPanel ap, String type, String pwtype) + public TreePanel(AlignmentPanel alignPanel, String type, String pwtype) { try { @@ -108,22 +93,12 @@ public class TreePanel extends EmbmenuFrame implements ActionListener, ex.printStackTrace(); } - initTreePanel(ap, type, pwtype, null); + initTreePanel(alignPanel, type, pwtype, null); } /** * Creates a new TreePanel object. * - * @param av - * DOCUMENT ME! - * @param seqVector - * DOCUMENT ME! - * @param newtree - * DOCUMENT ME! - * @param type - * DOCUMENT ME! - * @param pwtype - * DOCUMENT ME! */ public TreePanel(AlignmentPanel ap, String type, String pwtype, NewickFile newtree) @@ -388,27 +363,16 @@ public class TreePanel extends EmbmenuFrame implements ActionListener, } /** - * Gets the score model for the given name. If the score model is one that - * requires to get state data from the current view, allow it to do so + * Gets an instantiated score model for the given name, configured for the + * current view if applicable * - * @param sm + * @param modelName * @return */ protected ScoreModelI configureScoreModel(String modelName) { - ScoreModelI sm = ScoreModels.getInstance().forName(modelName); - if (sm instanceof ViewBasedAnalysisI) - { - try - { - sm = sm.getClass().newInstance(); - ((ViewBasedAnalysisI) sm).configureFromAlignmentView(treeCanvas.ap); - } catch (Exception q) - { - Cache.log.error("Couldn't create a scoremodel instance for " - + sm.getName()); - } - } + ScoreModelI sm = ScoreModels.getInstance().getScoreModel(modelName, + treeCanvas.ap); return sm; } diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index bed434d..8eb09ab 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -34,7 +34,6 @@ import jalview.api.AlignmentViewPanel; import jalview.api.FeatureSettingsControllerI; import jalview.api.SplitContainerI; import jalview.api.ViewStyleI; -import jalview.api.analysis.ScoreModelI; import jalview.api.analysis.SimilarityParamsI; import jalview.bin.Cache; import jalview.bin.Jalview; @@ -3546,35 +3545,6 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } } - /** - * DOCUMENT ME! - * - * @param e - * DOCUMENT ME! - */ - @Override - public void PCAMenuItem_actionPerformed(ActionEvent e) - { - if (((viewport.getSelectionGroup() != null) - && (viewport.getSelectionGroup().getSize() < 4) && (viewport - .getSelectionGroup().getSize() > 0)) - || (viewport.getAlignment().getHeight() < 4)) - { - JvOptionPane - .showInternalMessageDialog( - this, - MessageManager - .getString("label.principal_component_analysis_must_take_least_four_input_sequences"), - MessageManager - .getString("label.sequence_selection_insufficient"), - JvOptionPane.WARNING_MESSAGE); - - return; - } - - new PCAPanel(alignPanel); - } - @Override public void autoCalculate_actionPerformed(ActionEvent e) { @@ -3603,16 +3573,17 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * * @param type * tree type (NJ or AV) - * @param sm - * distance or similarity score model used to compute the tree + * @param modelName + * name of score model used to compute the tree * @param options * parameters for the distance or similarity calculation */ - void newTreePanel(String type, ScoreModelI sm, SimilarityParamsI options) + void newTreePanel(String type, String modelName, SimilarityParamsI options) { String frameTitle = ""; TreePanel tp; + boolean onSelection = false; if (viewport.getSelectionGroup() != null && viewport.getSelectionGroup().getSize() > 0) { @@ -3648,9 +3619,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, return; } } - - tp = new TreePanel(alignPanel, type, sm, options); - frameTitle = tp.getPanelTitle() + " on region"; + onSelection = true; } else { @@ -3658,11 +3627,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { return; } - - tp = new TreePanel(alignPanel, type, sm, options); - frameTitle = tp.getPanelTitle(); } + tp = new TreePanel(alignPanel, type, modelName, options); + frameTitle = tp.getPanelTitle() + (onSelection ? " on region" : ""); + frameTitle += " from "; if (viewport.viewName != null) diff --git a/src/jalview/gui/CalculationChooser.java b/src/jalview/gui/CalculationChooser.java index 7b3bf22..ee67d06 100644 --- a/src/jalview/gui/CalculationChooser.java +++ b/src/jalview/gui/CalculationChooser.java @@ -321,22 +321,21 @@ public class CalculationChooser extends JPanel } /** - * Open and calculate the selected tree on 'OK' + * Open and calculate the selected tree or PCA on 'OK' */ protected void ok_actionPerformed() { boolean doPCA = pca.isSelected(); - ScoreModelI sm = ScoreModels.getInstance().forName( - modelNames.getSelectedItem().toString()); + String modelName = modelNames.getSelectedItem().toString(); SimilarityParamsI params = getSimilarityParameters(doPCA); if (doPCA) { - openPcaPanel(sm, params); + openPcaPanel(modelName, params); } else { - openTreePanel(sm, params); + openTreePanel(modelName, params); } // closeFrame(); @@ -345,23 +344,23 @@ public class CalculationChooser extends JPanel /** * Open a new Tree panel on the desktop * - * @param sm + * @param modelName * @param params */ - protected void openTreePanel(ScoreModelI sm, SimilarityParamsI params) + protected void openTreePanel(String modelName, SimilarityParamsI params) { String treeType = neighbourJoining.isSelected() ? TreeBuilder.NEIGHBOUR_JOINING : TreeBuilder.AVERAGE_DISTANCE; - af.newTreePanel(treeType, sm, params); + af.newTreePanel(treeType, modelName, params); } /** * Open a new PCA panel on the desktop * - * @param sm + * @param modelName * @param params */ - protected void openPcaPanel(ScoreModelI sm, SimilarityParamsI params) + protected void openPcaPanel(String modelName, SimilarityParamsI params) { AlignViewport viewport = af.getViewport(); if (((viewport.getSelectionGroup() != null) @@ -379,7 +378,7 @@ public class CalculationChooser extends JPanel JvOptionPane.WARNING_MESSAGE); return; } - new PCAPanel(af.alignPanel, sm, params); + new PCAPanel(af.alignPanel, modelName, params); } /** diff --git a/src/jalview/gui/PCAPanel.java b/src/jalview/gui/PCAPanel.java index 482dff3..0675cdf 100644 --- a/src/jalview/gui/PCAPanel.java +++ b/src/jalview/gui/PCAPanel.java @@ -24,8 +24,6 @@ import jalview.analysis.scoremodels.ScoreModels; import jalview.analysis.scoremodels.SimilarityParams; import jalview.api.analysis.ScoreModelI; import jalview.api.analysis.SimilarityParamsI; -import jalview.api.analysis.ViewBasedAnalysisI; -import jalview.bin.Cache; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentI; import jalview.datamodel.AlignmentView; @@ -83,20 +81,20 @@ public class PCAPanel extends GPCAPanel implements Runnable, */ public PCAPanel(AlignmentPanel alignPanel) { - this(alignPanel, ScoreModels.getInstance().getDefaultModel( - !alignPanel.av.getAlignment().isNucleotide()), - SimilarityParams.SeqSpace); + this(alignPanel, ScoreModels.getInstance() + .getDefaultModel(!alignPanel.av.getAlignment().isNucleotide()) + .getName(), SimilarityParams.SeqSpace); } /** - * Constructor given sequence data, a similarity (or distance) score model, - * and score calculation parameters + * Constructor given sequence data, a similarity (or distance) score model + * name, and score calculation parameters * * @param alignPanel - * @param scoreModel + * @param modelName * @param params */ - public PCAPanel(AlignmentPanel alignPanel, ScoreModelI scoreModel, + public PCAPanel(AlignmentPanel alignPanel, String modelName, SimilarityParamsI params) { super(); @@ -128,6 +126,8 @@ public class PCAPanel extends GPCAPanel implements Runnable, seqs = av.getSelectionGroup().getSequencesInOrder(av.getAlignment()); } + ScoreModelI scoreModel = ScoreModels.getInstance().getScoreModel( + modelName, ap); pcaModel = new PCAModel(seqstrings, seqs, nucleotide, scoreModel, params); PaintRefresher.Register(this, av.getSequenceSetId()); @@ -184,7 +184,8 @@ public class PCAPanel extends GPCAPanel implements Runnable, { if (!pcaModel.getScoreModelName().equals(name)) { - ScoreModelI sm2 = configureScoreModel(sm); + ScoreModelI sm2 = ScoreModels.getInstance().getScoreModel( + name, ap); pcaModel.setScoreModel(sm2); Thread worker = new Thread(PCAPanel.this); worker.start(); @@ -776,28 +777,4 @@ public class PCAPanel extends GPCAPanel implements Runnable, top = t; zCombobox.setSelectedIndex(2); } - - /** - * If the score model is one that requires to get state data from the current - * view, allow it to do so - * - * @param sm - * @return - */ - protected ScoreModelI configureScoreModel(ScoreModelI sm) - { - if (sm instanceof ViewBasedAnalysisI) - { - try - { - sm = sm.getClass().newInstance(); - ((ViewBasedAnalysisI) sm).configureFromAlignmentView(ap); - } catch (Exception q) - { - Cache.log.error("Couldn't create a scoremodel instance for " - + sm.getName()); - } - } - return sm; - } } diff --git a/src/jalview/gui/TreePanel.java b/src/jalview/gui/TreePanel.java index d173319..f2f0bf7 100755 --- a/src/jalview/gui/TreePanel.java +++ b/src/jalview/gui/TreePanel.java @@ -25,9 +25,9 @@ import jalview.analysis.AverageDistanceTree; import jalview.analysis.NJTree; import jalview.analysis.TreeBuilder; import jalview.analysis.TreeModel; +import jalview.analysis.scoremodels.ScoreModels; import jalview.api.analysis.ScoreModelI; import jalview.api.analysis.SimilarityParamsI; -import jalview.api.analysis.ViewBasedAnalysisI; import jalview.bin.Cache; import jalview.commands.CommandI; import jalview.commands.OrderCommand; @@ -76,7 +76,7 @@ public class TreePanel extends GTreePanel { String treeType; - ScoreModelI scoreModel; // if tree computed + String scoreModelName; // if tree computed String treeTitle; // if tree loaded @@ -93,15 +93,15 @@ public class TreePanel extends GTreePanel * * @param ap * @param type - * @param sm + * @param modelName * @param options */ - public TreePanel(AlignmentPanel ap, String type, ScoreModelI sm, + public TreePanel(AlignmentPanel ap, String type, String modelName, SimilarityParamsI options) { super(); this.similarityParams = options; - initTreePanel(ap, type, sm, null, null); + initTreePanel(ap, type, modelName, null, null); // We know this tree has distances. JBPNote TODO: prolly should add this as // a userdefined default @@ -126,13 +126,13 @@ public class TreePanel extends GTreePanel return treeCanvas.av; } - void initTreePanel(AlignmentPanel ap, String type, ScoreModelI sm, + void initTreePanel(AlignmentPanel ap, String type, String modelName, NewickFile newTree, AlignmentView inputData) { av = ap.av; this.treeType = type; - this.scoreModel = sm; + this.scoreModelName = modelName; treeCanvas = new TreeCanvas(this, ap, scrollPane); scrollPane.setViewportView(treeCanvas); @@ -841,7 +841,7 @@ public class TreePanel extends GTreePanel /* * short score model name (long description can be too long) */ - String smn = scoreModel.getName(); + String smn = scoreModelName; /* * put them together as Using @@ -852,26 +852,14 @@ public class TreePanel extends GTreePanel } /** - * If the score model is one that requires to get state data from the current - * view, create and configure a new instance of it + * Instantiate an instance of the score model, configured for the current view + * if applicable * * @return */ protected ScoreModelI configureScoreModel() { - if (scoreModel instanceof ViewBasedAnalysisI) - { - try - { - scoreModel = scoreModel.getClass().newInstance(); - ((ViewBasedAnalysisI) scoreModel) - .configureFromAlignmentView(treeCanvas.ap); - } catch (Exception q) - { - Cache.log.error("Couldn't create a scoremodel instance for " - + scoreModel.getName()); - } - } - return scoreModel; + return ScoreModels.getInstance().getScoreModel(scoreModelName, + treeCanvas.ap); } } diff --git a/src/jalview/io/ScoreMatrixFile.java b/src/jalview/io/ScoreMatrixFile.java index 3a7ff4f..6b2f891 100644 --- a/src/jalview/io/ScoreMatrixFile.java +++ b/src/jalview/io/ScoreMatrixFile.java @@ -255,8 +255,7 @@ public class ScoreMatrixFile extends AlignFile implements } } - ScoreMatrix sm = new ScoreMatrix(name, alphabet, scores); - sm.setDescription(description); + ScoreMatrix sm = new ScoreMatrix(name, description, alphabet, scores); matrixName = name; return sm; diff --git a/src/jalview/jbgui/GAlignFrame.java b/src/jalview/jbgui/GAlignFrame.java index 3707343..58034d9 100755 --- a/src/jalview/jbgui/GAlignFrame.java +++ b/src/jalview/jbgui/GAlignFrame.java @@ -523,16 +523,6 @@ public class GAlignFrame extends JInternalFrame pairwiseAlignmentMenuItem_actionPerformed(e); } }); - JMenuItem PCAMenuItem = new JMenuItem( - MessageManager.getString("label.principal_component_analysis")); - PCAMenuItem.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - PCAMenuItem_actionPerformed(e); - } - }); this.getContentPane().setLayout(new BorderLayout()); alignFrameMenuBar.setFont(new java.awt.Font("Verdana", 0, 11)); @@ -1802,7 +1792,6 @@ public class GAlignFrame extends JInternalFrame calculateMenu.add(calculateTree); calculateMenu.addSeparator(); calculateMenu.add(pairwiseAlignmentMenuItem); - // calculateMenu.add(PCAMenuItem); calculateMenu.addSeparator(); calculateMenu.add(showTranslation); calculateMenu.add(showReverse); @@ -2289,10 +2278,6 @@ public class GAlignFrame extends JInternalFrame { } - protected void PCAMenuItem_actionPerformed(ActionEvent e) - { - } - protected void neighbourTreeMenuItem_actionPerformed(ActionEvent e) { } diff --git a/src/jalview/viewmodel/PCAModel.java b/src/jalview/viewmodel/PCAModel.java index 0121e5c..928d35e 100644 --- a/src/jalview/viewmodel/PCAModel.java +++ b/src/jalview/viewmodel/PCAModel.java @@ -41,7 +41,7 @@ public class PCAModel SequenceI[] seqs; /* - * Score model used to calculate PCA + * Name of score model used to calculate PCA */ ScoreModelI scoreModel; @@ -49,8 +49,6 @@ public class PCAModel private Vector points; - private boolean jvCalcMode = true; - private SimilarityParamsI similarityParams; /** @@ -60,16 +58,17 @@ public class PCAModel * @param seqData * @param sqs * @param nuc - * @param sm + * @param modelName * @param params */ - public PCAModel(AlignmentView seqData, SequenceI[] sqs, boolean nuc, ScoreModelI sm, + public PCAModel(AlignmentView seqData, SequenceI[] sqs, boolean nuc, + ScoreModelI modelName, SimilarityParamsI params) { seqstrings = seqData; seqs = sqs; nucleotide = nuc; - scoreModel = sm; + scoreModel = modelName; similarityParams = params; } @@ -222,11 +221,6 @@ public class PCAModel return pts; } - public void setJvCalcMode(boolean state) - { - jvCalcMode = state; - } - public String getScoreModelName() { return scoreModel == null ? "" : scoreModel.getName(); diff --git a/test/jalview/analysis/scoremodels/ScoreMatrixTest.java b/test/jalview/analysis/scoremodels/ScoreMatrixTest.java index da17000..1a5d43c 100644 --- a/test/jalview/analysis/scoremodels/ScoreMatrixTest.java +++ b/test/jalview/analysis/scoremodels/ScoreMatrixTest.java @@ -422,8 +422,6 @@ public class ScoreMatrixTest assertTrue(sm.isProtein()); assertFalse(sm.isDNA()); assertNull(sm.getDescription()); - sm.setDescription("BLOSUM62"); - assertEquals(sm.getDescription(), "BLOSUM62"); /* * verify expected scores against ARNDCQEGHILKMFPSTWYVBZX diff --git a/test/jalview/io/ScoreMatrixFileTest.java b/test/jalview/io/ScoreMatrixFileTest.java index 1aa191a..97349b5 100644 --- a/test/jalview/io/ScoreMatrixFileTest.java +++ b/test/jalview/io/ScoreMatrixFileTest.java @@ -484,7 +484,7 @@ public class ScoreMatrixFileTest public void testParse_ncbiFormat() throws MalformedURLException, IOException { - assertNull(ScoreModels.getInstance().forName("MyNewTest")); + assertNull(ScoreModels.getInstance().getScoreModel("MyNewTest", null)); String data = "ScoreMatrix MyNewTest\n" + "\tA\tB\tC\n" + "A\t1.0\t2.0\t3.0\n" + "B\t4.0\t5.0\t6.0\n" @@ -494,8 +494,8 @@ public class ScoreMatrixFileTest parser.parse(); - ScoreMatrix sm = (ScoreMatrix) ScoreModels.getInstance().forName( - "MyNewTest"); + ScoreMatrix sm = (ScoreMatrix) ScoreModels.getInstance().getScoreModel( + "MyNewTest", null); assertNotNull(sm); assertEquals(sm.getName(), "MyNewTest"); assertEquals(parser.getMatrixName(), "MyNewTest"); -- 1.7.10.2