1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
5
<title>The AnnotationSketch module</title>
6
<link rel="stylesheet" type="text/css" href="style.css">
11
<li><a href="index.html">Overview</a></li>
12
<li><a href="pub/">Download</a></li>
13
<li><a href="cgi-bin/gitweb.cgi?p=genometools.git;a=summary">Browse source</a></li>
14
<li><a href="mailman/listinfo/gt-users">Mailing list</a></li>
15
<li><a href="http://genometools.lighthouseapp.com/">Issue tracker</a></li>
16
<li><a href="design.html">Design</a></li>
17
<li><a href="libgenometools.html">C API</a></li>
18
<li><a href="docs.html"><tt>gtscript</tt> docs</a></li>
19
<li><a href="annotationsketch.html"><tt>AnnotationSketch</tt></a></li>
21
<li><a href="annotationsketch.html#collapsing">Collapsing</a></li>
22
<li><a href="annotationsketch.html#styles">Styles</a></li>
23
<li><a href="trackselectors.html">Track assignment</a></li>
24
<li><a href="customtracks.html">Custom tracks</a></li>
25
<li><a href="annotationsketch.html#gtsketch">The <tt>gt sketch</tt> tool</a></li>
26
<li><a id="current" href="examples.html">Code examples</a></li>
27
<li><a href="cgi-bin/annotationsketch_demo.cgi">Try it online</a></li>
28
<li><a href="libgenometools.html">API reference</a></li>
30
<li><a href="/cgi-bin/gff3validator.cgi">GFF3 validator</a></li>
31
<li><a href="license.html">License</a></li>
37
<h1><em>AnnotationSketch</em> code examples</h1>
39
<a name="examples-parsed"></a>
40
<h2>Using <em>AnnotationSketch</em> to draw annotations from a file</h2>
41
The following code examples (in C and Lua) illustrate how to produce an image from a given GFF3 file using <em>AnnotationSketch</em>. The result is shown in Fig. <a href="#fig7">7</a>. In essence, these code examples implement something like a simple version of the <tt>gt sketch</tt> tool from <em>GenomeTools</em> without most command-line options.
43
<p><a name="fig7"></a><img src="images/parsed.png" alt="[Example rendering from parsed GFF3 file]"></p>
44
<p><b>Figure 7: </b>Example rendering of a GFF3 file with default style.</p>
48
(See <a href="http://genometools.org/cgi-bin/gitweb.cgi?p=genometools.git;a=blob_plain;f=src/examples/sketch_parsed.c;hb=HEAD"><tt>src/examples/sketch_parsed.c</tt></a> in the source distribution.)
50
<!--#include file="src/examples/sketch_parsed.c"-->
54
(See <a href="http://genometools.org/cgi-bin/gitweb.cgi?p=genometools.git;a=blob_plain;f=gtscripts/sketch_parsed.lua;hb=HEAD"><tt>gtscripts/sketch_parsed.lua</tt></a> in the source distribution. This example can be run by the command line <tt>gt gtscripts/sketch_parsed.lua <style_file> <PNG_file> <GFF3_file></tt>)
56
<!--#include file="gtscripts/sketch_parsed.lua"-->
60
(See <a href="http://genometools.org/cgi-bin/gitweb.cgi?p=genometools.git;a=blob_plain;f=gtruby/sketch_parsed.rb;hb=HEAD"><tt>gtruby/sketch_parsed.rb</tt></a> in the source distribution.)
62
<!--#include file="gtruby/sketch_parsed.rb"-->
66
(See <a href="http://genometools.org/cgi-bin/gitweb.cgi?p=genometools.git;a=blob_plain;f=gtpython/sketch_parsed.py;hb=HEAD"><tt>gtpython/sketch_parsed.py</tt></a> in the source distribution.)
68
<!--#include file="gtpython/sketch_parsed.py"-->
72
<a name="examples-generated"></a>
73
<h2>Using <em>AnnotationSketch</em> to draw user-generated annotations</h2>
74
The following C code example illustrates how to produce an image from annotation graphs created by user code.
75
The result is shown in Fig. <a href="#fig8">8</a>.
77
<p><a name="fig8"></a><img src="images/constructed.png" alt="[Example rendering from user-generated annotations]"></p>
78
<p><b>Figure 8: </b>Example rendering of user-generated annotations with default style.</p>
82
(See <a href="http://genometools.org/cgi-bin/gitweb.cgi?p=genometools.git;a=blob_plain;f=src/examples/sketch_constructed.c;hb=HEAD"><tt>src/examples/sketch_constructed.c</tt></a> in the source distribution.)
84
<!--#include file="src/examples/sketch_constructed.c"-->
88
(See <a href="http://genometools.org/cgi-bin/gitweb.cgi?p=genometools.git;a=blob_plain;f=gtscripts/sketch_constructed.lua;hb=HEAD"><tt>gtscripts/sketch_constructed.lua</tt></a> in the source distribution. This example can be run by the command line <tt>gt gtscripts/sketch_constructed.lua <style_file> <PNG_file></tt>)
90
<!--#include file="gtscripts/sketch_constructed.lua"-->
94
(See <a href="http://genometools.org/cgi-bin/gitweb.cgi?p=genometools.git;a=blob_plain;f=gtruby/sketch_constructed.rb;hb=HEAD"><tt>gtruby/sketch_constructed.rb</tt></a> in the source distribution.)
96
<!--#include file="gtruby/sketch_constructed.rb"-->
100
(See <a href="http://genometools.org/cgi-bin/gitweb.cgi?p=genometools.git;a=blob_plain;f=gtpython/sketch_constructed.py;hb=HEAD"><tt>gtpython/sketch_constructed.py</tt></a> in the source distribution.)
102
<!--#include file="gtpython/sketch_constructed.py"-->
106
Copyright © 2007-2011 Sascha Steinbiss. Last update: 2011-02-11
110
<script type="text/javascript">
111
var pkBaseURL = (("https:" == document.location.protocol) ? "https://gremme.org/piwik/" : "http://gremme.org/piwik/");
112
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
113
</script><script type="text/javascript">
115
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 5);
116
piwikTracker.trackPageView();
117
piwikTracker.enableLinkTracking();
119
</script><noscript><p><img src="http://gremme.org/piwik/piwik.php?idsite=5" style="border:0" alt="" /></p></noscript>
120
<!-- End Piwik Tracking Tag -->