From: jprocter Sequence feature colour schemes 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 Feature Settings dialog
+box controls the order and display of each sequence annotation type, and
+also allows the colour scheme used for the the feature to be changed via
+the 'Graduated Colour' option in the sequence feature pop-up menu
+(obtained by right-clicking on a sequence feature). The Graduated Feature Colour dialog box has the following
+controls:
+
<mincolor>|<maxcolor>|[absolute|]<minvalue>|<maxvalue>[|<thresholdtype>|[<threshold value>]]
The fields are as follows
diff --git a/help/html/features/featureschemes.html b/help/html/features/featureschemes.html
new file mode 100644
index 0000000..7e4e5d8
--- /dev/null
+++ b/help/html/features/featureschemes.html
@@ -0,0 +1,57 @@
+
+
+
+
Graduated
+feature colour scheme settings dialog box
+
+
+ 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.
+
Icon styles for graduated feature styles
+
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:
+
Type of Colouring | Icon |
Graduated colour by Feature Score | |
Graduated colour thresholded (less than) by feature Score | |
Graduated colour thresholded (greater than) by feature Score | |
Colour by Feature Label (may also be thresholded) | |
+ + The current threshold is given in the + icon's tooltip. + + |
The top section of the dialog box lists all the sequence feature
@@ -21,15 +21,18 @@ for a feature in the associated alignment by clicking on its colour box.Feature settings pop-up menu
Right-click 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).
Ordering alignment by features
-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.
-Feature sorting and colour feature by score and description was
-introduced in jalview 2.4.1
Transparency and Feature Ordering
It is important to realise that sequence features are often not diff --git a/help/html/features/seqfeatures.html b/help/html/features/seqfeatures.html index 13fd306..97db3bd 100755 --- a/help/html/features/seqfeatures.html +++ b/help/html/features/seqfeatures.html @@ -1,48 +1,64 @@ -
Sequence Features
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 sequence motif -searches or simply read from a sequence features file.
+searches or simply read from a sequence +features file. You can also create +features from the results of searches or the current selection, and edit features by double clicking on +them. +Sequence Feature Colouring Styles
+By default, Jalview will assign a color to each feature based on +its type. These colours can be changed from the feature settings and amend features dialog boxes. Since +Jalview 2.5, it is also possible to define feature +colourschemes to shade features based on their associated scores or text +labels.
Sequence Feature Groups
-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 sequence features file).
+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 sequence features file).
Sequence Feature Inheritance
-Since Jalview 2.08, sequence features are global to a set of -sequences appearing (independently or together) in many different +
Since Jalview 2.08, sequence features are global 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.
+alignment or prediction web services, and when sequences are copied and +pasted into other alignment windows.View→Show Sequence Features
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).
View→Sequence Feature Settings...
-Once sequence features have been loaded, their display can be fully controlled
- using the alignment window's Sequence Feature Settings 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.
- Since Jalview 2.1, it is possible to add DAS features
- to an alignment via the DAS tabbed pane of the feature settings window.
View→Sequence ID Tooltip→Show Non-Positional features
- Only available in application
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".
-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 Features File Format for - more details.
+Once sequence features have been loaded, their display can be
+fully controlled using the alignment window's Sequence Feature Settings 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.
+Since Jalview 2.1, it is possible to add DAS
+features to an alignment via the DAS tabbed pane of the feature settings
+window.
View→Sequence ID Tooltip→Show
+Non-Positional features
+Only available in application
+
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".
+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 Features File Format for more details.
diff --git a/src/jalview/gui/FeatureColourChooser.java b/src/jalview/gui/FeatureColourChooser.java index 1e26a3a..1898113 100644 --- a/src/jalview/gui/FeatureColourChooser.java +++ b/src/jalview/gui/FeatureColourChooser.java @@ -23,6 +23,7 @@ import java.util.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; +import javax.swing.border.LineBorder; import javax.swing.event.*; import jalview.datamodel.*; @@ -145,7 +146,7 @@ public class FeatureColourChooser extends JPanel (max - min) / 2f, "Threshold", Color.black); - } + } adjusting = false; @@ -180,7 +181,7 @@ public class FeatureColourChooser extends JPanel { 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() @@ -194,7 +195,7 @@ public class FeatureColourChooser extends JPanel } }); 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() @@ -207,6 +208,11 @@ public class FeatureColourChooser extends JPanel } } }); + 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() @@ -278,11 +284,14 @@ public class FeatureColourChooser extends JPanel 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); @@ -294,6 +303,8 @@ public class FeatureColourChooser extends JPanel } + JLabel minText = new JLabel(); + JLabel maxText = new JLabel(); JPanel minColour = new JPanel(); JPanel maxColour = new JPanel(); @@ -393,6 +404,7 @@ public class FeatureColourChooser extends JPanel slider.setEnabled(false); thresholdValue.setEnabled(false); thresholdValue.setText(""); + thresholdIsMin.setEnabled(false); } else if (aboveThreshold != AnnotationColourGradient.NO_THRESHOLD && threshline == null) @@ -418,6 +430,7 @@ public class FeatureColourChooser extends JPanel slider.setMajorTickSpacing((int) (range / 10f)); slider.setEnabled(true); thresholdValue.setEnabled(true); + thresholdIsMin.setEnabled(!colourByLabel.isSelected()); adjusting = false; } diff --git a/src/jalview/gui/FeatureRenderer.java b/src/jalview/gui/FeatureRenderer.java index 95d940d..6abe899 100755 --- a/src/jalview/gui/FeatureRenderer.java +++ b/src/jalview/gui/FeatureRenderer.java @@ -1033,7 +1033,12 @@ public class FeatureRenderer 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(); @@ -1217,11 +1222,12 @@ public class FeatureRenderer 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()); } diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index def0a09..1bb4adc 100755 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -1381,6 +1381,8 @@ public class FeatureSettings extends JPanel public ColorRenderer() { setOpaque(true); // MUST do this for background to show up. + setHorizontalTextPosition(SwingConstants.CENTER); + setVerticalTextPosition(SwingConstants.CENTER); } public Component getTableCellRendererComponent(JTable table, @@ -1462,22 +1464,28 @@ public class FeatureSettings extends JPanel 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); } @@ -1486,13 +1494,14 @@ public class FeatureSettings extends JPanel 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) { @@ -1513,15 +1522,26 @@ class FeatureIcon implements Icon 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() @@ -1558,7 +1578,14 @@ class FeatureIcon implements Icon { 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); } } }