import org.forester.phylogeny.Phylogeny;
import org.forester.phylogeny.PhylogenyNode;
+/**
+ * Static class for creating Archaeopteryx tree viewer instances from calculated
+ * trees and letting them be bound to Jalview.
+ *
+ * @author kjvanderheide
+ *
+ */
public final class ArchaeopteryxInit
{
/**
- * This method should generally not be used as it does not bind the tree to
+ * Test method, should generally not be used as it does not bind the tree to
* its alignment
*
* @param aptxTrees
* @return
*/
- public static MainFrame createUnboundInstance(Phylogeny aptxTree)
+ public static MainFrame createUnboundInstance(final Phylogeny aptxTree)
{
Phylogeny[] aptxTrees = { aptxTree };
- return createBoundAptxFrame(aptxTrees, null);
+ return createAptxFrame(aptxTrees);
}
- public static MainFrame createInstance(Phylogeny[] aptxTrees,
- AlignmentViewport jalviewAlignmentView)
- {
- return createBoundAptxFrame(aptxTrees, jalviewAlignmentView);
-
- }
-
- public static MainFrame createInstance(Phylogeny aptxTree,
- AlignmentViewport jalviewAlignmentView)
- {
- Phylogeny[] aptxTrees = { aptxTree }; // future possibility to load in
- // several trees simultaneously
- return createBoundAptxFrame(aptxTrees, jalviewAlignmentView);
-
- }
+ // public static MainFrame createInstance(final Phylogeny[] aptxTrees,
+ // AlignmentViewport jalviewAlignmentView)
+ // {
+ // return createAptxFrameInJalview(aptxTrees);
+ //
+ // }
+ //
+ // public static MainFrame createInstance(final Phylogeny aptxTree,
+ // final AlignmentViewport jalviewAlignmentView)
+ // {
+ // Phylogeny[] aptxTrees = { aptxTree }; // future possibility to load in
+ // // several trees simultaneously
+ // return createAptxFrameInJalview(aptxTrees);
+ //
+ // }
public static MainFrame createInstance(
- TreeBuilder calculatedTree) // very dense method, to be split up
+ final TreeBuilder calculatedTree) // very dense method, to be split up
{
- ArchaeopteryxTreeConverter aptxTreeBuilder = new ArchaeopteryxTreeConverter(
+ ExternalTreeBuilderI<Phylogeny, PhylogenyNode> aptxTreeBuilder = new ArchaeopteryxTreeBuilder(
calculatedTree);
- Phylogeny aptxTree = aptxTreeBuilder.buildAptxTree();
+ Phylogeny aptxTree = aptxTreeBuilder.buildTree();
Phylogeny[] aptxTrees = { aptxTree }; // future possibility to load in
// several trees simultaneously
- MainFrame aptxApp = createBoundAptxFrame(aptxTrees,
- calculatedTree.getAvport());
+ MainFrame aptxApp = createAptxFrame(aptxTrees);
+
bindNodesToJalviewSequences(aptxApp, calculatedTree.getAvport(),
aptxTreeBuilder.getAlignmentBoundNodes(),
aptxTreeBuilder.getNodesBoundAlignment());
- private static MainFrame createBoundAptxFrame(Phylogeny[] aptxTrees,
- AlignmentViewport jalviewAlignmentView)
+ public static MainFrame createAptxFrame(
+ final Phylogeny[] aptxTrees)
{
MainFrame aptxApp = Archaeopteryx.createApplication(aptxTrees,
"_aptx_jalview_configuration_file", null);
-
return aptxApp;
}
- private static void bindNodesToJalviewSequences(MainFrame aptxApp,
- AlignmentViewport jalviewAlignViewport,
- Map<SequenceI, PhylogenyNode> alignMappedToNodes,
- Map<PhylogenyNode, SequenceI> nodesMappedToAlign)
+ public static JalviewTreeViewerBindingI<?> bindNodesToJalviewSequences(
+ final MainFrame aptxApp,
+ final AlignmentViewport jalviewAlignViewport,
+ final Map<SequenceI, PhylogenyNode> alignMappedToNodes,
+ final Map<PhylogenyNode, SequenceI> nodesMappedToAlign)
{
- new JalviewAptxBinding(aptxApp, jalviewAlignViewport,
+ return new JalviewAptxBinding(aptxApp, jalviewAlignViewport,
alignMappedToNodes, nodesMappedToAlign);
}
- private static MainFrame bindFrameToJalview(MainFrame aptxApp)
+ public static MainFrame bindFrameToJalview(final MainFrame aptxApp)
{
int width = 400;
int height = 550;