use of dr.app.beauti.alignmentviewer.NucleotideDecorator in project beast-mcmc by beast-dev.
the class DataPanel method showAlignment.
private void showAlignment() {
int[] selRows = dataTable.getSelectedRows();
for (int row : selRows) {
AbstractPartitionData partition = options.dataPartitions.get(row);
Alignment alignment = null;
if (partition instanceof PartitionData)
alignment = ((PartitionData) partition).getAlignment();
// alignment == null if partition is trait or microsat http://code.google.com/p/beast-mcmc/issues/detail?id=343
if (alignment == null) {
JOptionPane.showMessageDialog(this, "Cannot display traits or microsatellite data currently.\nUse the traits panel to view and edit traits.", "Illegal Argument Exception", JOptionPane.ERROR_MESSAGE);
return;
}
JFrame frame = new JFrame();
frame.setSize(800, 600);
AlignmentViewer viewer = new AlignmentViewer();
if (alignment.getDataType().getType() == DataType.NUCLEOTIDES) {
viewer.setCellDecorator(new StateCellDecorator(new NucleotideDecorator(), false));
} else if (alignment.getDataType().getType() == DataType.AMINO_ACIDS) {
viewer.setCellDecorator(new StateCellDecorator(new AminoAcidDecorator(), false));
} else {
// no colouring
}
viewer.setAlignmentBuffer(new BeautiAlignmentBuffer(alignment));
JPanel panel = new JPanel(new BorderLayout());
panel.setOpaque(false);
panel.add(viewer, BorderLayout.CENTER);
JPanel infoPanel = new JPanel(new BorderLayout());
infoPanel.setOpaque(false);
panel.add(infoPanel, BorderLayout.SOUTH);
frame.setContentPane(panel);
frame.setVisible(true);
}
}
Aggregations