Package ca.ualberta.stothard.cgview
Class Plasmid
java.lang.Object
ca.ualberta.stothard.cgview.Plasmid
- All Implemented Interfaces:
CgviewConstants
-
Field Summary
Fields inherited from interface ca.ualberta.stothard.cgview.CgviewConstants
BASES, BOUNDS_BUTTON, BOUNDS_FEATURE, BOUNDS_RULER, CENTISOMES, DECORATION_CLOCKWISE_ARROW, DECORATION_COUNTERCLOCKWISE_ARROW, DECORATION_HIDDEN, DECORATION_STANDARD, DIRECT_STRAND, INNER_LABELS_AUTO, INNER_LABELS_NO_SHOW, INNER_LABELS_SHOW, LABEL, LABEL_FORCE, LABEL_NONE, LABEL_ZOOMED, LEGEND_DRAW_ZOOMED, LEGEND_ITEM_ALIGN_CENTER, LEGEND_ITEM_ALIGN_LEFT, LEGEND_ITEM_ALIGN_RIGHT, LEGEND_LOWER_CENTER, LEGEND_LOWER_LEFT, LEGEND_LOWER_RIGHT, LEGEND_MIDDLE_CENTER, LEGEND_MIDDLE_LEFT, LEGEND_MIDDLE_LEFT_OF_CENTER, LEGEND_MIDDLE_RIGHT, LEGEND_MIDDLE_RIGHT_OF_CENTER, LEGEND_NO_DRAW_ZOOMED, LEGEND_UPPER_CENTER, LEGEND_UPPER_LEFT, LEGEND_UPPER_RIGHT, POSITIONS_AUTO, POSITIONS_NO_SHOW, POSITIONS_SHOW, REVERSE_STRAND, SWATCH_NO_SHOW, SWATCH_SHOW
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addFeature
(String type, String name, int start, int stop, int strand) Add a feature to this map.int
Returns the height of this map.int
Returns the width of this map.static void
void
setAddCategoryInfo
(boolean show) Sets whether a category is added to certain labels to provide more information.void
setBackboneThickness
(String width) Sets the thickness of the arc used to draw the backbone.void
setColorScheme
(int colorScheme) Sets whether the overall color scheme.void
setDrawTickMarks
(boolean draw) Sets whether tick marks are drawn.void
setFeatureThickness
(String width) Sets the thickness of the arc used to draw features.void
setImageHeight
(int height) Sets the height of this map.void
setImageWidth
(int width) Sets the width of this map.void
setLegendPosition
(String position) Sets the legend position.void
setMessage
(String message) Sets the map message.void
setShowBorder
(boolean showBorder) Sets whether this map is drawn with a border.void
setShowInnerLabels
(boolean useInnerLabels) Sets whether labels are allowed to be drawn on the inside of the plasmid.void
setShowLabels
(boolean show) Sets whether labels are drawn on this map.void
setShowLegend
(boolean show) Sets whether a legend is drawn on this map.void
setShowMessage
(boolean show) Sets whether a message is drawn on this map.void
setShowShading
(boolean showShading) Sets whether items on the map are drawn with shading.void
setShowTitle
(boolean show) Sets whether a title is drawn on this map.void
Sets the title of of the map.void
setUseArrows
(boolean show) Sets whether arrows are drawn on this map (true) or just arcs (false).void
setUseColoredLabelBackground
(boolean show) Sets whether labels are drawn with a colored box surrounding them.void
setUseColoredLabels
(boolean show) Sets whether labels are drawn using color (true), or just black and white (false).void
writeToJPGFile
(String filename) Writes this map to a JPG file.void
writeToPNGFile
(String filename) Writes this map to a PNG file.void
writeToSVGFile
(String filename) Writes this map to an SVG file.void
writeToSVGFile
(String filename, boolean embedFonts, boolean useCompression) Writes this map to an SVG file.void
writeToSVGZFile
(String filename) Writes this map to an SVGZ file (a zipped SVG file).
-
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
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
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
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
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
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
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
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
Writes this map to a PNG file.- Parameters:
filename
- the path and name of the file to create.- Throws:
IOException
-
writeToJPGFile
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
-