+++ /dev/null
-/*
- * 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 <http://www.gnu.org/licenses/>.
- * The Jalview Authors are detailed in the 'AUTHORS' file.
- */
-package jalview.ext.archaeopteryx;
-
-import jalview.analysis.TreeModel;
-import jalview.io.NewickFile;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-import org.forester.archaeopteryx.Archaeopteryx;
-
-public class ArchaeopteryxNewickInit
-{
- private String filePath = "/tmp/jalviewtree.nwk";
-
- private TreeModel tree;
-
- private NewickFile newickTree;
-
- public ArchaeopteryxNewickInit(TreeModel jalviewTreeModel)
- {
- this.tree = jalviewTreeModel;
- this.newickTree = treeToNewick(tree);
- }
-
- public ArchaeopteryxNewickInit(NewickFile newickTreeModel)
- {
- this.newickTree = newickTreeModel;
- }
-
- public void startArchaeopteryx()
- {
- String newickOutput = newickTree.print(newickTree.hasBootstrap(),
- newickTree.hasDistances(), newickTree.hasRootDistance());
-
- File newickFile = new File(filePath);
- PrintWriter writer;
-
- try
- {
- writer = new PrintWriter(newickFile);
- writer.println(newickOutput);
-
- writer.close();
-
- String[] commandLineArgs = { "-open", newickFile.getCanonicalPath() };
- Archaeopteryx.main(commandLineArgs);
-
- } catch (FileNotFoundException e)
- {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IOException e)
- {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
-
- }
-
-
- public String getFilePath()
- {
- return filePath;
- }
-
- public void setFilePath(String newFilePath)
- {
- this.filePath = newFilePath;
- }
-
- public TreeModel getTree()
- {
- return tree;
- }
-
- public void setTree(TreeModel newTree)
- {
- this.tree = newTree;
- }
-
- public NewickFile getNewickTree()
- {
- return newickTree;
- }
-
- public void setNewickTree(NewickFile newNewickTree)
- {
- this.newickTree = newNewickTree;
- }
-
- public static NewickFile treeToNewick(TreeModel tree)
- {
- NewickFile newickTree = new NewickFile(tree.getTopNode(),
- tree.hasBootstrap(), tree.hasDistances(),
- tree.hasRootDistance());
-
- return newickTree;
- }
-
-}
\ No newline at end of file