CGView - Circular Genome Viewer
CGView Application
CGView Application
The CGView application requires Java 1.5 or higher. Depending on your computing platform you may have to download the latest version of Java from Sun. Once you have installed Java, you can download and run the CGView application:
  1. Download the cgview.zip archive and extract it. A directory called cgview will be created.
  2. To test CGView, switch to the cgview directory. Try the following command, which generates a PNG image of the map described in the cybercell.xml file: java -jar cgview.jar -i cybercell.xml -o cybercell.png -f png.
  3. To generate your own maps, create or obtain an input file for CGView. Three formats can be used: the CGView XML format; the simple tab delimited format; or the NCBI ptt format. The input file must end with an extension that tells CGView the format of the input file (.xml for CGView XML files, .tab for the applet tab delimited format, or .ptt for the NCBI ptt format). The best way to create CGView maps is to use the Perl script included with the application download (cgview_xml_builder.pl). This script can automatically generate a CGView XML file for a variety of sequence formats, including FASTA, GenBank or EMBL. It can create the XML to display a variety of sequence composition plots, gene expression data, COG information, BLAST results, and more. See the README in the cgview_xml_builder directory for additional information.
  4. Once you have an input file, run CGView using the command line options described below.
Main CGView command line options
Option Required? Value What does it do? Example
-c No Base to center zoomed map on When drawing a zoomed map this option is used to position the map canvas over the sequence. For example, a value of 100 centers the canvas on base 100 in the sequence. The default value for the -c option is 1. java -jar cgview.jar -i cybercell.xml -o cybercell.png -f png -z 100 -c 100
-f No Output image format: png, jpg, svg, or svgz Specifies the format of the output image. Default value is png. java -jar cgview.jar -i cybercell.xml -o cybercell.jpg -f jpg
-h No HTML file to create Specifies that an HTML file should be created to accompany the image file. The HTML file is needed for PNG and JPG maps that contain hyperlinks or mouseovers, as these are provided using image maps. java -jar cgview.jar -i cybercell.xml -o cybercell.png -f png -h cybercell.html
-i Yes Input file to parse Specifies which file should serve as the input to CGView. The file extension should match the input type (.xml for CGView XML files, .tab for the applet tab delimited format, or .ptt for the NCBI ptt format). java -jar cgview.jar -i features.tab -o map.png
-o Yes (unless -s option is used) Output image file to create Specifies the output image file to create. The format of the image is determined by the -f option, NOT by the extension of the output file. java -jar cgview.jar -i features.tab -o map.png
-s No Directory to contain series of linked images Specifies that a series of linked images should be created and written to the supplied directory. The values for -c, -f, -h, -o, -p, -u, and -z are ignored. java -jar cgview.jar -i features.xml -s image_series
-z No Zoom amount Determines the zoom level of the map. Default value is 1. java -jar cgview.jar -i features.xml -o map.png -f png -z 10000
Advanced CGView command line options
Option Required? Value What does it do? Example
-A No Label font size Specifies the label font size to use. This value overrides CGView's default label font size and label font size values specified in XML input. java -jar cgview.jar -i cybercell.xml -f png -o map.png -A 12
-d No Tick mark density Adjusts the density of tick marks. A real number between 0 and 1 can be supplied, with 1 being the default value. Smaller values produce fewer tick marks. This value overrides CGView's default tick mark density and the tick mark density value specified in XML input. java -jar cgview.jar -i cybercell.xml -f png -o map.png -d 0.5
-D No Legend font size Specifies the legend font size to use. This value overrides CGView's default legend font size and legend font size values specified in XML input. java -jar cgview.jar -i cybercell.xml -f png -o map.png -D 40
-e No T or F When drawing an image series, this option allows you to exclude the SVG output. By default this value is set to F, which specifies that the image series should consist of a combination of SVG and PNG output. java -jar cgview.jar -i cybercell.xml -s my_series -e T
-E No T or F When creating SVG or SVGZ output, this option allows you to specify whether or not text should be embedded as drawings. By default this value is set to T. java -jar cgview.jar -i cybercell.xml -f svg -o output.svg -E F
-H No Map height Specifies the height of the map. This value overrides the height value in the input file. java -jar cgview.jar -i cybercell.xml -f png -o map.png -H 1000
-I No T or F Specifies whether or not labels should be drawn on the inside of the backbone circle. Default is to draw inner labels when a zoomed map is drawn. This value overrides the value specified in the input file. java -jar cgview.jar -i cybercell.xml -f png -o map.png -I T
-L No External legend width in pixels When generating a series of linked images, you may want the legend to be separate from the map images, particularly if the legend contains many items. An external legend also allows you to customize the legend using logos or graphics. To generate a series of linked images with a separate legend image shown adjacent to the map, use the -L option to specify the width of the separate legend image. Once the linked map series has been generated, place a file called legend.png in the includes directory that is generated inside the output directory. When the map is rendered, the legend.png image is placed to the right of the map. This option can also be used when a single HTML file is generated using the -h option. In this case the HTML will expect a file called legend.png in the same directory as the HTML file. java -jar cgview.jar -i cybercell.xml -s my_series -e T -L 300
-p No Path to map image in HTML Specifies the path to appear in the image tag when a single HTML file is generated using the -h option. By default the path is set to the value of the -o option. java -jar cgview.jar -i cybercell.xml -o cybercell.png -f png -h cybercell.html -p /maps/images/cybercell.png
-r No T or F Specifies whether or not legends should be hidden. Default value is F. java -jar cgview.jar -i cybercell.xml -o cybercell.png -f png -r T
-R No T or F Specifies whether or not labels should be hidden. Default value is F. java -jar cgview.jar -i cybercell.xml -o cybercell.png -f png -R T
-u No T or F Specifies whether or not to include calls to the overlib.js JavaScript library when generating an image series using the -s option. The overlib.js library provides mouseover labels for png and jpg image maps. This option can also be used when a single HTML file is generated using the -h option. In this case the HTML will expect a file called overlib.js in an includes directory (overlib.js is available in the CGView includes directory). Default value is T. java -jar cgview.jar -i cybercell.xml -s image_series -u F
-U No Ruler font size Specifies the ruler font size to use. This value overrides CGView's default ruler font size and ruler font size values specified in XML input. java -jar cgview.jar -i cybercell.xml -f png -o map.png -U 8
-W No Map width Specifies the width of the map. This value overrides the width value in the input file. java -jar cgview.jar -i cybercell.xml -f png -o map.png -W 1000
-x No Image series zoom values Specifies the zoom values to be used when generating a series of linked maps using the -s option. The zoom values are supplied as a comma separated list, starting with the number 1. The default value is 1,6,36. java -jar cgview.jar -i cybercell.xml -f png -s linked_series -x 1,6,36,216

Tips:

  • If you obtain an Out of Memory error when drawing a very large map, try increasing the memory available to Java using the -Xmx option. For example, use the command java -jar -Xmx500m cgview.jar -i cybercell.xml -o cybercell.png -f png
  • When creating an XML file to generate a series of linked maps, specify globalLabel="auto" in the cgview element for best results. See the cybercell.xml file as an example.
Running CGView from a Perl CGI script:

#These values are system dependent my $pathToJava = "/usr/java/j2sdk1.4.2_02/bin/java"; my $pathToCGView = "/some/path/to/cgview/cgview.jar"; my $input = "/some/path/to/cgview/cybercell.xml"; my $format = "png"; my $output = "/some/path/to/cgview/cybercell.png"; my $verbose = 0; my $cgviewCommand = "java -Djava.awt.headless=true -jar $pathToCGView -i $input -f $format -o $output"; if (!($verbose)) { $cgviewCommand = $cgviewCommand . " 1>/dev/null 2>/dev/null"; } my $result = system($cgviewCommand); #$result will be 0 on success if ($result != 0) { die "CGView failed with command $cgviewCommand.\n"; } else { print "CGView completed successfully.\n"; }

Running CGView from a Java program:

See the CGView API.

Citing CGView:
  • Stothard P, Wishart DS. Circular genome visualization and exploration using CGView. Bioinformatics 21:537-539.
Valid XHTML 1.0!Valid CSS!