Class FeatureSlot

java.lang.Object
ca.ualberta.stothard.cgview.FeatureSlot
All Implemented Interfaces:
CgviewConstants

public class FeatureSlot extends Object implements CgviewConstants
Represents a slot of space on the Cgview map. When the map is drawn, the FeatureSlot objects form concentric rings around the backbone circle. Individual features, which are described using Feature objects, are drawn in the FeatureSlot objects. FeatureSlot objects are allocated space in the order that they are added to the Cgview object, such that those added first receive space closest to the backbone circle.
Author:
Paul Stothard
  • Constructor Details

    • FeatureSlot

      public FeatureSlot(Cgview cgview, int strand)
      Constructs a new FeatureSlot object.
      Parameters:
      cgview - the Cgview object to contain this FeatureSlot.
      strand - the strand of this FeatureSlot, CgviewConstants.DIRECT_STRAND or CgviewConstants.REVERSE_STRAND. If strand is set to DIRECT_STRAND this FeatureSlot is placed on the outside of the backbone circle. If strand is set to REVERSE_STRAND this FeatureSlot is placed on the inside of the backbone circle.
    • FeatureSlot

      public FeatureSlot(int strand)
      Constructs a new FeatureSlot object. It can be added to a Cgview object using the setCgview() method.
      Parameters:
      strand - the strand of this FeatureSlot, CgviewConstants.DIRECT_STRAND or CgviewConstants.REVERSE_STRAND. If strand is set to DIRECT_STRAND this FeatureSlot is placed on the outside of the backbone circle. If strand is set to REVERSE_STRAND this FeatureSlot is placed on the inside of the backbone circle.
    • FeatureSlot

      public FeatureSlot(int strand, boolean showShading)
      Constructs a new FeatureSlot object. It can be added to a cgview object using the setCgview() method.
      Parameters:
      strand - the strand of this featureSlot, CgviewConstants.DIRECT_STRAND or CgviewConstants.REVERSE_STRAND. If strand is set to DIRECT_STRAND this FeatureSlot is placed on the outside of the backbone circle. If strand is set to REVERSE_STRAND this FeatureSlot is placed on the inside of the backbone circle.
      showShading - whether or not items this FeatureSlot should be drawn with shading.
  • Method Details

    • setCgview

      public void setCgview(Cgview cgview)
      Adds this FeatureSlot to a Cgview object.
      Parameters:
      cgview - the Cgview object to contain this FeatureSlot.
    • addFeature

      protected void addFeature(Feature feature)
      Adds a Feature object to this FeatureSlot.
      Parameters:
      feature - the Feature to add to this FeatureSlot.
    • getStrand

      public int getStrand()
      Returns the strand of this FeatureSlot.
      Returns:
      an int representing the strand of this FeatureSlot.
    • setMinimumFeatureLength

      public void setMinimumFeatureLength(double length)
      Sets the minimum feature length to use when drawing sequence features. Features smaller than this setting are artificially increased in length, to make them more visible.
      Parameters:
      length - the minimum feature length.
    • getMinimumFeatureLength

      public double getMinimumFeatureLength()
      Returns the minimum feature length to use when drawing sequence features. Features smaller than this setting are artificially increased in length, to make them more visible.
      Returns:
      the minimum feature length.
    • setFeatureThickness

      public void setFeatureThickness(float featureThickness)
      Sets the thickness of the arc used to represent sequence features in this FeatureSlot.
      Parameters:
      featureThickness - the feature thickness.
    • getFeatureThickness

      public float getFeatureThickness()
      Returns the thickness of the arc used to represent sequence features in this FeatureSlot.
      Returns:
      the feature thickness.
    • setShowShading

      public void setShowShading(boolean showShading)
      Sets whether or not items in this FeatureSlot should be drawn with shading.
      Parameters:
      showShading - whether or not items this FeatureSlot should be drawn with shading.
    • getShowShading

      public boolean getShowShading()
      Returns whether or not items in this FeatureSlot should be drawn with shading.
      Returns:
      whether or not items in this featureSlot should be drawn with shading.
    • setRadius

      protected void setRadius()
      Sets the radius of this FeatureSlot.
    • getBasesPerMinFeature

      public double getBasesPerMinFeature(double zoom)
      Returns the minimum feature length in bases that can be drawn accurately in this FeatureSlot, at the given zoom value. Feature lengths smaller than this length are automatically drawn larger so that they are visible. This method should be used when deciding on the appropriate window size (length of bases) to use when calculating a value to present on the map. For example, if you plan to display percent GC content on the map, and this method returns 98.0003, you should choose a window size of 99 or greater when calculating percent GC. In other words, you would create a Feature object containing a FeatureRange object spanning bases 1 to 99, a second FeatureRange spanning bases 100 to 199, and so on. Each FeatureRange would be decorated in some way to convey the %GC value calculated for the segment of bases it contains (using FeatureRange.setProportionOfThickness(float) for example).
      Parameters:
      zoom - the zoom value to be used when drawing the Cgview map.
    • draw

      protected void draw()
      Draws the contents of this FeatureSlot.
    • isRoom

      public boolean isRoom(Feature feature)
      Returns a boolean specifying whether or not the supplied Feature object can fit in this FeatureSlot without overlapping with Feature objects already present in this FeatureSlot.
      Parameters:
      feature - the Feature to check.
      Returns:
      whether or not the Feature object can fit without overlapping with other Feature objects.
    • sortFeaturesByStart

      public void sortFeaturesByStart()
      Sorts the features in this FeatureSlot by start base. If this is a DIRECT_STRAND slot the features are sorted in ascending order. If this is a REVERSE_STRAND slot the features are sorted in descending order. This sorting produces a more visually pleasing feature appearance when arrows are used.