+
+ /*
+ * 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);
+ }
+