Class Plasmid

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

public class Plasmid extends Object implements CgviewConstants
  • Constructor Details

    • Plasmid

      public Plasmid(int size)
      Create a new Plasmid. Note that a constructor accepting a title and length is also available.
      Parameters:
      size - the size of the plasmid in base pairs.
    • Plasmid

      public Plasmid(String title, int size)
      Create a new Plasmid. Note that supplying a title does not ensure that the title will be shown. Use the setShowTitle() method to force the title to be drawn.
      Parameters:
      title - the title of the plasmid.
      size - the size of the plasmid in base pairs.
  • Method Details

    • addFeature

      public void addFeature(String type, String name, int start, int stop, int strand)
      Add a feature to this map. Note that the start of the feature should be a smaller number than the stop of the feature, regardless of the strand. The only case where start is larger than the stop is when the feature runs across the start/stop boundary, for example 6899-10 on a 7000bp plasmid.
      Parameters:
      type - one of the following: origin_of_replication, promoter, terminator, selectable_marker, regulatory_sequence, tag, other_gene, reporter_gene, unique_restriction_site, restriction_site.
      name - the name of the feature, such as EcoRI.
      start - the start position of the feature. Must be between 1 and the length of the plasmid.
      stop - the end position of the feature. Must be between 1 and the length of the plasmid.
      strand - the strand of the feature. Can be Plasmid.FORWARD, Plasmid.REVERSE, or Plasmid.NO_DIRECTION.
    • setTitle

      public void setTitle(String title)
      Sets the title of of the map. This title is drawn in the center of the backbone circle. Use setShowTitle() to set whether the title is shown.
      Parameters:
      title - the title of the map.
    • setMessage

      public void setMessage(String message)
      Sets the map message. This message is drawn in the lower right of the map. Use setShowMessage() to set whether the message is shown.
      Parameters:
      message - the map message.
    • setShowLegend

      public void setShowLegend(boolean show)
      Sets whether a legend is drawn on this map.
      Parameters:
      show - whether a legend is drawn on this map.
    • setShowTitle

      public void setShowTitle(boolean show)
      Sets whether a title is drawn on this map. Use the setTitle method to specify the title, or use the Plasmid constructor that accepts a title.
      Parameters:
      show - whether to draw a title on this map.
    • setShowMessage

      public void setShowMessage(boolean show)
      Sets whether a message is drawn on this map. Use the setMessage method to specify the message.
      Parameters:
      show - whether to draw a title on this map.
    • setShowLabels

      public void setShowLabels(boolean show)
      Sets whether labels are drawn on this map.
      Parameters:
      show - whether labels are drawn on this map.
    • setAddCategoryInfo

      public void setAddCategoryInfo(boolean show)
      Sets whether a category is added to certain labels to provide more information. For example, a label like "T7" might become "T7 prom" if this is set to true.
      Parameters:
      show - whether extra info is added to certain labels to provide more information.
    • setUseArrows

      public void setUseArrows(boolean show)
      Sets whether arrows are drawn on this map (true) or just arcs (false).
      Parameters:
      show - whether labels are drawn in color, or just black and white.
    • setUseColoredLabels

      public void setUseColoredLabels(boolean show)
      Sets whether labels are drawn using color (true), or just black and white (false).
      Parameters:
      show - whether labels are drawn in color, or just black and white.
    • setUseColoredLabelBackground

      public void setUseColoredLabelBackground(boolean show)
      Sets whether labels are drawn with a colored box surrounding them.
      Parameters:
      show - whether labels are drawn with a colored box surrounding them.
    • setColorScheme

      public void setColorScheme(int colorScheme)
      Sets whether the overall color scheme. Plasmid.REGULAR is a white background with dark labels, while Plasmid.INVERSE is a black background with light labels.
      Parameters:
      colorScheme - Plasmid.REGULAR or Plasmid.INVERSE.
    • setDrawTickMarks

      public void setDrawTickMarks(boolean draw)
      Sets whether tick marks are drawn.
      Parameters:
      draw - whether tick marks are drawn.
    • setShowShading

      public void setShowShading(boolean showShading)
      Sets whether items on the map are drawn with shading.
      Parameters:
      showShading - whether items on the map are draw with shading.
    • setShowBorder

      public void setShowBorder(boolean showBorder)
      Sets whether this map is drawn with a border.
      Parameters:
      showBorder - whether this map is surrounded with a border.
    • setLegendPosition

      public void setLegendPosition(String position)
      Sets the legend position.
      Parameters:
      position - the position: "upper_right", "upper_left", or "none". Specifying "none" calls the showLegend() method automatically.
    • setShowInnerLabels

      public void setShowInnerLabels(boolean useInnerLabels)
      Sets whether labels are allowed to be drawn on the inside of the plasmid.
      Parameters:
      useInnerLabels - whether labels are allowed to be drawn on the inside of the plasmid.
    • setBackboneThickness

      public void setBackboneThickness(String width)
      Sets the thickness of the arc used to draw the backbone.
      Parameters:
      width - "xxx-small", "xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large".
    • setFeatureThickness

      public void setFeatureThickness(String width)
      Sets the thickness of the arc used to draw features.
      Parameters:
      width - "xxx-small", "xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large".
    • setImageWidth

      public void setImageWidth(int width)
      Sets the width of this map.
      Parameters:
      width - the width of the map.
    • getImageWidth

      public int getImageWidth()
      Returns the width of this map.
      Returns:
      the width of the map.
    • setImageHeight

      public void setImageHeight(int height)
      Sets the height of this map.
      Parameters:
      height - the height of the map.
    • getImageHeight

      public int getImageHeight()
      Returns the height of this map.
      Returns:
      the height of the map.
    • writeToPNGFile

      public void writeToPNGFile(String filename) throws IOException
      Writes this map to a PNG file.
      Parameters:
      filename - the path and name of the file to create.
      Throws:
      IOException
    • writeToJPGFile

      public void writeToJPGFile(String filename) throws IOException
      Writes this map to a JPG file.
      Parameters:
      filename - the path and name of the file to create.
      Throws:
      IOException
    • writeToSVGFile

      public void writeToSVGFile(String filename, boolean embedFonts, boolean useCompression) throws FileNotFoundException, IOException, UnsupportedEncodingException, org.apache.batik.svggen.SVGGraphics2DIOException
      Writes this map to an SVG file. You may use the simpler methods provided below, instead of this method.
      Parameters:
      filename - the path and name of the file to create.
      embedFonts - whether to embed fonts. Embedded fonts give a nicer map but yield larger file sizes.
      useCompression - whether to write this as an SVGZ file.
      Throws:
      FileNotFoundException
      IOException
      UnsupportedEncodingException
      org.apache.batik.svggen.SVGGraphics2DIOException
    • writeToSVGFile

      public void writeToSVGFile(String filename) throws FileNotFoundException, IOException, UnsupportedEncodingException, org.apache.batik.svggen.SVGGraphics2DIOException
      Writes this map to an SVG file. No compression is used, and fonts are embedded.
      Parameters:
      filename - the path and name of the file to create.
      Throws:
      FileNotFoundException
      IOException
      UnsupportedEncodingException
      org.apache.batik.svggen.SVGGraphics2DIOException
    • writeToSVGZFile

      public void writeToSVGZFile(String filename) throws FileNotFoundException, IOException, UnsupportedEncodingException, org.apache.batik.svggen.SVGGraphics2DIOException
      Writes this map to an SVGZ file (a zipped SVG file).
      Parameters:
      filename - the path and name of the file to create.
      Throws:
      FileNotFoundException
      IOException
      UnsupportedEncodingException
      org.apache.batik.svggen.SVGGraphics2DIOException
    • main

      public static void main(String[] ars)