Debian Codegraph @

api_examples/CgviewTest0.java

raw symbols SCIP
1 import ca.ualberta.stothard.cgview.*;
2 import java.io.*;
3
4 public class CgviewTest0 implements CgviewConstants {
5
6 public static void main( String args[] ) {
7
8 int length = 9000;
9 Cgview cgview = new Cgview(length);
10
11 //some optional settings
12 cgview.setWidth(600);
13 cgview.setHeight(600);
14 cgview.setBackboneRadius(160.0f);
15 cgview.setTitle("Example");
16 cgview.setLabelPlacementQuality(10);
17 cgview.setShowWarning(true);
18 cgview.setLabelLineLength(8.0d);
19 cgview.setLabelLineThickness(0.5f);
20
21 //create a FeatureSlot to hold sequence features
22 FeatureSlot featureSlot = new FeatureSlot(cgview, DIRECT_STRAND);
23
24 //create random sequence features
25 for (int i = 1; i <= 100; i = i + 1) {
26
27 int j = Math.round((float)((float)(length - 2) * Math.random())) + 1;
28
29 //a Feature to add to our FeatureSlot
30 Feature feature = new Feature(featureSlot, "label");
31
32 //a single FeatureRange to add the Feature
33 FeatureRange featureRange = new FeatureRange (feature, j, j + 1);
34 featureRange.setDecoration(DECORATION_CLOCKWISE_ARROW);
35
36 }
37
38 try {
39 //create a PNG file
40 CgviewIO.writeToPNGFile(cgview, "random_1.png");
41 }
42 catch (IOException e) {
43 e.printStackTrace(System.err);
44 System.exit(1);
45 }
46 }
47 }