<li>A single colour specified as either a red,green,blue 24 bit
triplet in hexadecimal (eg. 00ff00) or as comma separated numbers
(ranging from 0 to 255))</li>
- <li>A graduated colour specified as a "|" separated list
+ <li>A <a href="featureschemes.html">graduated colourscheme</a> specified as a "|" separated list
of fields:<pre>
<mincolor>|<maxcolor>|[absolute|]<minvalue>|<maxvalue>[|<thresholdtype>|[<threshold value>]]
</pre>The fields are as follows
--- /dev/null
+<html>
+
+<head>
+<title>Sequence feature colour schemes</title>
+</head>
+
+<body>
+<p><strong>Sequence feature colour schemes</strong></p>
+<p>Jalview can visualize annotation present on parts of a sequence by
+overlaying colours according to the annotation present at each position.
+It allows features to be colored either according to type, or for a
+particular type, according to an individual feature's associated label
+or score. The <a href="featuresettings.html">Feature Settings dialog
+box</a> controls the order and display of each sequence annotation type, and
+also allows the colour scheme used for the the feature to be changed <em>via</em>
+the 'Graduated Colour' option in the sequence feature pop-up menu
+(obtained by right-clicking on a sequence feature).</p>
+
+<center><img src="featurecoloursettings.gif"><br/>Graduated
+feature colour scheme settings dialog box</img></center>
+<p>The Graduated Feature Colour dialog box has the following
+controls:
+<ul>
+ <li><em>Colour by Label</em> - when checked this derives a colour
+ for each feature based on the label text.</li>
+ <li><em>Min and Max Color boxes</em> - Click on these boxes to set
+ the minimum and maximum colours used to shade features by their
+ associated score.</li>
+ <li><em>Threshold type combo box</em> - Allows features to be
+ hidden features if their score is below or above a given threshold.<br />
+ <em>Set the threshold using the slider or type it in to the text
+ box. The threshold cannot be set outside the available range of feature
+ scores.</em>
+ </li>
+ <li><em>Threshold is Min/Max</em> - When checked, the threshold
+ will be used as the upper or lower limit when shading the features
+ according to their score using the Min and Max colour.</li>
+</ul>
+</p>
+<p><strong>Icon styles for graduated feature styles</strong><br/>
+<p>When a graduated colourscheme is applied to a feature, it is indicated in the feature settings or amend feature dialog box by the following types of icon:<br/>
+<center><table width="50%" border="1">
+<tr><td><strong>Type of Colouring</strong></td><td><strong>Icon</strong></td></tr>
+<tr><td><em>Graduated colour by Feature Score</em></td><td><img src="fcsminmax.gif"/></td></tr>
+<tr><td><em>Graduated colour thresholded (less than) by feature Score</em></td><td><img src="fcsltthan.gif"/></td></tr>
+<tr><td><em>Graduated colour thresholded (greater than) by feature Score</em></td><td><img src="fcsgtthan.gif"/></td></tr>
+<tr><td><em>Colour by Feature Label (may also be thresholded)</em></td><td><img src="fcsntlabel.gif"/></td></tr>
+<tr>
+ <td align="center" colspan="2">
+ <em>
+ <strong>The current threshold is given in the
+ icon's tooltip.</strong>
+ </em>
+ </td></tr></table></center></p>
+<em>Graduated feature colours were introduced in Jalview 2.5</em>
+</body>
+</html>
in an alignment window to open the feature settings dialog box, which
allows you to precisely control the presence and appearance of sequence
features for the current alignment.</p>
-<center><img src="featureSettings.gif" width="351" height="350">
+<center><img src="featureSettings.gif" width="400" height="452">
<br>
Sequence Feature Settings for the Jalview Application</img></center>
<p>The top section of the dialog box lists all the sequence feature
<p><strong><em>Feature settings pop-up menu</em></strong><br>
<strong>Right-click</strong> on a feature to open a pop-up menu that
allows you to sort the alignment or current selection using that feature
-type (see below), or create a feature colourscheme based on either the
-scores associated with that feature or from the feature's description
-(e.g. to distinguish different names associated with a DOMAIN feature).</p>
+type (see below), or create a <a href="featureschemes.html">feature
+colourscheme</a> based on either the scores associated with that feature or
+from the feature's description (e.g. to distinguish different names
+associated with a DOMAIN feature).</p>
<p><strong>Ordering alignment by features</strong><br>
-The 'Order by Score' and 'Order by Density' buttons will order the
+The 'Seq Sort by Score' and 'Seq Sort by Density' buttons will sort the
alignment based on the average score or total number of currently active
-features and groups on each sequence.<br>
-<em>Feature sorting and colour feature by score and description was
-introduced in jalview 2.4.1</em></p>
+features and groups on each sequence. To order the alignment using a
+specific feature type, use the <em>sort by ..</em> entries in the pop-up
+menu for that type.<br>
+<em>Feature sorting and graduated feature colouring was introduced
+in jalview 2.5</em></p>
<p><strong>Transparency and Feature Ordering</strong></p>
<p>It is important to realise that sequence features are often not
<html>
-<head><title>Sequence Features</title></head>
+<head>
+<title>Sequence Features</title>
+</head>
<body>
<p><strong>Sequence Features</strong></p>
<p>Jalview can colour parts of a sequence based on the presence of
sequence features - which may be retrieved from database records (such
as Uniprot), the result of <a href="search.html">sequence motif
-searches</a> or simply read from a <a
-href="featuresFormat.html">sequence features file</a>.</p>
+searches</a> or simply read from a <a href="featuresFormat.html">sequence
+features file</a>. You can also <a href="creatinFeatures.html">create
+features</a> from the results of searches or the current selection, and <a
+ href="editingFeatures.html">edit features</a> by double clicking on
+them.</p>
+<p><strong>Sequence Feature Colouring Styles</strong></p>
+<p>By default, Jalview will assign a color to each feature based on
+its type. These colours can be changed from the <a
+ href="featuresettings.html">feature settings</a> and <a
+ href="editingFeatures.html">amend features</a> dialog boxes. Since
+Jalview 2.5, it is also possible to define <a href="featureschemes.html">feature
+colourschemes</a> to shade features based on their associated scores or text
+labels.</p>
<p><strong>Sequence Feature Groups</strong></p>
-<p>Since Jalview 2.08, sequence features assigned to a sequence can be
-organised into groups, which may indicate that the features were all retrieved
-from the same database (such as Uniprot features), or generated by the
-same analysis process (as might be specified in a <a
-href="featuresFormat.html">sequence features file</a>).</p>
+<p>Since Jalview 2.08, sequence features assigned to a sequence can
+be organised into groups, which may indicate that the features were all
+retrieved from the same database (such as Uniprot features), or
+generated by the same analysis process (as might be specified in a <a
+ href="featuresFormat.html">sequence features file</a>).</p>
<p><strong>Sequence Feature Inheritance</strong></p>
-<p>Since Jalview 2.08, sequence features are <em>global</em> to a set of
-sequences appearing (independently or together) in many different
+<p>Since Jalview 2.08, sequence features are <em>global</em> to a
+set of sequences appearing (independently or together) in many different
alignments. Practically, this means features loaded onto one alignment
can be viewed in any alignments involving the same sequences. The same
sequence appears in different alignments when a new alignment is
generated by submitting an existing set of sequences to one of the
-alignment or prediction web services, and when sequences are copied
-and pasted into other alignment windows.</p>
+alignment or prediction web services, and when sequences are copied and
+pasted into other alignment windows.</p>
<p><strong>View→Show Sequence Features</strong></p>
<p>Toggle the display of sequence features in this alignment. If
feature retrieval has not already been carried out, then Jalview will
automatically try to fetch sequence features (as described below).</p>
<p><strong>View→Sequence Feature Settings...</strong></p>
-<p>Once sequence features have been loaded, their display can be fully controlled
- using the alignment window's <a
- href="featuresettings.html">Sequence Feature Settings</a> dialog box. Feature
- colour schemes and display parameters are unique to a particular alignment,
- so it is possible to colour the same sequence features differently in different
- alignment views.<br>
- Since Jalview 2.1, it is possible to add <a href="dassettings.html">DAS features</a>
- to an alignment via the DAS tabbed pane of the feature settings window. </p>
-<p><strong>View→Sequence ID Tooltip→Show Non-Positional features</strong><br>
- <em>Only available in application</em></br></p>
-<p>Toggles the display of non-positional features in the sequence ID tooltip,
- and whether they will be included when sequence features are exported using
- "File→Export Features".</p>
-<p>Precalculated Sequence Features may be added to an alignment from the command
- line, drag and drop, or from the "File→Load Features / Annotations"
- menu item. See the <a href="featuresFormat.html">Features File Format</a> for
- more details.</p>
+<p>Once sequence features have been loaded, their display can be
+fully controlled using the alignment window's <a
+ href="featuresettings.html">Sequence Feature Settings</a> dialog box.
+Feature colour schemes and display parameters are unique to a particular
+alignment, so it is possible to colour the same sequence features
+differently in different alignment views.<br>
+Since Jalview 2.1, it is possible to add <a href="dassettings.html">DAS
+features</a> to an alignment via the DAS tabbed pane of the feature settings
+window.</p>
+<p><strong>View→Sequence ID Tooltip→Show
+Non-Positional features</strong><br>
+<em>Only available in application</em></br>
+</p>
+<p>Toggles the display of non-positional features in the sequence ID
+tooltip, and whether they will be included when sequence features are
+exported using "File→Export Features".</p>
+<p>Precalculated Sequence Features may be added to an alignment from
+the command line, drag and drop, or from the "File→Load
+Features / Annotations" menu item. See the <a
+ href="featuresFormat.html">Features File Format</a> for more details.</p>
</body>
</html>
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
+import javax.swing.border.LineBorder;
import javax.swing.event.*;
import jalview.datamodel.*;
(max - min) / 2f,
"Threshold", Color.black);
- }
+ }
adjusting = false;
{
minColour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
- minColour.setBorder(BorderFactory.createEtchedBorder());
+ minColour.setBorder(BorderFactory.createLineBorder(Color.black));
minColour.setPreferredSize(new Dimension(40, 20));
minColour.setToolTipText("Minimum Colour");
minColour.addMouseListener(new MouseAdapter()
}
});
maxColour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
- maxColour.setBorder(BorderFactory.createEtchedBorder());
+ maxColour.setBorder(BorderFactory.createLineBorder(Color.black));
maxColour.setPreferredSize(new Dimension(40, 20));
maxColour.setToolTipText("Maximum Colour");
maxColour.addMouseListener(new MouseAdapter()
}
}
});
+ maxColour.setBorder(new LineBorder(Color.black));
+ minText.setText("Min:");
+ minText.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
+ maxText.setText("Max:");
+ maxText.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
ok.setOpaque(false);
ok.setText("OK");
ok.addActionListener(new ActionListener()
colourByLabel_actionPerformed(actionEvent);
}
});
+ colourPanel.setBackground(Color.white);
jPanel1.add(ok);
jPanel1.add(cancel);
jPanel2.add(colourByLabel,java.awt.BorderLayout.WEST);
jPanel2.add(colourPanel,java.awt.BorderLayout.EAST);
+ colourPanel.add(minText);
colourPanel.add(minColour);
+ colourPanel.add(maxText);
colourPanel.add(maxColour);
this.add(jPanel3, java.awt.BorderLayout.CENTER);
jPanel3.add(threshold);
}
+ JLabel minText = new JLabel();
+ JLabel maxText = new JLabel();
JPanel minColour = new JPanel();
JPanel maxColour = new JPanel();
slider.setEnabled(false);
thresholdValue.setEnabled(false);
thresholdValue.setText("");
+ thresholdIsMin.setEnabled(false);
}
else if (aboveThreshold != AnnotationColourGradient.NO_THRESHOLD
&& threshline == null)
slider.setMajorTickSpacing((int) (range / 10f));
slider.setEnabled(true);
thresholdValue.setEnabled(true);
+ thresholdIsMin.setEnabled(!colourByLabel.isSelected());
adjusting = false;
}
tmp.add(new JLabel("Colour: ", JLabel.RIGHT));
tmp.add(colour);
colour.setPreferredSize(new Dimension(150, 15));
-
+ colour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 9));
+ colour.setForeground(Color.black);
+ colour.setHorizontalAlignment(SwingConstants.CENTER);
+ colour.setVerticalAlignment(SwingConstants.CENTER);
+ colour.setHorizontalTextPosition(SwingConstants.CENTER);
+ colour.setVerticalTextPosition(SwingConstants.CENTER);
bigPanel.add(panel, BorderLayout.NORTH);
panel = new JPanel();
colour.setIcon(null);
colour.setToolTipText(null);
colour.setText("");
+
if (col2 instanceof Color) {
colour.setBackground((Color)col2);
} else {
colour.setBackground(bigPanel.getBackground());
- colour.setForeground(bigPanel.getForeground());
+ colour.setForeground(Color.black);
FeatureSettings.renderGraduatedColor(colour, (GraduatedColor) col2);
//colour.setForeground(colour.getBackground());
}
public ColorRenderer()
{
setOpaque(true); // MUST do this for background to show up.
+ setHorizontalTextPosition(SwingConstants.CENTER);
+ setVerticalTextPosition(SwingConstants.CENTER);
}
public Component getTableCellRendererComponent(JTable table,
public static void renderGraduatedColor(JLabel comp, GraduatedColor gcol,
int w, int h)
{
-
+ boolean thr=false;
String tt = "";
String tx = "";
if (gcol.getThreshType() == AnnotationColourGradient.ABOVE_THRESHOLD)
{
- tx += "> ";
+ thr=true;
+ tx += ">";
tt += "Thresholded (Above " + gcol.getThresh() + ") ";
}
if (gcol.getThreshType() == AnnotationColourGradient.BELOW_THRESHOLD)
{
- tx += "< ";
+ thr=true;
+ tx += "<";
tt += "Thresholded (Below " + gcol.getThresh() + ") ";
}
if (gcol.isColourByLabel())
{
tt = "Coloured by label text. " + tt;
+ if (thr)
+ {
+ tx+=" ";
+ }
tx += "Label";
comp.setIcon(null);
}
Color newColor = gcol.getMaxColor();
comp.setBackground(newColor);
// System.err.println("Width is " + w / 2);
- Icon ficon = new FeatureIcon(gcol, comp.getBackground(), w / 2, h);
+ Icon ficon = new FeatureIcon(gcol, comp.getBackground(), w, h, thr);
comp.setIcon(ficon);
// tt+="RGB value: Max (" + newColor.getRed() + ", "
// + newColor.getGreen() + ", " + newColor.getBlue()
// + ")\nMin (" + minCol.getRed() + ", " + minCol.getGreen()
// + ", " + minCol.getBlue() + ")");
}
+ comp.setHorizontalAlignment(SwingConstants.CENTER);
comp.setText(tx);
if (tt.length() > 0)
{
GraduatedColor gcol;
Color backg;
-
+ boolean midspace=false;
int width = 50, height = 20;
+ int s1,e1; // start and end of midpoint band for thresholded symbol
+ Color mpcolour = Color.white;
- FeatureIcon(GraduatedColor gfc, Color bg, int w, int h)
+ FeatureIcon(GraduatedColor gfc, Color bg, int w, int h, boolean mspace)
{
gcol = gfc;
backg = bg;
width = w;
height = h;
+ midspace = mspace;
+ if (midspace)
+ {
+ s1=width/3;
+ e1=s1*2;
+ } else {
+ s1 = width/2;
+ e1 = s1;
+ }
}
public int getIconWidth()
{
Color minCol = gcol.getMinColor();
g.setColor(minCol);
- g.fillRect(0, 0, width, height);
+ g.fillRect(0, 0, s1, height);
+ if (midspace)
+ {
+ g.setColor(Color.white);
+ g.fillRect(s1,0,e1-s1, height);
+ }
+ g.setColor(gcol.getMaxColor());
+ g.fillRect(0,e1, width-e1, height);
}
}
}