/* * Jalview - A Sequence Alignment Editor and Viewer ($Version-Rel$) * Copyright (C) $Year-Rel$ The Jalview Authors * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 * of the License, or (at your option) any later version. * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Jalview. If not, see . * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.analysis; import jalview.analysis.scoremodels.ScoreModels; import jalview.api.analysis.ScoreModelI; import jalview.api.analysis.SimilarityParamsI; import jalview.gui.AlignViewport; /** * @author kjvanderheide * */ public class TreeCalculator extends Thread// add threading { SimilarityParamsI similarityParams; String treeType; String scoreModelName; // if tree computed /** * * @param treeAlgo * @param substitutionMatrix * @param calculateParams */ public TreeCalculator(String treeAlgo, String substitutionMatrix, SimilarityParamsI calculateParams) { this.treeType = treeAlgo; this.scoreModelName = substitutionMatrix; this.similarityParams = calculateParams; } /** * * @param alignViewport * @return */ public TreeBuilder makeTree(AlignViewport alignViewport) { ScoreModelI sm = ScoreModels.getInstance().getScoreModel(scoreModelName, alignViewport.getAlignPanel()); TreeBuilder builtTree = treeType.equals(TreeBuilder.NEIGHBOUR_JOINING) ? new NJTree(alignViewport, sm, similarityParams) : new AverageDistanceTree(alignViewport, sm, similarityParams); return builtTree; } public SimilarityParamsI getSimilarityParams() { return similarityParams; } public void setSimilarityParams(SimilarityParamsI similarityParams) { this.similarityParams = similarityParams; } public String getTreeType() { return treeType; } public void setTreeType(String treeType) { this.treeType = treeType; } public String getScoreModelName() { return scoreModelName; } public void setScoreModelName(String scoreModelName) { this.scoreModelName = scoreModelName; } }