GView API Examples - phac-nml/gview-wiki GitHub Wiki
Example 1
This example shows how to render a Genbank file and how to display the result in an interactive frame (using Piccolo 2D). For more information on how to read in sequences, see the BioJava Cookbook.
public class apiexample1
{
private static MapStyle buildStyle(){ } // code not shown
public static void main(String[] args)
{
try
{
// read in genome data
GViewFileData fileData = GViewFileReader.read("example_data/NC_007622.gbk");
GenomeData data = fileData.getGenomeData();
MapStyle style = buildStyle(); // creates style, buildStyle() code not shown
LayoutFactory layoutFactory = new LayoutFactoryLinear();
GViewMap gViewMap = GViewMapFactory.createMap(data, style, layoutFactory);
// builds a frame which can be used to display/navigate around on the map
GUIManager.getInstance().buildGUIFrame("GView", gViewMap);
}
catch (IOException e)
{
e.printStackTrace();
}
catch (GViewDataParseException e)
{
e.printStackTrace();
}
}
}