ASX-TURN-IIL a67c98
BETA-TURN-IIR c79792
PHOSPHORYLATION (T) c88395
-BETA-TURN-IIL 8b5b50
-ST-MOTIF ac25a1
+BETA-TURN-IIL label
+#8b5b50
+ST-MOTIF label|||0|0
+#ac25a1
STARTGROUP uniprot
+ <html><a href="http://pfam.xfam.org/family/PF00111">Pfam family</a></html> FER_CAPAA -1 0 0 Pfam
Iron-sulfur (2Fe-2S) FER_CAPAA -1 39 39 METAL
Iron-sulfur (2Fe-2S) FER_CAPAA -1 44 44 METAL
Iron-sulfur (2Fe-2S) FER_CAPAA -1 47 47 METAL
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
+import jalview.schemes.Colour;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.ResidueProperties;
+ import jalview.structure.StructureImportSettings;
import jalview.structure.StructureMapping;
- import jalview.structure.StructureViewSettings;
import java.awt.Color;
import java.util.List;
*
* @return
*/
- Color getMaxColour();
+ ColorI getMaxColour();
/**
- * Answers true if the feature is coloured by label (description); only
- * applicable when isGraduatedColour answers true
+ * Answers true if the feature has a single colour, i.e. if isColourByLabel()
+ * and isGraduatedColour() both answer false
+ *
+ * @return
+ */
+ boolean isSimpleColour();
+
+ /**
+ * Answers true if the feature is coloured by label (description)
*
* @return
*/
*/
float getThreshold();
- float getMax();
-
- /**
- * Returns the minimum score of the graduated colour range
- *
- * @return
- */
- float getMin();
+ void setThreshold(float f);
/**
+ * Answers true if either isAboveThreshold or isBelowThreshold answers true
+ *
+ * @return
+ */
+ boolean hasThreshold();
+
+ /**
- * Returns the computed colour for the given sequence feature
+ * Answers true if the colour varies between the actual minimum and maximum
+ * score values of the feature, or false if between absolute minimum and
+ * maximum values (or if not a graduated colour).
*
- * @param feature
* @return
*/
- ColorI getColor(SequenceFeature feature);
+ boolean isAutoScaled();
+
+ void setAutoScaled(boolean b);
/**
- * Returns the maximum score of the graduated colour range
+ * Answers true if the feature has a simple colour, or is coloured by label,
+ * or has a graduated colour and the score of this feature instance is within
+ * the range to render (if any), i.e. does not lie below or above any
+ * threshold set.
*
+ * @param feature
* @return
*/
- float getMax();
+ boolean isColored(SequenceFeature feature);
/**
- * Returns the minimum score of the graduated colour range
+ * Update the min-max range for a graduated colour scheme
*
- * @return
+ * @param min
+ * @param max
*/
- float getMin();
+ void updateBounds(float min, float max);
/**
- * Answers true if either isAboveThreshold or isBelowThreshold answers true
+ * Returns the colour in Jalview features file format
*
* @return
*/
- boolean hasThreshold();
+ String toJalviewFormat(String featureType);
- void setThreshold(float f);
-
- boolean isAutoScaled();
-
- void setAutoScaled(boolean b);
-
- boolean isSimpleColour();
-
- void setAboveThreshold(boolean b);
-
- void setThresholdMinMax(boolean b);
-
- void setBelowThreshold(boolean b);
+ /**
- * Returns the computed colour for the given sequence feature
++ * Returns the maximum score of the graduated colour range
+ *
- * @param feature
+ * @return
+ */
- Color getColor(SequenceFeature feature);
++ float getMax();
- void setColourByLabel(boolean b);
+ /**
- * Answers true if the feature has a simple colour, or is coloured by label,
- * or has a graduated colour and the score of this feature instance is within
- * the range to render (if any), i.e. does not lie below or above any
- * threshold set.
++ * Returns the minimum score of the graduated colour range
+ *
- * @param feature
+ * @return
+ */
- boolean isColored(SequenceFeature feature);
-
- /**
- * Update the min-max range for a graduated colour scheme
- *
- * @param min
- * @param max
- */
- void updateBounds(float min, float max);
++ float getMin();
- void setGraduatedColour(boolean b);
+ /**
- * Returns the colour in Jalview features file format
++ * Returns the computed colour for the given sequence feature
+ *
++ * @param feature
+ * @return
+ */
- String toJalviewFormat(String featureType);
++ ColorI getColor(SequenceFeature feature);
}
public class FeatureRenderer extends
jalview.renderer.seqfeatures.FeatureRenderer
{
- /**
- * Creates a new FeatureRenderer object.
- *
- * @param av
- * DOCUMENT ME!
- */
- public FeatureRenderer(AlignmentViewport av)
- {
- super();
- this.av = av;
- }
-
+ // Holds web links for feature groups and feature types
+ // in the form label|link
+ Hashtable featureLinks = null;
- /**
- * Creates a new FeatureRenderer object.
- *
- * @param av
- */
- public FeatureRenderer(AlignmentViewport av)
- {
- super(av);
-
- }
-
static String lastFeatureAdded;
static String lastFeatureGroupAdded;
FeatureColourPanel colourPanel;
++ /**
++ * Creates a new FeatureRenderer object.
++ *
++ * @param av
++ */
++ public FeatureRenderer(AlignmentViewport av)
++ {
++ super(av);
++ }
++
class FeatureColourPanel extends Panel
{
String label = "";
public void paint(Graphics g)
{
Dimension d = getSize();
- if (col.isColourByLabel())
+ if (col != null)
{
- g.setColor(Color.white);
- g.fillRect(d.width / 2, 0, d.width / 2, d.height);
- /*
- * g.setColor(Color.black); Font f=g.getFont().deriveFont(9);
- * g.setFont(f);
- *
- * // g.setFont(g.getFont().deriveFont( //
- * AffineTransform.getScaleInstance( //
- * width/g.getFontMetrics().stringWidth("Label"), //
- * height/g.getFontMetrics().getHeight()))); g.drawString("Label",
- * width/2, 0);
- */
-
- }
- else if (col.isGraduatedColour())
- {
- Color maxCol = ColorUtils.getColor(col.getMaxColour());
- g.setColor(maxCol);
- g.fillRect(d.width / 2, 0, d.width / 2, d.height);
-
+ if (col.isColourByLabel())
+ {
+ g.setColor(Color.white);
+ g.fillRect(d.width / 2, 0, d.width / 2, d.height);
+ /*
+ * g.setColor(Color.black); Font f=g.getFont().deriveFont(9);
+ * g.setFont(f);
+ *
+ * // g.setFont(g.getFont().deriveFont( //
+ * AffineTransform.getScaleInstance( //
+ * width/g.getFontMetrics().stringWidth("Label"), //
+ * height/g.getFontMetrics().getHeight()))); g.drawString("Label",
+ * width/2, 0);
+ */
-
+ }
+ else if (col.isGraduatedColour())
+ {
- Color maxCol = col.getMaxColour();
++ Color maxCol = ColorUtils.getColor(col.getMaxColour());
+ g.setColor(maxCol);
+ g.fillRect(d.width / 2, 0, d.width / 2, d.height);
-
+ }
}
if (hasLink)
import jalview.datamodel.SearchResults;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
+ import jalview.renderer.ScaleRenderer;
+ import jalview.renderer.ScaleRenderer.ScaleMark;
+import jalview.util.ColorUtils;
import jalview.viewmodel.AlignmentViewport;
import java.awt.Color;
}
else
{
- acg = new FeatureColour(oldminColour = minColour.getBackground(),
- oldmaxColour = maxColour.getBackground(), min, max);
-
+ acg = new FeatureColour(new Colour(
+ oldminColour = minColour.getBackground()), new Colour(
+ oldmaxColour = maxColour.getBackground()), min, max);
-
}
if (!hasThreshold)
* update the amend feature button dependent on the given style
*
* @param bigPanel
+ * @param colour
* @param col
++<<<<<<< HEAD
++=======
+ * @param col
++>>>>>>> refs/heads/develop
*/
protected void updateColourButton(JPanel bigPanel, JLabel colour,
FeatureColourI col)
{
this.setText("");
this.setIcon(null);
- newColor = cellColour.getColour();
+ newColor = ColorUtils.getColor(cellColour.getColour());
setBackground(newColor);
- // comp.setToolTipText("RGB value: " + newColor.getRed() + ", "
- // + newColor.getGreen() + ", " + newColor.getBlue());
}
if (isSelected)
{
for (int i = 0; i < JSEQ.length; i++)
{
af.viewport.setSequenceColour(af.viewport.getAlignment()
- .getSequenceAt(i), new java.awt.Color(JSEQ[i].getColour()));
+ .getSequenceAt(i), new Colour(JSEQ[i].getColour()));
}
+ if (al.hasSeqrep())
+ {
+ af.getViewport().setColourByReferenceSeq(true);
+ af.getViewport().setDisplayReferenceSeq(true);
+ }
+
af.viewport.setGatherViewsHere(view.getGatheredViews());
if (view.getSequenceSetId() != null)
import jalview.datamodel.SearchResults;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
+ import jalview.renderer.ScaleRenderer;
+ import jalview.renderer.ScaleRenderer.ScaleMark;
+import jalview.util.ColorUtils;
import java.awt.BasicStroke;
import java.awt.BorderLayout;
}
@Override
- public Color getResidueBoxColour(SequenceI seq, int i)
+ public ColorI getResidueBoxColour(SequenceI seq, int i)
{
+ // rate limiting step when rendering overview for lots of groups
allGroups = av.getAlignment().findAllGroups(seq);
if (inCurrentSequenceGroup(i))
.getCodingComplement();
if (codingComplement != null)
{
- if (codingComplement != null)
+ SequenceGroup mappedGroup = MappingUtils.mapSequenceGroup(sg, av,
+ codingComplement);
+ if (mappedGroup.getSequences().size() > 0)
{
- SequenceGroup mappedGroup = MappingUtils.mapSequenceGroup(sg,
- av, codingComplement);
- if (mappedGroup.getSequences().size() > 0)
+ codingComplement.getAlignment().addGroup(mappedGroup);
+ for (SequenceI seq : mappedGroup.getSequences())
{
- codingComplement.getAlignment().addGroup(mappedGroup);
- for (SequenceI seq : mappedGroup.getSequences())
- {
- codingComplement.setSequenceColour(seq,
- new Colour(col.brighter()));
- }
- codingComplement.setSequenceColour(seq, col.brighter());
++ codingComplement.setSequenceColour(seq,
++ new Colour(col.brighter()));
}
}
}
// write feature colours only if we're given them and we are generating
// viewed features
// TODO: decide if feature links should also be written here ?
- Iterator<String> en = visible.keySet().iterator();
+ Iterator<String> en = featureColours.keySet().iterator();
- String featureType, color;
while (en.hasNext())
{
- featureType = en.next();
- FeatureColourI fc = featureColours.get(featureType);
- if (fc.isSimpleColour())
- {
- color = Format.getHexString(fc.getColour());
- }
- else
- {
- color = (fc.isColourByLabel() ? "label|" : "")
- + Format.getHexString(fc.getMinColour()) + "|"
- + Format.getHexString(fc.getMaxColour())
- + (fc.isAutoScaled() ? "|" : "|abso|") + fc.getMin() + "|"
- + fc.getMax() + "|";
- if (fc.isBelowThreshold())
- {
- color += "below";
- }
- else if (fc.isAboveThreshold())
- {
- color += "above";
- }
- // add the value
- color += "|" + fc.getThreshold();
- }
- // else
- // {
- // color += "none";
- // }
- // else
- // {
- // // legacy support for integer objects containing colour triplet
- // values
- // color = Format.getHexString(new Color(Integer
- // .parseInt(fc.toString())));
- // }
- out.append(featureType);
- out.append(TAB);
- out.append(color);
- out.append(newline);
- String featureType = en.next().toString();
- FeatureColourI colour = visible.get(featureType);
++ String featureType = en.next();
++ FeatureColourI colour = featureColours.get(featureType);
+ out.append(colour.toJalviewFormat(featureType)).append(newline);
}
}
+
// Work out which groups are both present and visible
List<String> groups = new ArrayList<String>();
int groupIndex = 0;
features = sequences[i].getSequenceFeatures();
if (features != null)
{
- for (int j = 0; j < features.length; j++)
+ for (SequenceFeature sequenceFeature : features)
{
- isnonpos = features[j].begin == 0 && features[j].end == 0;
+ isnonpos = sequenceFeature.begin == 0 && sequenceFeature.end == 0;
if ((!nonpos && isnonpos)
- || (!isnonpos && visOnly && !visible
+ || (!isnonpos && visOnly && !featureColours
- .containsKey(features[j].type)))
+ .containsKey(sequenceFeature.type)))
{
// skip if feature is nonpos and we ignore them or if we only
// output visible and it isn't non-pos and it's not visible
package jalview.io;
+import jalview.api.ColorI;
import jalview.api.FeatureColourI;
+import jalview.schemes.Colour;
- import jalview.schemes.FeatureColourAdapter;
+ import jalview.schemes.FeatureColour;
import jalview.schemes.FeatureSettingsAdapter;
-import java.awt.Color;
-
public class PDBFeatureSettings extends FeatureSettingsAdapter
{
*/
package jalview.renderer.seqfeatures;
+ import jalview.api.AlignViewportI;
+import jalview.api.ColorI;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
+import jalview.schemes.Colour;
import jalview.viewmodel.seqfeatures.FeatureRendererModel;
import java.awt.AlphaComposite;
}
/*
- * autoScaled == true: colours range over actual score range; autoScaled ==
- * false ('abso'): colours range over min/max range
- * autoScaled == true: colours range over actual score range
++ * autoScaled == true: colours range over actual score range;
+ * autoScaled == false ('abso'): colours range over min/max range
*/
- boolean autoScaled = false;
+ boolean autoScaled = true;
String tok = null, minval, maxval;
if (mincol != null)
{
return graduatedColour;
}
-- /**
-- * Sets the 'graduated colour' flag. If true, also sets 'colour by label' to
-- * false.
-- */
- @Override
- public void setGraduatedColour(boolean b)
- {
- graduatedColour = b;
- if (b)
- {
- setColourByLabel(false);
- }
- }
-
- void setGraduatedColour(boolean b)
- {
- graduatedColour = b;
- if (b)
- {
- setColourByLabel(false);
- }
- }
-
@Override
- public Color getColour()
+ public ColorI getColour()
{
return colour;
}
setGraduatedColour(false);
}
}
++
++ /**
++ * Sets the 'graduated colour' flag. If true, also sets 'colour by label' to
++ * false.
++ */
++ void setGraduatedColour(boolean b)
++ {
++ graduatedColour = b;
++ if (b)
++ {
++ setColourByLabel(false);
++ }
++ }
++
@Override
public boolean isBelowThreshold()
{
--- /dev/null
+package jalview.schemes;
+
+import jalview.api.ColorI;
+import jalview.api.FeatureColourI;
+import jalview.datamodel.SequenceFeature;
+
+/**
+ * A convenience class with implementations of FeatureColourI methods. Override
+ * methods as required in subclasses.
+ */
+public class FeatureColourAdapter implements FeatureColourI
+{
+ @Override
+ public boolean isGraduatedColour()
+ {
+ return isColourByLabel() || isAboveThreshold() || isBelowThreshold();
+ }
+
+ @Override
+ public ColorI getColour()
+ {
+ return Colour.black;
+ }
+
+ @Override
+ public ColorI getMinColour()
+ {
+ return Colour.white;
+ }
+
+ @Override
+ public ColorI getMaxColour()
+ {
+ return Colour.black;
+ }
+
+ @Override
+ public boolean isColourByLabel()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isBelowThreshold()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isAboveThreshold()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isThresholdMinMax()
+ {
+ return false;
+ }
+
+ @Override
+ public float getThreshold()
+ {
+ return 0f;
+ }
+
+ @Override
+ public float getMax()
+ {
+ return 0;
+ }
+
+ @Override
+ public float getMin()
+ {
+ return 0;
+ }
+
+ @Override
+ public boolean hasThreshold()
+ {
+ return false;
+ }
+
+ @Override
+ public ColorI getColor(SequenceFeature feature)
+ {
+ return null;
+ }
+
+ @Override
+ public boolean isColored(SequenceFeature feature)
+ {
+ return false;
+ }
+
+ @Override
+ public void updateBounds(float min, float max)
+ {
+ }
+
+ @Override
+ public String toJalviewFormat(String featureType)
+ {
+ return null;
+ }
+
+ @Override
+ public void setThreshold(float f)
+ {
+ }
+
+ @Override
+ public boolean isAutoScaled()
+ {
+ return false;
+ }
+
+ @Override
+ public void setAutoScaled(boolean b)
+ {
+ }
+
+ @Override
+ public boolean isSimpleColour()
+ {
+ return false;
+ }
+
+ @Override
+ public void setAboveThreshold(boolean b)
+ {
+ }
+
+ @Override
+ public void setThresholdMinMax(boolean b)
+ {
+ }
+
+ @Override
+ public void setBelowThreshold(boolean b)
+ {
+ }
+
+ @Override
+ public void setColourByLabel(boolean b)
+ {
+ }
+
- @Override
- public void setGraduatedColour(boolean b)
- {
- }
-
+}
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import jalview.renderer.seqfeatures.FeatureRenderer;
+import jalview.schemes.Colour;
import jalview.schemes.FeatureColour;
import jalview.schemes.UserColourScheme;
+import jalview.util.ColorUtils;
- import jalview.viewmodel.AlignmentViewport;
import java.awt.Color;
import java.beans.PropertyChangeListener;
protected PropertyChangeSupport changeSupport = new PropertyChangeSupport(
this);
- protected AlignmentViewport av;
+ protected AlignViewportI av;
+ /*
+ * map holds per feature type, {{min, max}, {min, max}} feature score
+ * values for positional and non-positional features respectively
+ */
+ private Map<String, float[][]> minmax = new Hashtable<String, float[][]>();
+
@Override
public AlignViewportI getViewport()
{
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
+import jalview.schemes.Colour;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.TaylorColourScheme;
- import jalview.structure.StructureViewSettings;
+ import jalview.structure.StructureImportSettings;
import java.awt.Color;
import java.util.Vector;
import jalview.datamodel.SequenceI;
import jalview.io.gff.SequenceOntologyFactory;
import jalview.io.gff.SequenceOntologyLite;
++import jalview.schemes.Colour;
import jalview.util.MapList;
--import java.awt.Color;
import java.util.List;
import org.testng.annotations.AfterClass;
assertTrue(fc.isFeatureDisplayed("sequence_variant"));
assertTrue(fc.isFeatureDisplayed("feature_variant")); // subtype
assertFalse(fc.isFeatureDisplayed("transcript"));
-- assertEquals(Color.RED, fc.getFeatureColour("sequence_variant")
++ assertEquals(Colour.red, fc.getFeatureColour("sequence_variant")
.getColour());
-- assertEquals(Color.RED, fc.getFeatureColour("feature_variant")
++ assertEquals(Colour.red, fc.getFeatureColour("feature_variant")
.getColour());
assertTrue(fc.getFeatureColour("exon").isColourByLabel());
assertTrue(fc.getFeatureColour("coding_exon").isColourByLabel());