import jalview.datamodel.SequenceI;
import jalview.io.AnnotationFile;
import jalview.io.AppletFormatAdapter;
+import jalview.io.DataSourceType;
import jalview.io.FeaturesFile;
+import jalview.io.FileFormat;
import jalview.io.TCoffeeScoreFile;
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.RNAHelicesColour;
import jalview.schemes.StrandColourScheme;
import jalview.schemes.TCoffeeColourScheme;
import jalview.schemes.TaylorColourScheme;
import java.util.Arrays;
import java.util.Deque;
import java.util.HashMap;
-import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
{
RNAHelixColour.setEnabled(false);
purinePyrimidineColour.setEnabled(false);
+ nucleotideColour.setEnabled(false);
}
// Some JVMS send keyevents to Top frame or lowest panel,
// Havent worked out why yet. So add to both this frame and seqCanvas for
* is protocol for accessing data referred to by file
*/
- public boolean parseFeaturesFile(String file, String type)
+ public boolean parseFeaturesFile(String file, DataSourceType type)
{
return parseFeaturesFile(file, type, true);
}
*
* @param file
* file URL, content, or other resolvable path
- * @param type
+ * @param sourceType
* is protocol for accessing data referred to by file
* @param autoenabledisplay
* when true, display features flag will be automatically enabled if
* features are loaded
* @return true if data parsed as a features file
*/
- public boolean parseFeaturesFile(String file, String type,
+ public boolean parseFeaturesFile(String file, DataSourceType sourceType,
boolean autoenabledisplay)
{
boolean featuresFile = false;
.getFeatureRenderer().getFeatureColours();
boolean relaxedIdMatching = viewport.applet.getDefaultParameter(
"relaxedidmatch", false);
- featuresFile = new FeaturesFile(file, type).parse(
+ featuresFile = new FeaturesFile(file, sourceType).parse(
viewport.getAlignment(), colours, true, relaxedIdMatching);
} catch (Exception ex)
{
// 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.getColumnSelection() != null
- && viewport.getColumnSelection().getSelected() != null && viewport
- .getColumnSelection().getSelected().size() > 0)
+ if (viewport.hasSelectedColumns()
|| (sg != null && sg.getSize() > 0 && sg.getStartRes() <= sg
.getEndRes()))
{
hide = true;
viewport.hideAllSelectedSeqs();
}
- else if (!(toggleCols && viewport.getColumnSelection().getSelected()
- .size() > 0))
+ else if (!(toggleCols && viewport.hasSelectedColumns()))
{
viewport.showAllHiddenSeqs();
}
if (toggleCols)
{
- if (viewport.getColumnSelection().getSelected().size() > 0)
+ if (viewport.hasSelectedColumns())
{
viewport.hideSelectedColumns();
if (!toggleSeqs)
if (alignPanel.getAlignment().getAlignmentAnnotation() != null)
{
for (AlignmentAnnotation aa : alignPanel.getAlignment()
- .getAlignmentAnnotation())
- {
- boolean visible = (aa.sequenceRef == null ? showForAlignment
- : showForSequences);
- aa.visible = visible;
+ .getAlignmentAnnotation())
+ {
+ boolean visible = (aa.sequenceRef == null ? showForAlignment
+ : showForSequences);
+ aa.visible = visible;
}
}
alignPanel.validateAnnotationDimensions(true);
// }
else if (source == RNAHelixColour)
{
- new RNAHelicesColourChooser(viewport, alignPanel);
+ changeColour(new RNAHelicesColour(viewport.getAlignment()));
+ // new RNAHelicesColourChooser(viewport, alignPanel);
}
else if (source == modifyPID)
{
CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this);
Frame frame = new Frame();
frame.add(cap);
- jalview.bin.JalviewLite.addFrame(frame, MessageManager.formatMessage(
+ JalviewLite.addFrame(frame, MessageManager.formatMessage(
"label.alignment_output_command",
new Object[] { e.getActionCommand() }), 600, 500);
- FeatureRenderer fr = this.alignPanel.cloneFeatureRenderer();
+ FileFormat fileFormat = FileFormat.valueOf(e.getActionCommand());
cap.setText(new AppletFormatAdapter(alignPanel).formatSequences(
- e.getActionCommand(), viewport.getAlignment(),
+ fileFormat, viewport.getAlignment(),
viewport.getShowJVSuffix()));
}
FeaturesFile formatter = new FeaturesFile();
if (format.equalsIgnoreCase("Jalview"))
{
- features = formatter.printJalviewFormat(viewport
- .getAlignment().getSequencesArray(),
- getDisplayedFeatureCols());
+ features = formatter.printJalviewFormat(viewport.getAlignment()
+ .getSequencesArray(), getDisplayedFeatureCols());
}
else
{
url.append(appendProtocol(viewport.applet.getParameter("annotations")));
}
- if (viewport.applet.getParameter("jnetfile") != null)
+ if (viewport.applet.getParameter("jnetfile") != null
+ || viewport.applet.getParameter("jpredfile") != null)
{
url.append("&annotations=");
- url.append(appendProtocol(viewport.applet.getParameter("jnetfile")));
+ url.append(appendProtocol(viewport.applet.getParameter("jnetfile") != null ? viewport.applet
+ .getParameter("jnetfile") : viewport.applet
+ .getParameter("jpredfile")));
}
if (viewport.applet.getParameter("defaultColour") != null)
@Override
public void changeColour(ColourSchemeI cs)
{
-
+ // FIXME threshold, conservation, increment belong inside
+ // AlignmentColourScheme and/or ViewStyleI, not ColourSchemeI
if (cs != null)
{
if (viewport.getAbovePIDThreshold())
{
viewport.setThreshold(SliderPanel.setPIDSliderSource(alignPanel,
- cs, "Background"));
+ viewport.getViewportColourScheme(), "Background"));
}
if (viewport.getConservationSelected())
{
- cs.setConservationApplied(true);
+ // cs.setConservationApplied(true);
viewport.setIncrement(SliderPanel.setConservationSlider(alignPanel,
- cs, "Background"));
- }
- else
- {
- cs.setConservationApplied(false);
+ viewport.getViewportColourScheme(), "Background"));
}
+ // else
+ // {
+ // cs.setConservationApplied(false);
+ // }
}
viewport.setGlobalColourScheme(cs);
+ viewport.getViewportColourScheme().setConservationApplied(
+ viewport.getConservationSelected());
alignPanel.paintAlignment(true);
}
&& viewport.getGlobalColourScheme() != null)
{
SliderPanel.setPIDSliderSource(alignPanel,
- viewport.getGlobalColourScheme(), "Background");
+ viewport.getViewportColourScheme(), "Background");
SliderPanel.showPIDSlider();
}
}
&& viewport.getGlobalColourScheme() != null)
{
SliderPanel.setConservationSlider(alignPanel,
- viewport.getGlobalColourScheme(), "Background");
+ viewport.getViewportColourScheme(), "Background");
SliderPanel.showConservationSlider();
}
}
inputText.addActionListener(this);
Menu outputTextboxMenu = new Menu(
MessageManager.getString("label.out_to_textbox"));
- for (int i = 0; i < jalview.io.AppletFormatAdapter.WRITEABLE_FORMATS.length; i++)
+ for (String ff : FileFormat.getWritableFormats(true))
{
-
- MenuItem item = new MenuItem(
- jalview.io.AppletFormatAdapter.WRITEABLE_FORMATS[i]);
+ MenuItem item = new MenuItem(ff);
item.addActionListener(new java.awt.event.ActionListener()
{
.getString("label.colour_text"));
colourTextMenuItem.addItemListener(this);
displayNonconservedMenuItem.setLabel(MessageManager
- .getString("label.show_non_conversed"));
+ .getString("label.show_non_conserved"));
displayNonconservedMenuItem.addItemListener(this);
wrapMenuItem.setLabel(MessageManager.getString("action.wrap"));
wrapMenuItem.addItemListener(this);
.getString("label.apply_colour_to_all_groups"));
applyToAllGroups.setState(true);
applyToAllGroups.addItemListener(this);
- clustalColour.setLabel(MessageManager.getString("label.clustalx"));
+ clustalColour.setLabel(MessageManager
+ .getString("label.colourScheme_clustal"));
clustalColour.addActionListener(this);
- zappoColour.setLabel(MessageManager.getString("label.zappo"));
+ zappoColour.setLabel(MessageManager
+ .getString("label.colourScheme_zappo"));
zappoColour.addActionListener(this);
- taylorColour.setLabel(MessageManager.getString("label.taylor"));
+ taylorColour.setLabel(MessageManager
+ .getString("label.colourScheme_taylor"));
taylorColour.addActionListener(this);
hydrophobicityColour.setLabel(MessageManager
- .getString("label.hydrophobicity"));
+ .getString("label.colourScheme_hydrophobic"));
hydrophobicityColour.addActionListener(this);
- helixColour
- .setLabel(MessageManager.getString("label.helix_propensity"));
+ helixColour.setLabel(MessageManager
+ .getString("label.colourScheme_helix_propensity"));
helixColour.addActionListener(this);
strandColour.setLabel(MessageManager
- .getString("label.strand_propensity"));
+ .getString("label.colourScheme_strand_propensity"));
strandColour.addActionListener(this);
- turnColour.setLabel(MessageManager.getString("label.turn_propensity"));
+ turnColour.setLabel(MessageManager
+ .getString("label.colourScheme_turn_propensity"));
turnColour.addActionListener(this);
- buriedColour.setLabel(MessageManager.getString("label.buried_index"));
+ buriedColour.setLabel(MessageManager
+ .getString("label.colourScheme_buried_index"));
buriedColour.addActionListener(this);
purinePyrimidineColour.setLabel(MessageManager
- .getString("label.purine_pyrimidine"));
+ .getString("label.colourScheme_purine/pyrimidine"));
purinePyrimidineColour.addActionListener(this);
// RNAInteractionColour.setLabel(MessageManager
// .getString("label.rna_interaction"));
// RNAInteractionColour.addActionListener(this);
RNAHelixColour.setLabel(MessageManager
- .getString("action.by_rna_helixes"));
+ .getString("label.colourScheme_rna_helices"));
RNAHelixColour.addActionListener(this);
userDefinedColour.setLabel(MessageManager
.getString("action.user_defined"));
userDefinedColour.addActionListener(this);
PIDColour.setLabel(MessageManager
- .getString("label.percentage_identity"));
+ .getString("label.colourScheme_%_identity"));
PIDColour.addActionListener(this);
BLOSUM62Colour.setLabel(MessageManager
- .getString("label.blosum62_score"));
+ .getString("label.colourScheme_blosum62"));
BLOSUM62Colour.addActionListener(this);
- tcoffeeColour
- .setLabel(MessageManager.getString("label.tcoffee_scores"));
+ tcoffeeColour.setLabel(MessageManager
+ .getString("label.colourScheme_t-coffee_scores"));
// it will be enabled only if a score file is provided
tcoffeeColour.setEnabled(false);
tcoffeeColour.addActionListener(this);
abovePIDThreshold.setLabel(MessageManager
.getString("label.above_identity_threshold"));
abovePIDThreshold.addItemListener(this);
- nucleotideColour.setLabel(MessageManager.getString("label.nucleotide"));
+ nucleotideColour.setLabel(MessageManager
+ .getString("label.colourScheme_nucleotide"));
nucleotideColour.addActionListener(this);
modifyPID.setLabel(MessageManager
- .getString("label.modify_identity_thereshold"));
+ .getString("label.modify_identity_threshold"));
modifyPID.addActionListener(this);
modifyConservation.setLabel(MessageManager
- .getString("label.modify_conservation_thereshold"));
+ .getString("label.modify_conservation_threshold"));
modifyConservation.addActionListener(this);
annotationColour.setLabel(MessageManager
.getString("action.by_annotation"));
.getString("label.neighbour_joining_identity"));
neighbourTreeMenuItem.addActionListener(this);
avDistanceTreeBlosumMenuItem.setLabel(MessageManager
- .getString("label.average_distance_bloslum62"));
+ .getString("label.average_distance_blosum62"));
avDistanceTreeBlosumMenuItem.addActionListener(this);
njTreeBlosumMenuItem.setLabel(MessageManager
.getString("label.neighbour_blosum62"));
}
// resolve data source
// TODO: this code should be a refactored to an io package
- String protocol = AppletFormatAdapter.resolveProtocol(pdbFile, "PDB");
+ DataSourceType protocol = AppletFormatAdapter.resolveProtocol(
+ pdbFile, FileFormat.PDB);
if (protocol == null)
{
return false;
}
if (needtoadd)
{
- // make a note of the access mode and add
- if (pdbentry.getProperty() == null)
- {
- pdbentry.setProperty(new Hashtable());
- }
- pdbentry.getProperty().put("protocol", protocol);
+ pdbentry.setProperty("protocol", protocol);
toaddpdb.addPDBId(pdbentry);
alignPanel.getStructureSelectionManager()
.registerPDBEntry(pdbentry);
}
public void newStructureView(JalviewLite applet, PDBEntry pdb,
- SequenceI[] seqs, String[] chains, String protocol)
+ SequenceI[] seqs, String[] chains, DataSourceType protocol)
{
// Scrub any null sequences from the array
Object[] sqch = cleanSeqChainArrays(seqs, chains);
System.err
.println("JalviewLite.AlignFrame:newStructureView: No sequence to bind structure to.");
}
- if (protocol == null || protocol.trim().length() == 0
- || protocol.equals("null"))
+ if (protocol == null)
{
- protocol = (String) pdb.getProperty().get("protocol");
+ String sourceType = (String) pdb.getProperty("protocol");
+ try
+ {
+ protocol = DataSourceType.valueOf(sourceType);
+ } catch (IllegalArgumentException e)
+ {
+ // ignore
+ }
if (protocol == null)
{
System.err.println("Couldn't work out protocol to open structure: "
{
// can only do alignments with Jmol
// find the last jmol window assigned to this alignment
- jalview.appletgui.AppletJmol ajm = null, tajm;
- Vector jmols = applet
- .getAppletWindow(jalview.appletgui.AppletJmol.class);
+ AppletJmol ajm = null, tajm;
+ Vector jmols = applet.getAppletWindow(AppletJmol.class);
for (int i = 0, iSize = jmols.size(); i < iSize; i++)
{
- tajm = (jalview.appletgui.AppletJmol) jmols.elementAt(i);
+ tajm = (AppletJmol) jmols.elementAt(i);
if (tajm.ap.alignFrame == this)
{
ajm = tajm;
// otherwise, create a new window
if (applet.jmolAvailable)
{
- new jalview.appletgui.AppletJmol(pdb, seqs, chains, alignPanel,
+ new AppletJmol(pdb, seqs, chains, alignPanel,
protocol);
applet.lastFrameX += 40;
applet.lastFrameY += 40;