/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
import jalview.io.JalviewFileView;
import jalview.io.JnetAnnotationMaker;
import jalview.io.NewickFile;
+import jalview.io.TCoffeeScoreFile;
import jalview.jbgui.GAlignFrame;
import jalview.schemes.Blosum62ColourScheme;
import jalview.schemes.BuriedColourScheme;
import jalview.schemes.NucleotideColourScheme;
import jalview.schemes.PIDColourScheme;
import jalview.schemes.PurinePyrimidineColourScheme;
+import jalview.schemes.RNAHelicesColourChooser;
import jalview.schemes.ResidueProperties;
import jalview.schemes.StrandColourScheme;
+import jalview.schemes.TCoffeeColourScheme;
import jalview.schemes.TaylorColourScheme;
import jalview.schemes.TurnColourScheme;
import jalview.schemes.UserColourScheme;
import jalview.schemes.ZappoColourScheme;
-import jalview.ws.WSMenuEntryProviderI;
import jalview.ws.jws1.Discoverer;
import jalview.ws.jws2.Jws2Discoverer;
+import jalview.ws.seqfetcher.DbSourceProxy;
import java.awt.BorderLayout;
import java.awt.Color;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
+import java.util.List;
import java.util.Vector;
import javax.swing.JButton;
AlignViewport viewport;
Vector alignPanels = new Vector();
-
+
/**
* Last format used to load or save alignments in this window
*/
*/
void init()
{
- if (viewport.conservation == null)
+ if (viewport.getAlignmentConservationAnnotation() == null)
{
BLOSUM62Colour.setEnabled(false);
conservationMenuItem.setEnabled(false);
{
this.setDropTarget(new java.awt.dnd.DropTarget(this, this));
addServiceListeners();
- setGUINucleotide(viewport.alignment.isNucleotide());
+ setGUINucleotide(viewport.getAlignment().isNucleotide());
}
setMenusFromViewport(viewport);
|| evt.isShiftDown() || evt.isAltDown());
}
break;
-
- //case KeyEvent.VK_A:
- // if (viewport.cursorMode)
- // {
- // alignPanel.seqPanel.insertNucAtCursor(false,"A");
- // //System.out.println("A");
- // }
- // break;
- /*
- case KeyEvent.VK_CLOSE_BRACKET:
- if (viewport.cursorMode)
- {
- System.out.println("closing bracket");
- }
- break;
+
+ // case KeyEvent.VK_A:
+ // if (viewport.cursorMode)
+ // {
+ // alignPanel.seqPanel.insertNucAtCursor(false,"A");
+ // //System.out.println("A");
+ // }
+ // break;
+ /*
+ * case KeyEvent.VK_CLOSE_BRACKET: if (viewport.cursorMode) {
+ * System.out.println("closing bracket"); } break;
*/
case KeyEvent.VK_DELETE:
case KeyEvent.VK_BACK_SPACE:
if (newPanel)
{
- if (ap.av.padGaps)
+ if (ap.av.isPadGaps())
{
- ap.av.alignment.padGaps();
+ ap.av.getAlignment().padGaps();
}
ap.av.updateConservation(ap);
ap.av.updateConsensus(ap);
conservationMenuItem.setEnabled(!nucleotide);
modifyConservation.setEnabled(!nucleotide);
showGroupConservation.setEnabled(!nucleotide);
+ rnahelicesColour.setEnabled(nucleotide);
+ purinePyrimidineColour.setEnabled(nucleotide);
// Remember AlignFrame always starts as protein
- if (!nucleotide)
- {
- calculateMenu.remove(calculateMenu.getItemCount() - 2);
- }
+ // if (!nucleotide)
+ // {
+ // showTr
+ // calculateMenu.remove(calculateMenu.getItemCount() - 2);
+ // }
}
/**
*/
void setMenusFromViewport(AlignViewport av)
{
- padGapsMenuitem.setSelected(av.padGaps);
+ padGapsMenuitem.setSelected(av.isPadGaps());
colourTextMenuItem.setSelected(av.showColourText);
abovePIDThreshold.setSelected(av.getAbovePIDThreshold());
conservationMenuItem.setSelected(av.getConservationSelected());
annotationPanelMenuItem.setState(av.showAnnotation);
viewBoxesMenuItem.setSelected(av.showBoxes);
viewTextMenuItem.setSelected(av.showText);
- showNonconservedMenuItem.setSelected(av.showUnconserved);
- showGroupConsensus.setSelected(av.showGroupConsensus);
- showGroupConservation.setSelected(av.showGroupConservation);
- showConsensusHistogram.setSelected(av.showConsensusHistogram);
- showSequenceLogo.setSelected(av.showSequenceLogo);
+ showNonconservedMenuItem.setSelected(av.getShowUnconserved());
+ showGroupConsensus.setSelected(av.isShowGroupConsensus());
+ showGroupConservation.setSelected(av.isShowGroupConservation());
+ showConsensusHistogram.setSelected(av.isShowConsensusHistogram());
+ showSequenceLogo.setSelected(av.isShowSequenceLogo());
+ normaliseSequenceLogo.setSelected(av.isNormaliseSequenceLogo());
+
setColourSelected(ColourSchemeProperty.getColourName(av
.getGlobalColourScheme()));
autoCalculate.setSelected(av.autoCalculateConsensus);
sortByTree.setSelected(av.sortByTree);
listenToViewSelections.setSelected(av.followSelection);
-
+ rnahelicesColour.setEnabled(av.getAlignment().hasRNAStructure());
+ rnahelicesColour
+ .setSelected(av.getGlobalColourScheme() instanceof jalview.schemes.RNAHelicesColour);
setShowProductsEnabled();
updateEditMenuBar();
{
if (fileName != null)
{
+ // TODO: JAL-1108 - ensure all associated frames are closed regardless of originating file's format
// TODO: work out how to recover feature settings for correct view(s) when
// file is reloaded.
if (currentFileFormat.equals("Jalview"))
String[] omitHidden = null;
- if (viewport.hasHiddenColumns)
+ if (viewport.hasHiddenColumns())
{
int reply = JOptionPane
.showInternalConfirmDialog(
}
}
FormatAdapter f = new FormatAdapter();
- String output = f.formatSequences(format,
- (Alignment) viewport.alignment, // class cast exceptions will
+ String output = f.formatSequences(
+ format,
+ (Alignment) viewport.getAlignment(), // class cast exceptions will
// occur in the distant future
- omitHidden, f.getCacheSuffixDefault(format), viewport.colSel);
+ omitHidden, f.getCacheSuffixDefault(format),
+ viewport.getColumnSelection());
if (output == null)
{
{
String[] omitHidden = null;
- if (viewport.hasHiddenColumns)
+ if (viewport.hasHiddenColumns())
{
int reply = JOptionPane
.showInternalConfirmDialog(
try
{
cap.setText(new FormatAdapter().formatSequences(e.getActionCommand(),
- viewport.alignment, omitHidden, viewport.colSel));
+ viewport.getAlignment(), omitHidden,
+ viewport.getColumnSelection()));
Desktop.addInternalFrame(cap,
"Alignment output - " + e.getActionCommand(), 600, 500);
} catch (OutOfMemoryError oom)
public void exportAnnotations_actionPerformed(ActionEvent e)
{
- new AnnotationExporter().exportAnnotations(
- alignPanel,
- viewport.showAnnotation ? viewport.alignment
- .getAlignmentAnnotation() : null, viewport.alignment
- .getGroups(),
- ((Alignment) viewport.alignment).alignmentProperties);
+ new AnnotationExporter().exportAnnotations(alignPanel,
+ viewport.showAnnotation ? viewport.getAlignment()
+ .getAlignmentAnnotation() : null, viewport
+ .getAlignment().getGroups(), ((Alignment) viewport
+ .getAlignment()).alignmentProperties);
}
public void associatedData_actionPerformed(ActionEvent e)
viewport.historyList.push(command);
viewport.redoList.clear();
updateEditMenuBar();
- viewport.hasHiddenColumns = (viewport.colSel != null
- && viewport.colSel.getHiddenColumns() != null && viewport.colSel
- .getHiddenColumns().size() > 0);
+ viewport.updateHiddenColumns();
+ // viewport.hasHiddenColumns = (viewport.getColumnSelection() != null
+ // && viewport.getColumnSelection().getHiddenColumns() != null &&
+ // viewport.getColumnSelection()
+ // .getHiddenColumns().size() > 0);
}
}
if (viewport != null)
{
return new AlignmentI[]
- { viewport.alignment };
+ { viewport.getAlignment() };
}
return null;
}
if (originalSource != null)
{
- originalSource.hasHiddenColumns = (viewport.colSel != null
- && viewport.colSel.getHiddenColumns() != null && viewport.colSel
- .getHiddenColumns().size() > 0);
- originalSource.firePropertyChange("alignment", null,
- originalSource.alignment.getSequences());
+ if (originalSource != viewport)
+ {
+ Cache.log
+ .warn("Implementation worry: mismatch of viewport origin for undo");
+ }
+ originalSource.updateHiddenColumns();
+ // originalSource.hasHiddenColumns = (viewport.getColumnSelection() !=
+ // null
+ // && viewport.getColumnSelection().getHiddenColumns() != null &&
+ // viewport.getColumnSelection()
+ // .getHiddenColumns().size() > 0);
+ originalSource.firePropertyChange("alignment", null, originalSource
+ .getAlignment().getSequences());
}
}
if (originalSource != null)
{
- originalSource.hasHiddenColumns = (viewport.colSel != null
- && viewport.colSel.getHiddenColumns() != null && viewport.colSel
- .getHiddenColumns().size() > 0);
- originalSource.firePropertyChange("alignment", null,
- originalSource.alignment.getSequences());
+
+ if (originalSource != viewport)
+ {
+ Cache.log
+ .warn("Implementation worry: mismatch of viewport origin for redo");
+ }
+ originalSource.updateHiddenColumns();
+ // originalSource.hasHiddenColumns = (viewport.getColumnSelection() !=
+ // null
+ // && viewport.getColumnSelection().getHiddenColumns() != null &&
+ // viewport.getColumnSelection()
+ // .getHiddenColumns().size() > 0);
+ originalSource.firePropertyChange("alignment", null, originalSource
+ .getAlignment().getSequences());
}
}
{
if (comps.elementAt(i) instanceof AlignmentPanel)
{
- if (al == ((AlignmentPanel) comps.elementAt(i)).av.alignment)
+ if (al == ((AlignmentPanel) comps.elementAt(i)).av.getAlignment())
{
originalSource = ((AlignmentPanel) comps.elementAt(i)).av;
break;
// the current view against the closed view first
if (al != null)
{
- PaintRefresher.validateSequences(al, viewport.alignment);
+ PaintRefresher.validateSequences(al, viewport.getAlignment());
}
originalSource = viewport;
if (up)
{
- for (int i = 1; i < viewport.alignment.getHeight(); i++)
+ for (int i = 1; i < viewport.getAlignment().getHeight(); i++)
{
- SequenceI seq = viewport.alignment.getSequenceAt(i);
+ SequenceI seq = viewport.getAlignment().getSequenceAt(i);
if (!sg.getSequences(null).contains(seq))
{
continue;
}
- SequenceI temp = viewport.alignment.getSequenceAt(i - 1);
+ SequenceI temp = viewport.getAlignment().getSequenceAt(i - 1);
if (sg.getSequences(null).contains(temp))
{
continue;
}
- viewport.alignment.getSequences().setElementAt(temp, i);
- viewport.alignment.getSequences().setElementAt(seq, i - 1);
+ viewport.getAlignment().getSequences().setElementAt(temp, i);
+ viewport.getAlignment().getSequences().setElementAt(seq, i - 1);
}
}
else
{
- for (int i = viewport.alignment.getHeight() - 2; i > -1; i--)
+ for (int i = viewport.getAlignment().getHeight() - 2; i > -1; i--)
{
- SequenceI seq = viewport.alignment.getSequenceAt(i);
+ SequenceI seq = viewport.getAlignment().getSequenceAt(i);
if (!sg.getSequences(null).contains(seq))
{
continue;
}
- SequenceI temp = viewport.alignment.getSequenceAt(i + 1);
+ SequenceI temp = viewport.getAlignment().getSequenceAt(i + 1);
if (sg.getSequences(null).contains(temp))
{
continue;
}
- viewport.alignment.getSequences().setElementAt(temp, i);
- viewport.alignment.getSequences().setElementAt(seq, i + 1);
+ viewport.getAlignment().getSequences().setElementAt(temp, i);
+ viewport.getAlignment().getSequences().setElementAt(seq, i + 1);
}
}
Vector sg = new Vector();
if (viewport.cursorMode)
{
- sg.addElement(viewport.alignment
- .getSequenceAt(alignPanel.seqPanel.seqCanvas.cursorY));
+ sg.addElement(viewport.getAlignment().getSequenceAt(
+ alignPanel.seqPanel.seqCanvas.cursorY));
}
else if (viewport.getSelectionGroup() != null
- && viewport.getSelectionGroup().getSize() != viewport.alignment
- .getHeight())
+ && viewport.getSelectionGroup().getSize() != viewport
+ .getAlignment().getHeight())
{
sg = viewport.getSelectionGroup().getSequences(
- viewport.hiddenRepSequences);
+ viewport.getHiddenRepSequences());
}
if (sg.size() < 1)
Vector invertGroup = new Vector();
- for (int i = 0; i < viewport.alignment.getHeight(); i++)
+ for (int i = 0; i < viewport.getAlignment().getHeight(); i++)
{
- if (!sg.contains(viewport.alignment.getSequenceAt(i)))
- invertGroup.add(viewport.alignment.getSequenceAt(i));
+ if (!sg.contains(viewport.getAlignment().getSequenceAt(i)))
+ invertGroup.add(viewport.getAlignment().getSequenceAt(i));
}
SequenceI[] seqs1 = new SequenceI[sg.size()];
SequenceI[] seqs = viewport.getSelectionAsNewSequence();
String[] omitHidden = null;
- if (viewport.hasHiddenColumns)
+ if (viewport.hasHiddenColumns())
{
omitHidden = viewport.getViewAsString(true);
}
}
Vector hiddenColumns = null;
- if (viewport.hasHiddenColumns)
+ if (viewport.hasHiddenColumns())
{
hiddenColumns = new Vector();
int hiddenOffset = viewport.getSelectionGroup().getStartRes(), hiddenCutoff = viewport
}
Desktop.jalviewClipboard = new Object[]
- { seqs, viewport.alignment.getDataset(), hiddenColumns };
+ { seqs, viewport.getAlignment().getDataset(), hiddenColumns };
statusBar.setText("Copied " + seqs.length + " sequences to clipboard.");
}
}
// If the cut affects all sequences, remove highlighted columns
- if (sg.getSize() == viewport.alignment.getHeight())
+ if (sg.getSize() == viewport.getAlignment().getHeight())
{
viewport.getColumnSelection().removeElements(sg.getStartRes(),
sg.getEndRes() + 1);
*/
addHistoryItem(new EditCommand("Cut Sequences", EditCommand.CUT, cut,
sg.getStartRes(), sg.getEndRes() - sg.getStartRes() + 1,
- viewport.alignment));
+ viewport.getAlignment()));
viewport.setSelectionGroup(null);
viewport.sendSelection();
- viewport.alignment.deleteGroup(sg);
+ viewport.getAlignment().deleteGroup(sg);
viewport.firePropertyChange("alignment", null, viewport.getAlignment()
.getSequences());
*/
protected void deleteGroups_actionPerformed(ActionEvent e)
{
- viewport.alignment.deleteAllGroups();
+ viewport.getAlignment().deleteAllGroups();
viewport.sequenceColours = null;
viewport.setSelectionGroup(null);
PaintRefresher.Refresh(this, viewport.getSequenceSetId());
sg.addSequence(viewport.getAlignment().getSequenceAt(i), false);
}
- sg.setEndRes(viewport.alignment.getWidth() - 1);
+ sg.setEndRes(viewport.getAlignment().getWidth() - 1);
viewport.setSelectionGroup(sg);
viewport.sendSelection();
alignPanel.paintAlignment(true);
if (viewport.getSelectionGroup() != null)
{
seqs = viewport.getSelectionGroup().getSequencesAsArray(
- viewport.hiddenRepSequences);
+ viewport.getHiddenRepSequences());
}
else
{
- seqs = viewport.alignment.getSequencesArray();
+ seqs = viewport.getAlignment().getSequencesArray();
}
TrimRegionCommand trimRegion;
{
trimRegion = new TrimRegionCommand("Remove Left",
TrimRegionCommand.TRIM_LEFT, seqs, column,
- viewport.alignment, viewport.colSel,
- viewport.selectionGroup);
+ viewport.getAlignment(), viewport.getColumnSelection(),
+ viewport.getSelectionGroup());
viewport.setStartRes(0);
}
else
{
trimRegion = new TrimRegionCommand("Remove Right",
TrimRegionCommand.TRIM_RIGHT, seqs, column,
- viewport.alignment, viewport.colSel,
- viewport.selectionGroup);
+ viewport.getAlignment(), viewport.getColumnSelection(),
+ viewport.getSelectionGroup());
}
statusBar.setText("Removed " + trimRegion.getSize() + " columns.");
addHistoryItem(trimRegion);
- Vector groups = viewport.alignment.getGroups();
+ Vector groups = viewport.getAlignment().getGroups();
for (int i = 0; i < groups.size(); i++)
{
if ((trimLeft && !sg.adjustForRemoveLeft(column))
|| (!trimLeft && !sg.adjustForRemoveRight(column)))
{
- viewport.alignment.deleteGroup(sg);
+ viewport.getAlignment().deleteGroup(sg);
}
}
*/
public void removeGappedColumnMenuItem_actionPerformed(ActionEvent e)
{
- int start = 0, end = viewport.alignment.getWidth() - 1;
+ int start = 0, end = viewport.getAlignment().getWidth() - 1;
SequenceI[] seqs;
if (viewport.getSelectionGroup() != null)
{
seqs = viewport.getSelectionGroup().getSequencesAsArray(
- viewport.hiddenRepSequences);
+ viewport.getHiddenRepSequences());
start = viewport.getSelectionGroup().getStartRes();
end = viewport.getSelectionGroup().getEndRes();
}
else
{
- seqs = viewport.alignment.getSequencesArray();
+ seqs = viewport.getAlignment().getSequencesArray();
}
RemoveGapColCommand removeGapCols = new RemoveGapColCommand(
- "Remove Gapped Columns", seqs, start, end, viewport.alignment);
+ "Remove Gapped Columns", seqs, start, end,
+ viewport.getAlignment());
addHistoryItem(removeGapCols);
// This is to maintain viewport position on first residue
// of first sequence
- SequenceI seq = viewport.alignment.getSequenceAt(0);
+ SequenceI seq = viewport.getAlignment().getSequenceAt(0);
int startRes = seq.findPosition(viewport.startRes);
// ShiftList shifts;
// viewport.getAlignment().removeGaps(shifts=new ShiftList());
*/
public void removeAllGapsMenuItem_actionPerformed(ActionEvent e)
{
- int start = 0, end = viewport.alignment.getWidth() - 1;
+ int start = 0, end = viewport.getAlignment().getWidth() - 1;
SequenceI[] seqs;
if (viewport.getSelectionGroup() != null)
{
seqs = viewport.getSelectionGroup().getSequencesAsArray(
- viewport.hiddenRepSequences);
+ viewport.getHiddenRepSequences());
start = viewport.getSelectionGroup().getStartRes();
end = viewport.getSelectionGroup().getEndRes();
}
else
{
- seqs = viewport.alignment.getSequencesArray();
+ seqs = viewport.getAlignment().getSequencesArray();
}
// This is to maintain viewport position on first residue
// of first sequence
- SequenceI seq = viewport.alignment.getSequenceAt(0);
+ SequenceI seq = viewport.getAlignment().getSequenceAt(0);
int startRes = seq.findPosition(viewport.startRes);
addHistoryItem(new RemoveGapsCommand("Remove Gaps", seqs, start, end,
- viewport.alignment));
+ viewport.getAlignment()));
viewport.setStartRes(seq.findIndex(startRes) - 1);
*/
public void padGapsMenuitem_actionPerformed(ActionEvent e)
{
- viewport.padGaps = padGapsMenuitem.isSelected();
+ viewport.setPadGaps(padGapsMenuitem.isSelected());
viewport.firePropertyChange("alignment", null, viewport.getAlignment()
.getSequences());
}
if (!copyAnnotation)
{
// just remove all the current annotation except for the automatic stuff
- newap.av.alignment.deleteAllGroups();
- for (AlignmentAnnotation alan : newap.av.alignment
+ newap.av.getAlignment().deleteAllGroups();
+ for (AlignmentAnnotation alan : newap.av.getAlignment()
.getAlignmentAnnotation())
{
if (!alan.autoCalculated)
{
- newap.av.alignment.deleteAnnotation(alan);
+ newap.av.getAlignment().deleteAnnotation(alan);
}
;
}
// Hide everything by the current selection - this is a hack - we do the
// invert and then hide
// first check that there will be visible columns after the invert.
- if ((viewport.colSel != null && viewport.colSel.getSelected() != null && viewport.colSel
- .getSelected().size() > 0)
+ if ((viewport.getColumnSelection() != null
+ && viewport.getColumnSelection().getSelected() != null && viewport
+ .getColumnSelection().getSelected().size() > 0)
|| (sg != null && sg.getSize() > 0 && sg.getStartRes() <= sg
.getEndRes()))
{
if (toggleSeqs)
{
- if (sg != null && sg.getSize() != viewport.alignment.getHeight())
+ if (sg != null && sg.getSize() != viewport.getAlignment().getHeight())
{
hideSelSequences_actionPerformed(null);
hide = true;
}
- else if (!(toggleCols && viewport.colSel.getSelected().size() > 0))
+ else if (!(toggleCols && viewport.getColumnSelection().getSelected()
+ .size() > 0))
{
showAllSeqs_actionPerformed(null);
}
if (toggleCols)
{
- if (viewport.colSel.getSelected().size() > 0)
+ if (viewport.getColumnSelection().getSelected().size() > 0)
{
hideSelColumns_actionPerformed(null);
if (!toggleSeqs)
{
- viewport.selectionGroup = sg;
+ viewport.setSelectionGroup(sg);
}
}
else if (!hide)
{
JEditorPane editPane = new JEditorPane("text/html", "");
editPane.setEditable(false);
- StringBuffer contents = new AlignmentProperties(viewport.alignment)
+ StringBuffer contents = new AlignmentProperties(viewport.getAlignment())
.formatAsHtml();
editPane.setText("<html>" + contents.toString() + "</html>");
JInternalFrame frame = new JInternalFrame();
*/
public void clustalColour_actionPerformed(ActionEvent e)
{
- changeColour(new ClustalxColourScheme(
- viewport.alignment.getSequences(),
- viewport.alignment.getWidth()));
+ changeColour(new ClustalxColourScheme(viewport.getAlignment()
+ .getSequences(), viewport.getAlignment().getWidth()));
}
/**
{
changeColour(new PurinePyrimidineColourScheme());
}
+
/*
- public void covariationColour_actionPerformed(ActionEvent e)
- {
- changeColour(new CovariationColourScheme(viewport.alignment.getAlignmentAnnotation()[0]));
- }
- */
+ * public void covariationColour_actionPerformed(ActionEvent e) {
+ * changeColour(new
+ * CovariationColourScheme(viewport.getAlignment().getAlignmentAnnotation
+ * ()[0])); }
+ */
public void annotationColour_actionPerformed(ActionEvent e)
{
new AnnotationColourChooser(viewport, alignPanel);
}
-
+
public void rnahelicesColour_actionPerformed(ActionEvent e)
{
new RNAHelicesColourChooser(viewport, alignPanel);
*/
public void changeColour(ColourSchemeI cs)
{
+ // TODO: compare with applet and pull up to model method
int threshold = 0;
if (cs != null)
if (viewport.getConservationSelected())
{
- Alignment al = (Alignment) viewport.alignment;
+ Alignment al = (Alignment) viewport.getAlignment();
Conservation c = new Conservation("All",
ResidueProperties.propHash, 3, al.getSequences(), 0,
al.getWidth() - 1);
c.calculate();
- c.verdict(false, viewport.ConsPercGaps);
+ c.verdict(false, viewport.getConsPercGaps());
cs.setConservation(c);
cs.setConservation(null);
}
- cs.setConsensus(viewport.hconsensus);
+ cs.setConsensus(viewport.getSequenceConsensusHash());
}
viewport.setGlobalColourScheme(cs);
if (viewport.getColourAppliesToAllGroups())
{
- Vector groups = viewport.alignment.getGroups();
+ Vector groups = viewport.getAlignment().getGroups();
for (int i = 0; i < groups.size(); i++)
{
if (cs instanceof ClustalxColourScheme)
{
- sg.cs = new ClustalxColourScheme(
- sg.getSequences(viewport.hiddenRepSequences),
- sg.getWidth());
+ sg.cs = new ClustalxColourScheme(sg.getSequences(viewport
+ .getHiddenRepSequences()), sg.getWidth());
}
else if (cs instanceof UserColourScheme)
{
{
try
{
- sg.cs = (ColourSchemeI) cs.getClass().newInstance();
+ sg.cs = cs.getClass().newInstance();
} catch (Exception ex)
{
}
sg.cs.setThreshold(threshold, viewport.getIgnoreGapsConsensus());
sg.cs.setConsensus(AAFrequency.calculate(
- sg.getSequences(viewport.hiddenRepSequences),
+ sg.getSequences(viewport.getHiddenRepSequences()),
sg.getStartRes(), sg.getEndRes() + 1));
}
else
if (viewport.getConservationSelected())
{
Conservation c = new Conservation("Group",
- ResidueProperties.propHash, 3,
- sg.getSequences(viewport.hiddenRepSequences),
- sg.getStartRes(), sg.getEndRes() + 1);
+ ResidueProperties.propHash, 3, sg.getSequences(viewport
+ .getHiddenRepSequences()), sg.getStartRes(),
+ sg.getEndRes() + 1);
c.calculate();
- c.verdict(false, viewport.ConsPercGaps);
+ c.verdict(false, viewport.getConsPercGaps());
sg.cs.setConservation(c);
}
else
protected void modifyPID_actionPerformed(ActionEvent e)
{
if (viewport.getAbovePIDThreshold()
- && viewport.globalColourScheme != null)
+ && viewport.getGlobalColourScheme() != null)
{
SliderPanel.setPIDSliderSource(alignPanel,
viewport.getGlobalColourScheme(), "Background");
protected void modifyConservation_actionPerformed(ActionEvent e)
{
if (viewport.getConservationSelected()
- && viewport.globalColourScheme != null)
+ && viewport.getGlobalColourScheme() != null)
{
SliderPanel.setConservationSlider(alignPanel,
- viewport.globalColourScheme, "Background");
+ viewport.getGlobalColourScheme(), "Background");
SliderPanel.showConservationSlider();
}
}
AlignmentSorter.sortByPID(viewport.getAlignment(), viewport
.getAlignment().getSequenceAt(0), null);
addHistoryItem(new OrderCommand("Pairwise Sort", oldOrder,
- viewport.alignment));
+ viewport.getAlignment()));
alignPanel.paintAlignment(true);
}
{
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
AlignmentSorter.sortByID(viewport.getAlignment());
- addHistoryItem(new OrderCommand("ID Sort", oldOrder, viewport.alignment));
+ addHistoryItem(new OrderCommand("ID Sort", oldOrder,
+ viewport.getAlignment()));
alignPanel.paintAlignment(true);
}
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
AlignmentSorter.sortByLength(viewport.getAlignment());
addHistoryItem(new OrderCommand("Length Sort", oldOrder,
- viewport.alignment));
+ viewport.getAlignment()));
alignPanel.paintAlignment(true);
}
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
AlignmentSorter.sortByGroup(viewport.getAlignment());
addHistoryItem(new OrderCommand("Group Sort", oldOrder,
- viewport.alignment));
+ viewport.getAlignment()));
alignPanel.paintAlignment(true);
}
.getAlignment().getSequences());
}
}
+
public void sortByTreeOption_actionPerformed(ActionEvent e)
{
viewport.sortByTree = sortByTree.isSelected();
{
viewport.followSelection = listenToViewSelections.isSelected();
}
+
/**
* DOCUMENT ME!
*
else
{
// are the visible sequences aligned?
- if (!viewport.alignment.isAligned(false))
+ if (!viewport.getAlignment().isAligned(false))
{
JOptionPane
.showMessageDialog(
return;
}
- if (viewport.alignment.getHeight() < 2)
+ if (viewport.getAlignment().getHeight() < 2)
{
return;
}
// pointers
AlignmentSorter.sortBy(viewport.getAlignment(), order);
- addHistoryItem(new OrderCommand(order.getName(), oldOrder,
- viewport.alignment));
+ addHistoryItem(new OrderCommand(order.getName(), oldOrder, viewport
+ .getAlignment()));
alignPanel.paintAlignment(true);
}
AlignmentSorter.sortByAnnotationScore(scoreLabel,
viewport.getAlignment());// ,viewport.getSelectionGroup());
addHistoryItem(new OrderCommand("Sort by " + scoreLabel, oldOrder,
- viewport.alignment));
+ viewport.getAlignment()));
alignPanel.paintAlignment(true);
}
});
*/
public void buildSortByAnnotationScoresMenu()
{
- if (viewport.alignment.getAlignmentAnnotation() == null)
+ if (viewport.getAlignment().getAlignmentAnnotation() == null)
{
return;
}
- if (viewport.alignment.getAlignmentAnnotation().hashCode() != _annotationScoreVectorHash)
+ if (viewport.getAlignment().getAlignmentAnnotation().hashCode() != _annotationScoreVectorHash)
{
sortByAnnotScore.removeAll();
// almost certainly a quicker way to do this - but we keep it simple
Hashtable scoreSorts = new Hashtable();
AlignmentAnnotation aann[];
- Enumeration sq = viewport.alignment.getSequences().elements();
+ Enumeration sq = viewport.getAlignment().getSequences().elements();
while (sq.hasMoreElements())
{
aann = ((SequenceI) sq.nextElement()).getAnnotation();
sortByAnnotScore.setVisible(scoreSorts.size() > 0);
scoreSorts.clear();
- _annotationScoreVectorHash = viewport.alignment
+ _annotationScoreVectorHash = viewport.getAlignment()
.getAlignmentAnnotation().hashCode();
}
}
{
tp.sortByTree_actionPerformed(null);
addHistoryItem(tp.sortAlignmentIn(alignPanel));
-
+
}
});
if (undoname != null)
{
addHistoryItem(new OrderCommand(undoname, oldOrder,
- viewport.alignment));
+ viewport.getAlignment()));
}
alignPanel.paintAlignment(true);
return true;
}
// limit sequences - JBPNote in future - could spawn multiple prediction
// jobs
- // TODO: viewport.alignment.isAligned is a global state - the local
+ // TODO: viewport.getAlignment().isAligned is a global state - the local
// selection may well be aligned - we preserve 2.0.8 behaviour for moment.
- if (!viewport.alignment.isAligned(false))
+ if (!viewport.getAlignment().isAligned(false))
{
seqs.setSequences(new SeqCigar[]
{ seqs.getSequences()[0] });
}
}
+ @Override
+ protected void tcoffeeColorScheme_actionPerformed(ActionEvent e)
+ {
+ changeColour(new TCoffeeColourScheme(alignPanel.getAlignment()));
+ }
+
public TreePanel ShowNewickTree(NewickFile nf, String title)
{
return ShowNewickTree(nf, title, 600, 500, 4, 5);
// TODO: group services by location as well as function and/or
// introduce
// object broker mechanism.
- final Vector wsmenu = new Vector();
+ final Vector<JMenu> wsmenu = new Vector<JMenu>();
final IProgressIndicator af = me;
final JMenu msawsmenu = new JMenu("Alignment");
final JMenu secstrmenu = new JMenu(
"Secondary Structure Prediction");
- final JMenu seqsrchmenu = new JMenu(
- "Sequence Database Search");
- final JMenu analymenu = new JMenu(
- "Analysis");
- // JAL-940 - only show secondary structure prediction services from the legacy server
+ final JMenu seqsrchmenu = new JMenu("Sequence Database Search");
+ final JMenu analymenu = new JMenu("Analysis");
+ final JMenu dismenu = new JMenu("Disorder");
+ // JAL-940 - only show secondary structure prediction services from
+ // the legacy server
if (// Cache.getDefault("SHOW_JWS1_SERVICES", true)
- // &&
- Discoverer.services != null
- && (Discoverer.services.size() > 0))
+ // &&
+ Discoverer.services != null && (Discoverer.services.size() > 0))
{
// TODO: refactor to allow list of AbstractName/Handler bindings to
// be
Vector msaws = null; // (Vector) Discoverer.services.get("MsaWS");
Vector secstrpr = (Vector) Discoverer.services
.get("SecStrPred");
- Vector seqsrch = null; // (Vector) Discoverer.services.get("SeqSearch");
+ Vector seqsrch = null; // (Vector)
+ // Discoverer.services.get("SeqSearch");
// TODO: move GUI generation code onto service implementation - so a
// client instance attaches itself to the GUI with method call like
// jalview.ws.MsaWSClient.bind(servicehandle, Desktop.instance,
}
}
- // TODO: move into separate menu builder class.
- if (Cache.getDefault("SHOW_JWS2_SERVICES", true))
- {
- Jws2Discoverer jws2servs = Jws2Discoverer.getDiscoverer();
- if (jws2servs != null)
- {
- if (jws2servs.hasServices())
- {
- jws2servs.attachWSMenuEntry(msawsmenu, me);
- }
- }
- }
- // Add all submenus in the order they should appear on the web services menu
+ // Add all submenus in the order they should appear on the web
+ // services menu
wsmenu.add(msawsmenu);
wsmenu.add(secstrmenu);
+ wsmenu.add(dismenu);
wsmenu.add(analymenu);
+ // final ArrayList<JMenu> submens=new ArrayList<JMenu>();
+ // submens.add(msawsmenu);
+ // submens.add(secstrmenu);
+ // submens.add(dismenu);
+ // submens.add(analymenu);
+
// No search services yet
// wsmenu.add(seqsrchmenu);
{
webService.add(me.webServiceNoServices);
}
+ // TODO: move into separate menu builder class.
+ if (Cache.getDefault("SHOW_JWS2_SERVICES", true))
+ {
+ Jws2Discoverer jws2servs = Jws2Discoverer.getDiscoverer();
+ if (jws2servs != null)
+ {
+ if (jws2servs.hasServices())
+ {
+ jws2servs.attachWSMenuEntry(webService, me);
+ }
+ if (jws2servs.isRunning())
+ {
+ JMenuItem tm = new JMenuItem(
+ "Still discovering JABA Services");
+ tm.setEnabled(false);
+ webService.add(tm);
+ }
+ }
+ }
+
build_urlServiceMenu(me.webService);
build_fetchdbmenu(webService);
+ for (JMenu item : wsmenu)
+ {
+ if (item.getItemCount() == 0)
+ {
+ item.setEnabled(false);
+ }
+ else
+ {
+ item.setEnabled(true);
+ }
+ }
} catch (Exception e)
{
}
}
-
/**
* construct any groupURL type service menu entries.
*
* AlignFrame af = this; testAlView.addActionListener(new ActionListener() {
*
* @Override public void actionPerformed(ActionEvent e) {
- * jalview.datamodel.AlignmentView.testSelectionViews(af.viewport.alignment,
- * af.viewport.colSel, af.viewport.selectionGroup); }
+ * jalview.datamodel.AlignmentView
+ * .testSelectionViews(af.viewport.getAlignment(),
+ * af.viewport.getColumnSelection(), af.viewport.selectionGroup); }
*
* }); webService.add(testAlView);
*/
// rest-style services with other types of analysis/calculation service
// SHmmr test client - still being implemented.
// DEBUG - alignmentView
-
- for (jalview.ws.rest.RestClient client: jalview.ws.rest.RestClient.getRestClients()) {
- client.attachWSMenuEntry(JvSwingUtils.findOrCreateMenu(webService, client.getAction()), this);
+
+ for (jalview.ws.rest.RestClient client : jalview.ws.rest.RestClient
+ .getRestClients())
+ {
+ client.attachWSMenuEntry(
+ JvSwingUtils.findOrCreateMenu(webService, client.getAction()),
+ this);
}
if (Cache.getDefault("SHOW_ENFIN_SERVICES", true))
ths.setProgressBar("Searching for sequences from " + fsrc, sttime);
try
{
- Alignment ds = ths.getViewport().alignment.getDataset(); // update
+ Alignment ds = ths.getViewport().getAlignment().getDataset(); // update
// our local
// dataset
// reference
{
al = jalview.analysis.Dna.CdnaTranslate(selection, seqstring,
viewport.getViewAsVisibleContigs(true), viewport
- .getGapCharacter(), viewport.alignment
- .getAlignmentAnnotation(), viewport.alignment
+ .getGapCharacter(), viewport.getAlignment()
+ .getAlignmentAnnotation(), viewport.getAlignment()
.getWidth(), viewport.getAlignment().getDataset());
} catch (Exception ex)
{
boolean featuresFile = false;
try
{
- featuresFile = new FeaturesFile(file, type)
- .parse(viewport.alignment.getDataset(),
- alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featureColours,
- false, jalview.bin.Cache.getDefault(
- "RELAXEDSEQIDMATCHING", false));
+ featuresFile = new FeaturesFile(file, type).parse(viewport
+ .getAlignment().getDataset(), alignPanel.seqPanel.seqCanvas
+ .getFeatureRenderer().featureColours, false,
+ jalview.bin.Cache.getDefault("RELAXEDSEQIDMATCHING", false));
} catch (Exception ex)
{
ex.printStackTrace();
int l = 0, c = pdbfn.indexOf(".");
while (mtch == null && c != -1)
{
- do
+ do
{
l = c;
} while ((c = pdbfn.indexOf(".", l)) > l);
// try and associate
// TODO: may want to set a standard ID naming formalism for
// associating PDB files which have no IDs.
- for (SequenceI toassoc: (SequenceI[])fm[2]) {
- PDBEntry pe = new AssociatePdbFileWithSeq()
- .associatePdbWithSeq((String) fm[0], (String) fm[1],
- toassoc, false);
- if (pe != null)
+ for (SequenceI toassoc : (SequenceI[]) fm[2])
{
- System.err
- .println("Associated file : " + ((String) fm[0])
- + " with "
- + toassoc.getDisplayId(true));
- assocfiles++;
- }
+ PDBEntry pe = new AssociatePdbFileWithSeq()
+ .associatePdbWithSeq((String) fm[0],
+ (String) fm[1], toassoc, false);
+ if (pe != null)
+ {
+ System.err.println("Associated file : "
+ + ((String) fm[0]) + " with "
+ + toassoc.getDisplayId(true));
+ assocfiles++;
+ }
}
alignPanel.paintAlignment(true);
}
// try to parse as annotation.
boolean isAnnotation = (format == null || format
.equalsIgnoreCase("PFAM")) ? new AnnotationFile()
- .readAnnotationFile(viewport.alignment, file, protocol)
+ .readAnnotationFile(viewport.getAlignment(), file, protocol)
: false;
if (!isAnnotation)
{
- // try to see if its a JNet 'concise' style annotation file *before* we
- // try to parse it as a features file
- if (format == null)
+ // first see if its a T-COFFEE score file
+ TCoffeeScoreFile tcf = null;
+ try
{
- format = new IdentifyFile().Identify(file, protocol);
- }
- if (format.equalsIgnoreCase("JnetFile"))
+ tcf = new TCoffeeScoreFile(file, protocol);
+ if (tcf.isValid())
+ {
+ if (tcf.annotateAlignment(viewport.getAlignment(), true))
+ {
+ tcoffeeColour.setEnabled(true);
+ tcoffeeColour.setSelected(true);
+ changeColour(new TCoffeeColourScheme(viewport.getAlignment()));
+ isAnnotation = true;
+ statusBar
+ .setText("Successfully pasted T-Coffee scores to alignment.");
+ }
+ else
+ {
+ // some problem - if no warning its probable that the ID matching process didn't work
+ JOptionPane.showMessageDialog(Desktop.desktop,
+ tcf.getWarningMessage()==null ? "Check that the file matches sequence IDs in the alignment." : tcf.getWarningMessage(),
+ "Problem reading T-COFFEE score file",
+ JOptionPane.WARNING_MESSAGE);
+ }
+ }
+ else
+ {
+ tcf = null;
+ }
+ } catch (Exception x)
{
- jalview.io.JPredFile predictions = new jalview.io.JPredFile(file,
- protocol);
- new JnetAnnotationMaker().add_annotation(predictions,
- viewport.getAlignment(), 0, false);
- isAnnotation = true;
+ Cache.log.debug("Exception when processing data source as T-COFFEE score file",x);
+ tcf = null;
}
- else
+ if (tcf == null)
{
- /*
- * if (format.equalsIgnoreCase("PDB")) {
- *
- * String pdbfn = ""; // try to match up filename with sequence id try
- * { if (protocol == jalview.io.FormatAdapter.FILE) { File fl = new
- * File(file); pdbfn = fl.getName(); } else if (protocol ==
- * jalview.io.FormatAdapter.URL) { URL url = new URL(file); pdbfn =
- * url.getFile(); } } catch (Exception e) { } ; if (assocSeq == null)
- * { SequenceIdMatcher idm = new SequenceIdMatcher(viewport
- * .getAlignment().getSequencesArray()); if (pdbfn.length() > 0) { //
- * attempt to find a match in the alignment SequenceI mtch =
- * idm.findIdMatch(pdbfn); int l = 0, c = pdbfn.indexOf("."); while
- * (mtch == null && c != -1) { while ((c = pdbfn.indexOf(".", l)) > l)
- * { l = c; } if (l > -1) { pdbfn = pdbfn.substring(0, l); } mtch =
- * idm.findIdMatch(pdbfn); } if (mtch != null) { // try and associate
- * // prompt ? PDBEntry pe = new AssociatePdbFileWithSeq()
- * .associatePdbWithSeq(file, protocol, mtch, true); if (pe != null) {
- * System.err.println("Associated file : " + file + " with " +
- * mtch.getDisplayId(true)); alignPanel.paintAlignment(true); } } //
- * TODO: maybe need to load as normal otherwise return; } }
- */
+ // try to see if its a JNet 'concise' style annotation file *before*
+ // we
// try to parse it as a features file
- boolean isGroupsFile = parseFeaturesFile(file, protocol);
- // if it wasn't a features file then we just treat it as a general
- // alignment file to load into the current view.
- if (!isGroupsFile)
+ if (format == null)
{
- new FileLoader().LoadFile(viewport, file, protocol, format);
+ format = new IdentifyFile().Identify(file, protocol);
+ }
+ if (format.equalsIgnoreCase("JnetFile"))
+ {
+ jalview.io.JPredFile predictions = new jalview.io.JPredFile(
+ file, protocol);
+ new JnetAnnotationMaker().add_annotation(predictions,
+ viewport.getAlignment(), 0, false);
+ isAnnotation = true;
}
else
{
- alignPanel.paintAlignment(true);
+ /*
+ * if (format.equalsIgnoreCase("PDB")) {
+ *
+ * String pdbfn = ""; // try to match up filename with sequence id
+ * try { if (protocol == jalview.io.FormatAdapter.FILE) { File fl =
+ * new File(file); pdbfn = fl.getName(); } else if (protocol ==
+ * jalview.io.FormatAdapter.URL) { URL url = new URL(file); pdbfn =
+ * url.getFile(); } } catch (Exception e) { } ; if (assocSeq ==
+ * null) { SequenceIdMatcher idm = new SequenceIdMatcher(viewport
+ * .getAlignment().getSequencesArray()); if (pdbfn.length() > 0) {
+ * // attempt to find a match in the alignment SequenceI mtch =
+ * idm.findIdMatch(pdbfn); int l = 0, c = pdbfn.indexOf("."); while
+ * (mtch == null && c != -1) { while ((c = pdbfn.indexOf(".", l)) >
+ * l) { l = c; } if (l > -1) { pdbfn = pdbfn.substring(0, l); } mtch
+ * = idm.findIdMatch(pdbfn); } if (mtch != null) { // try and
+ * associate // prompt ? PDBEntry pe = new AssociatePdbFileWithSeq()
+ * .associatePdbWithSeq(file, protocol, mtch, true); if (pe != null)
+ * { System.err.println("Associated file : " + file + " with " +
+ * mtch.getDisplayId(true)); alignPanel.paintAlignment(true); } } //
+ * TODO: maybe need to load as normal otherwise return; } }
+ */
+ // try to parse it as a features file
+ boolean isGroupsFile = parseFeaturesFile(file, protocol);
+ // if it wasn't a features file then we just treat it as a general
+ // alignment file to load into the current view.
+ if (!isGroupsFile)
+ {
+ new FileLoader().LoadFile(viewport, file, protocol, format);
+ }
+ else
+ {
+ alignPanel.paintAlignment(true);
+ }
}
}
}
protected void extractScores_actionPerformed(ActionEvent e)
{
ParseProperties pp = new jalview.analysis.ParseProperties(
- viewport.alignment);
+ viewport.getAlignment());
// TODO: verify regex and introduce GUI dialog for version 2.5
// if (pp.getScoresFromDescription("col", "score column ",
// "\\W*([-+]?\\d*\\.?\\d*e?-?\\d*)\\W+([-+]?\\d*\\.?\\d*e?-?\\d*)",
{
final jalview.ws.SequenceFetcher sf = SequenceFetcher
.getSequenceFetcherSingleton(me);
- final String[] otherdb = sf.getOrderedSupportedSources();
- // sf.getDbInstances(jalview.ws.dbsources.DasSequenceSource.class);
- // jalview.util.QuickSort.sort(otherdb, otherdb);
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
-
+ String[] dbclasses = sf.getOrderedSupportedSources();
+ // sf.getDbInstances(jalview.ws.dbsources.DasSequenceSource.class);
+ // jalview.util.QuickSort.sort(otherdb, otherdb);
+ List<DbSourceProxy> otherdb;
JMenu dfetch = new JMenu();
- JMenuItem fetchr;
- rfetch.add(dfetch);
- int comp = 0, mcomp = 15;
+ JMenu ifetch = new JMenu();
+ JMenuItem fetchr = null;
+ int comp = 0, icomp = 0, mcomp = 15;
String mname = null;
- if (otherdb != null && otherdb.length > 0)
+ int dbi = 0;
+ for (String dbclass : dbclasses)
{
- for (int i = 0; i < otherdb.length; i++)
+ otherdb = sf.getSourceProxy(dbclass);
+ // add a single entry for this class, or submenu allowing 'fetch
+ // all' or pick one
+ if (otherdb == null || otherdb.size() < 1)
{
- String dbname = sf.getSourceProxy(otherdb[i]).getDbName();
- if (mname == null)
- {
- mname = "from '" + dbname + "'";
- }
- fetchr = new JMenuItem(otherdb[i]);
- final String[] dassource = new String[]
- { otherdb[i] };
+ continue;
+ }
+ // List<DbSourceProxy> dbs=otherdb;
+ // otherdb=new ArrayList<DbSourceProxy>();
+ // for (DbSourceProxy db:dbs)
+ // {
+ // if (!db.isA(DBRefSource.ALIGNMENTDB)
+ // }
+ if (mname == null)
+ {
+ mname = "From " + dbclass;
+ }
+ if (otherdb.size() == 1)
+ {
+ final DbSourceProxy[] dassource = otherdb
+ .toArray(new DbSourceProxy[0]);
+ DbSourceProxy src = otherdb.get(0);
+ fetchr = new JMenuItem(src.getDbSource());
fetchr.addActionListener(new ActionListener()
{
}
});
- fetchr.setToolTipText("Retrieve from " + dbname);
+ fetchr.setToolTipText("<html>"
+ + JvSwingUtils.wrapTooltip("Retrieve from "
+ + src.getDbName()) + "<html>");
dfetch.add(fetchr);
- if (comp++ == mcomp || i == (otherdb.length - 1))
+ comp++;
+ }
+ else
+ {
+ final DbSourceProxy[] dassource = otherdb
+ .toArray(new DbSourceProxy[0]);
+ // fetch all entry
+ DbSourceProxy src = otherdb.get(0);
+ fetchr = new JMenuItem("Fetch All '" + src.getDbSource()
+ + "'");
+ fetchr.addActionListener(new ActionListener()
{
- dfetch.setText(mname + " to '" + dbname + "'");
- rfetch.add(dfetch);
- dfetch = new JMenu();
- mname = null;
- comp = 0;
+ public void actionPerformed(ActionEvent e)
+ {
+ new Thread(new Runnable()
+ {
+
+ public void run()
+ {
+ new jalview.ws.DBRefFetcher(alignPanel.av
+ .getSequenceSelection(),
+ alignPanel.alignFrame, dassource)
+ .fetchDBRefs(false);
+ }
+ }).start();
+ }
+ });
+
+ fetchr.setToolTipText("<html>"
+ + JvSwingUtils.wrapTooltip("Retrieve from all "
+ + otherdb.size() + " sources in "
+ + src.getDbSource() + "<br>First is :"
+ + src.getDbName()) + "<html>");
+ dfetch.add(fetchr);
+ comp++;
+ // and then build the rest of the individual menus
+ ifetch = new JMenu("Sources from " + src.getDbSource());
+ icomp = 0;
+ String imname = null;
+ int i = 0;
+ for (DbSourceProxy sproxy : otherdb)
+ {
+ String dbname = sproxy.getDbName();
+ String sname = dbname.length() > 5 ? dbname.substring(0,
+ 5) + "..." : dbname;
+ String msname = dbname.length() > 10 ? dbname.substring(
+ 0, 10) + "..." : dbname;
+ if (imname == null)
+ {
+ imname = "from '" + sname + "'";
+ }
+ fetchr = new JMenuItem(msname);
+ final DbSourceProxy[] dassrc =
+ { sproxy };
+ fetchr.addActionListener(new ActionListener()
+ {
+
+ public void actionPerformed(ActionEvent e)
+ {
+ new Thread(new Runnable()
+ {
+
+ public void run()
+ {
+ new jalview.ws.DBRefFetcher(alignPanel.av
+ .getSequenceSelection(),
+ alignPanel.alignFrame, dassrc)
+ .fetchDBRefs(false);
+ }
+ }).start();
+ }
+
+ });
+ fetchr.setToolTipText("<html>"
+ + JvSwingUtils.wrapTooltip("Retrieve from "
+ + dbname) + "</html>");
+ ifetch.add(fetchr);
+ ++i;
+ if (++icomp >= mcomp || i == (otherdb.size()))
+ {
+ ifetch.setText(imname + " to '" + sname + "'");
+ dfetch.add(ifetch);
+ ifetch = new JMenu();
+ imname = null;
+ icomp = 0;
+ comp++;
+ }
}
}
+ ++dbi;
+ if (comp >= mcomp || dbi >= (dbclasses.length))
+ {
+ dfetch.setText(mname + " to '" + dbclass + "'");
+ rfetch.add(dfetch);
+ dfetch = new JMenu();
+ mname = null;
+ comp = 0;
+ }
}
}
});
alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
}
+ protected void normaliseSequenceLogo_actionPerformed(ActionEvent e)
+ {
+ viewport.setNormaliseSequenceLogo(normaliseSequenceLogo.getState());
+ alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
+ }
+
protected void applyAutoAnnotationSettings_actionPerformed(ActionEvent e)
{
alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
SequenceGroup[] gps = jalview.analysis.Grouping.makeGroupsFrom(
viewport.getSequenceSelection(),
viewport.getAlignmentView(true).getSequenceStrings(
- viewport.getGapCharacter()),
- viewport.alignment.getGroups());
- viewport.alignment.deleteAllGroups();
+ viewport.getGapCharacter()), viewport.getAlignment()
+ .getGroups());
+ viewport.getAlignment().deleteAllGroups();
viewport.sequenceColours = null;
viewport.setSelectionGroup(null);
// set view properties for each group
{
gps[g].setShowNonconserved(viewport.getShowUnconserved());
gps[g].setshowSequenceLogo(viewport.isShowSequenceLogo());
- viewport.alignment.addGroup(gps[g]);
+ viewport.getAlignment().addGroup(gps[g]);
Color col = new Color((int) (Math.random() * 255),
(int) (Math.random() * 255), (int) (Math.random() * 255));
col = col.brighter();
"Implementation error: cannot show a view from another alignment in an AlignFrame.");
}
if (tabbedPane != null
- & alignPanels.indexOf(alignmentPanel) != tabbedPane.getSelectedIndex())
+ & alignPanels.indexOf(alignmentPanel) != tabbedPane
+ .getSelectedIndex())
{
tabbedPane.setSelectedIndex(alignPanels.indexOf(alignmentPanel));
}