* @param aptxTrees
* @return
*/
- public static MainFrame createUnboundInstance(Phylogeny aptxTree)
+ public static MainFrame createUnboundInstance(final Phylogeny aptxTree)
{
Phylogeny[] aptxTrees = { aptxTree };
return createBoundAptxFrame(aptxTrees, null);
}
- public static MainFrame createInstance(Phylogeny[] aptxTrees,
+ public static MainFrame createInstance(final Phylogeny[] aptxTrees,
AlignmentViewport jalviewAlignmentView)
{
return createBoundAptxFrame(aptxTrees, jalviewAlignmentView);
}
- public static MainFrame createInstance(Phylogeny aptxTree,
- AlignmentViewport jalviewAlignmentView)
+ public static MainFrame createInstance(final Phylogeny aptxTree,
+ final AlignmentViewport jalviewAlignmentView)
{
Phylogeny[] aptxTrees = { aptxTree }; // future possibility to load in
// several trees simultaneously
}
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(
calculatedTree);
- private static MainFrame createBoundAptxFrame(Phylogeny[] aptxTrees,
- AlignmentViewport jalviewAlignmentView)
+ private static MainFrame createBoundAptxFrame(final Phylogeny[] aptxTrees,
+ final AlignmentViewport jalviewAlignmentView)
{
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)
+ private static void bindNodesToJalviewSequences(final MainFrame aptxApp,
+ final AlignmentViewport jalviewAlignViewport,
+ final Map<SequenceI, PhylogenyNode> alignMappedToNodes,
+ final Map<PhylogenyNode, SequenceI> nodesMappedToAlign)
{
new JalviewAptxBinding(aptxApp, jalviewAlignViewport,
alignMappedToNodes, nodesMappedToAlign);
}
- private static MainFrame bindFrameToJalview(MainFrame aptxApp)
+ private static MainFrame bindFrameToJalview(final MainFrame aptxApp)
{
int width = 400;
int height = 550;
import org.forester.phylogeny.data.NodeData;
import org.forester.phylogeny.data.Sequence;
-public class ArchaeopteryxTreeConverter // implements PhylogenyFactory
+/**
+ * Note that this currently demands a 1:1 relationship between nodes and
+ * sequences
+ *
+ * @author kjvanderheide
+ *
+ */
+public class ArchaeopteryxTreeConverter
{
protected final SequenceI[] sequences;
for (SequenceI sequence : sequences)
{
Sequence seq = ForesterConversions
- .createForesterSequence(sequence);
+ .createForesterSequence(sequence, true);
PhylogenyNode sequenceNode = new PhylogenyNode(sequence.getName());
NodeData nodeData = sequenceNode.getNodeData();
nodeData.setSequence(seq);
AlignmentViewport parentAvport;
- StructureSelectionManager ssm;
+ final StructureSelectionManager ssm;
Map<SequenceI, PhylogenyNode> sequencesBoundToNodes;
Map<PhylogenyNode, SequenceI> nodesBoundToSequences;
- public JalviewAptxBinding(MainFrame archaeopteryx,
- AlignmentViewport jalviewAlignmentViewport,
- Map<SequenceI, PhylogenyNode> alignMappedToNodes,
- Map<PhylogenyNode, SequenceI> nodesMappedToAlign)
+ public JalviewAptxBinding(final MainFrame archaeopteryx,
+ final AlignmentViewport jalviewAlignmentViewport,
+ final Map<SequenceI, PhylogenyNode> alignMappedToNodes,
+ final Map<PhylogenyNode, SequenceI> nodesMappedToAlign)
{
parentAvport = jalviewAlignmentViewport;
sequencesBoundToNodes = alignMappedToNodes;
}
@Override
- public void mousePressed(MouseEvent e)
+ public void mousePressed(final MouseEvent e)
{
showNodeSelectionOnAlign(e);
}
{
}
+
@Override
- public void selection(SequenceGroup seqsel, ColumnSelection colsel,
- HiddenColumns hidden, SelectionSource source)
+ public void selection(final SequenceGroup seqsel,
+ final ColumnSelection colsel, final HiddenColumns hidden,
+ final SelectionSource source)
{
if (source == parentAvport) // check if source is alignment from where the
- // tree originates
+ // tree originates
{
treeView.setFoundNodes0(
new HashSet<Long>(seqsel.getSequences().size()));
}
/**
- * Note that this currently only checks external nodes
+ * If a node is selected in the tree panel this method highlights the
+ * corresponding sequence in the Jalview alignment view.
*/
@Override
- public void showNodeSelectionOnAlign(MouseEvent e)
+ public void showNodeSelectionOnAlign(final MouseEvent e)
{
final PhylogenyNode node = treeView.findNode(e.getX(), e.getY());
if (node != null)
treeSelectionChanged(matchingSequence);
parentAvport.sendSelection(); // not actually needed?
-
PaintRefresher.Refresh(treeView, parentAvport.getSequenceSetId());
+
+
}
}
+
}
/**
*
* @param sequence
*/
- public void treeSelectionChanged(SequenceI sequence)
+ public void treeSelectionChanged(final SequenceI sequence)
{
SequenceGroup selected = parentAvport.getSelectionGroup();
return parentAvport;
}
- public void setParentAvport(AlignmentViewport parentAvport)
+ public void setParentAvport(final AlignmentViewport parentAvport)
{
this.parentAvport = parentAvport;
}
public final class ForesterConversions
{
public static org.forester.phylogeny.data.Sequence createForesterSequence(
- SequenceI jalviewSequence)
+ final SequenceI jalviewSequence, final boolean sequenceIsAligned)
{
org.forester.phylogeny.data.Sequence foresterSeq = new org.forester.phylogeny.data.Sequence();
+
if (jalviewSequence.getDescription() != null)
{
foresterSeq.setName(jalviewSequence.getDescription());
}
- foresterSeq.setMolecularSequenceAligned(true); // all tree sequences should
+ foresterSeq.setMolecularSequenceAligned(sequenceIsAligned); // all tree
+ // sequences
+ // should
// be aligned already
foresterSeq.setMolecularSequence(jalviewSequence.getSequenceAsString());
if (jalviewSequence.isProtein()) // add checks for DNA or RNA (infer from