From: jprocter Date: Wed, 28 Apr 2010 10:21:20 +0000 (+0000) Subject: graduated feature schemes (with visual indication of thresholding) X-Git-Tag: Release_2_5~38 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=98ad3bbc158402de19c2fc47ea72845c54c18a2a;p=jalview.git graduated feature schemes (with visual indication of thresholding) --- diff --git a/help/html/features/fcsgtthan.gif b/help/html/features/fcsgtthan.gif new file mode 100644 index 0000000..3d4f729 Binary files /dev/null and b/help/html/features/fcsgtthan.gif differ diff --git a/help/html/features/fcsltthan.gif b/help/html/features/fcsltthan.gif new file mode 100644 index 0000000..119f11c Binary files /dev/null and b/help/html/features/fcsltthan.gif differ diff --git a/help/html/features/fcsminmax.gif b/help/html/features/fcsminmax.gif new file mode 100644 index 0000000..5d3fb29 Binary files /dev/null and b/help/html/features/fcsminmax.gif differ diff --git a/help/html/features/fcsntlabel.gif b/help/html/features/fcsntlabel.gif new file mode 100644 index 0000000..16d6fc3 Binary files /dev/null and b/help/html/features/fcsntlabel.gif differ diff --git a/help/html/features/featureSettings.gif b/help/html/features/featureSettings.gif index cf78625..31f245c 100755 Binary files a/help/html/features/featureSettings.gif and b/help/html/features/featureSettings.gif differ diff --git a/help/html/features/featurecoloursettings.gif b/help/html/features/featurecoloursettings.gif new file mode 100644 index 0000000..1b889db Binary files /dev/null and b/help/html/features/featurecoloursettings.gif differ diff --git a/help/html/features/featuresFormat.html b/help/html/features/featuresFormat.html index 2e40a19..b7ddab5 100755 --- a/help/html/features/featuresFormat.html +++ b/help/html/features/featuresFormat.html @@ -33,7 +33,7 @@ type has a text label, and a colour specification. This can be either:
  • 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))
  • -
  • A graduated colour specified as a "|" separated list +
  • A graduated colourscheme specified as a "|" separated list of fields:
     <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 @@ + + + +Sequence feature colour schemes + + + +

    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).

    + +

    Graduated +feature colour scheme settings dialog box
    +

    The Graduated Feature Colour dialog box has the following +controls: +

    +

    +

    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 ColouringIcon
    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. + +

    +Graduated feature colours were introduced in Jalview 2.5 + + diff --git a/help/html/features/featuresettings.html b/help/html/features/featuresettings.html index 7c4840d..6a89009 100755 --- a/help/html/features/featuresettings.html +++ b/help/html/features/featuresettings.html @@ -8,7 +8,7 @@ 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.

    -
    +

    Sequence Feature Settings for the Jalview Application

    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).

    +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

    +features and groups on each sequence. To order the alignment using a +specific feature type, use the sort by .. entries in the pop-up +menu for that type.
    +Feature sorting and graduated feature colouring was introduced +in jalview 2.5

    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 + +Sequence Features +

    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); } } }