X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FSplitFrame.java;h=a012092ef6aeac3da67b362c9caa00aa73dea3ec;hb=49ff786d8e7d016cac6895539e6fb0eac8aae95c;hp=d77f3313b944fbcfb7112d21772afb690867e160;hpb=23635fe385da9ea48690349c0530739121600a00;p=jalview.git diff --git a/src/jalview/appletgui/SplitFrame.java b/src/jalview/appletgui/SplitFrame.java index d77f331..a012092 100644 --- a/src/jalview/appletgui/SplitFrame.java +++ b/src/jalview/appletgui/SplitFrame.java @@ -1,6 +1,11 @@ package jalview.appletgui; +import jalview.analysis.AlignmentUtils; +import jalview.analysis.AlignmentUtils.MappingResult; +import jalview.api.ViewStyleI; import jalview.bin.JalviewLite; +import jalview.datamodel.AlignmentI; +import jalview.structure.StructureSelectionManager; import java.awt.BorderLayout; import java.awt.GridLayout; @@ -45,6 +50,42 @@ public class SplitFrame extends EmbmenuFrame addAlignFrameComponents(topFrame, topPanel); addAlignFrameComponents(bottomFrame, bottomPanel); + + /* + * Try to make and add dna/protein sequence mappings + */ + final AlignViewport topViewport = topFrame.viewport; + final AlignViewport bottomViewport = bottomFrame.viewport; + final AlignmentI topAlignment = topViewport.getAlignment(); + final AlignmentI bottomAlignment = bottomViewport.getAlignment(); + // topAlignment.setDataset(null); + // bottomAlignment.setDataset(null); + AlignViewport cdna = topAlignment.isNucleotide() ? topViewport + : (bottomAlignment.isNucleotide() ? bottomViewport : null); + AlignViewport protein = !topAlignment.isNucleotide() ? topViewport + : (!bottomAlignment.isNucleotide() ? bottomViewport : null); + MappingResult mapped = AlignmentUtils.mapProteinToCdna( + protein.getAlignment(), cdna.getAlignment()); + if (mapped != MappingResult.NotMapped) + { + final StructureSelectionManager ssm = StructureSelectionManager + .getStructureSelectionManager(topViewport.applet); + ssm.addMappings(protein.getAlignment().getCodonFrames()); + topViewport.setCodingComplement(bottomViewport); + ssm.addCommandListener(cdna); + ssm.addCommandListener(protein); + } + + /* + * Expand protein to 3 times character width of dna + */ + if (protein != null && cdna != null) + { + ViewStyleI vs = protein.getViewStyle(); + vs.setCharWidth(3 * vs.getCharWidth()); + protein.setViewStyle(vs); + } + } /** @@ -58,7 +99,8 @@ public class SplitFrame extends EmbmenuFrame private void addAlignFrameComponents(AlignFrame af, Panel panel) { panel.setLayout(new BorderLayout()); - Panel menuPanel = makeEmbeddedPopupMenu(af.getMenuBar(), FONT_ARIAL_PLAIN_11, true, false); + Panel menuPanel = af + .makeEmbeddedPopupMenu(af.getMenuBar(), true, false); panel.add(menuPanel, BorderLayout.NORTH); panel.add(af.statusBar, BorderLayout.SOUTH); panel.add(af.alignPanel, BorderLayout.CENTER);