import jalview.jbgui.*;\r
import jalview.schemes.*;\r
import jalview.ws.*;\r
+import javax.swing.event.AncestorEvent;\r
\r
/**\r
* DOCUMENT ME!\r
else if(sortby.equals("Pairwise Identity"))\r
sortPairwiseMenuItem_actionPerformed(null);\r
\r
- tabbedPane.add(al.isNucleotide() ? "DNA":"Protein", alignPanel);\r
+ // remove(tabbedPane);\r
+ getContentPane().add(alignPanel, BorderLayout.CENTER);\r
+\r
+ setGUINucleotide(al.isNucleotide());\r
+\r
+ // tabbedPane.add(al.isNucleotide() ? "DNA":"Protein", alignPanel);\r
\r
///Dataset tab\r
/////////////////////////\r
-\r
if(al.getDataset()==null)\r
{\r
al.setDataset(null);\r
}\r
-\r
- AlignViewport ds = new AlignViewport(al.getDataset(), true);\r
- AlignmentPanel dap = new AlignmentPanel(this, ds);\r
- tabbedPane.add("Dataset", dap);\r
- viewports.add(ds);\r
- alignPanels.add(dap);\r
+ // AlignViewport ds = new AlignViewport(al.getDataset(), true);\r
+ // AlignmentPanel dap = new AlignmentPanel(this, ds);\r
+ // tabbedPane.add("Dataset", dap);\r
+ // viewports.add(ds);\r
+ // alignPanels.add(dap);\r
/////////////////////////\r
\r
\r
}\r
});\r
\r
-\r
if(Desktop.desktop!=null)\r
addServiceListeners();\r
}\r
\r
}\r
\r
+ public void setGUINucleotide(boolean nucleotide)\r
+ {\r
+ showTranslation.setVisible( nucleotide );\r
+ sequenceFeatures.setVisible(!nucleotide );\r
+ featureSettings.setVisible( !nucleotide );\r
+ conservationMenuItem.setVisible( !nucleotide );\r
+ modifyConservation.setVisible( !nucleotide );\r
+\r
+ //Deal with separators\r
+ //Remember AlignFrame always starts as protein\r
+ if(nucleotide)\r
+ {\r
+ viewMenu.remove(viewMenu.getItemCount()-2);\r
+ }\r
+ else\r
+ {\r
+ calculateMenu.remove(calculateMenu.getItemCount()-2);\r
+ }\r
+ }\r
+\r
\r
/*\r
Added so Castor Mapping file can obtain Jalview Version\r
*/\r
protected void htmlMenuItem_actionPerformed(ActionEvent e)\r
{\r
- new HTMLOutput(viewport);\r
+ new HTMLOutput(viewport,\r
+ alignPanel.seqPanel.seqCanvas.getSequenceRenderer(),\r
+ alignPanel.seqPanel.seqCanvas.getFeatureRenderer());\r
}\r
\r
public void createImageMap(File file, String image)\r
\r
public void showTranslation_actionPerformed(ActionEvent e)\r
{\r
-\r
- if(!viewport.alignment.isNucleotide())\r
- return;\r
-\r
- viewport.showTranslation(showTranslation.isSelected());\r
-\r
- if(!viewport.alignment.isNucleotide())\r
- return;\r
-\r
int s, sSize = viewport.alignment.getHeight();\r
SequenceI [] newSeq = new SequenceI[sSize];\r
\r
int res, resSize;\r
StringBuffer protein;\r
- SequenceI seq;\r
+ String seq;\r
for(s=0; s<sSize; s++)\r
{\r
protein = new StringBuffer();\r
- seq = (SequenceI)viewport.alignment.getSequenceAt(s);\r
- resSize = seq.getLength();\r
+ seq = AlignSeq.extractGaps("-. ", viewport.alignment.getSequenceAt(s).getSequence());\r
+ resSize = seq.length();\r
for(res = 0; res < resSize; res+=3)\r
{\r
- String codon = seq.getSequence(res, res+3);\r
+ String codon = seq.substring(res, res+3);\r
codon = codon.replace('U', 'T');\r
String aa = ResidueProperties.codonTranslate(codon);\r
if(aa==null)\r
else\r
protein.append( aa );\r
}\r
- newSeq[s] = new Sequence(seq.getName(), protein.toString());\r
+ newSeq[s] = new Sequence(viewport.alignment.getSequenceAt(s).getName(), protein.toString());\r
}\r
\r
\r
}\r
\r
\r
- // Desktop.addInternalFrame(af, "Translation of "+this.getTitle(),\r
- // NEW_WINDOW_WIDTH,\r
- // NEW_WINDOW_HEIGHT);\r
+ AlignFrame af = new AlignFrame(al);\r
+ Desktop.addInternalFrame(af, "Translation of "+this.getTitle(),\r
+ NEW_WINDOW_WIDTH,\r
+ NEW_WINDOW_HEIGHT);\r
\r
- AlignViewport newViewport = new AlignViewport(al);\r
- AlignmentPanel ap = new AlignmentPanel(this, newViewport);\r
- tabbedPane.add("Protein", ap);\r
- viewports.add(newViewport);\r
- alignPanels.add(ap);\r
+\r
+ // AlignViewport newViewport = new AlignViewport(al);\r
+ // AlignmentPanel ap = new AlignmentPanel(this, newViewport);\r
+ // tabbedPane.add("Protein", ap);\r
+ // viewports.add(newViewport);\r
+ // alignPanels.add(ap);\r
\r
///Dataset tab\r
/////////////////////////\r
\r
- AlignViewport ds = new AlignViewport(al.getDataset());\r
- ds.setDataset(true);\r
- AlignmentPanel dap = new AlignmentPanel(this, ds);\r
- tabbedPane.add("Dataset", dap);\r
- viewports.add(ds);\r
- alignPanels.add(dap);\r
+ // AlignViewport ds = new AlignViewport(al.getDataset());\r
+ // ds.setDataset(true);\r
+ // AlignmentPanel dap = new AlignmentPanel(this, ds);\r
+ // tabbedPane.add("Dataset", dap);\r
+ // viewports.add(ds);\r
+ // alignPanels.add(dap);\r
/////////////////////////\r
\r
\r
}\r
\r
-public void tabSelected()\r
-{\r
+/*public void tabSelected()\r
+ {\r
int index = tabbedPane.getSelectedIndex();\r
viewport = (AlignViewport)viewports.elementAt(index);\r
alignPanel = (AlignmentPanel)alignPanels.elementAt(index);\r
-}\r
-\r
+ }*/\r
}\r