GenomeTools C API
This document describes the GenomeTools C API (that is, all public interfaces which are part of libgenometools).
See the index for an alphabetical list of all available interfaces.
Classes
- GtAlphabet
- GtArray
- GtBEDInStream
- GtBittab
- GtBlock
- GtCanvas
- GtCanvasCairoContext
- GtCanvasCairoFile
- GtColor
- GtCommentNode
- GtCstrTable
- GtCustomTrack
- GtCustomTrackGcContent
- GtCustomTrackScriptWrapper
- GtDiagram
- GtDlist
- GtDlistelem
- GtEncseq
- GtEncseqBuilder
- GtEncseqEncoder
- GtEncseqLoader
- GtEncseqReader
- GtError
- GtFeatureIndex
- GtFeatureIndexMemory
- GtFeatureNode
- GtFeatureNodeIterator
- GtFile
- GtGFF3InStream
- GtGFF3OutStream
- GtGTFInStream
- GtGenomeNode
- GtGraphics
- GtHashmap
- GtImageInfo
- GtIntervalTree
- GtIntervalTreeNode
- GtLayout
- GtLogger
- GtNodeStream
- GtNodeStreamClass
- GtPhase
- GtProgressTimer
- GtRange
- GtRecMap
- GtRegionNode
- GtSequenceNode
- GtSplitter
- GtStr
- GtStrArray
- GtStrand
- GtStyle
- GtTextWidthCalculator
- GtTextWidthCalculatorCairo
- GtTimer
- GtTranslator
Modules
- Array2dim
- Assert
- Bsearch
- Countingsort
- Cstr
- Endianess
- Fileutils
- FunctionPointer
- Grep
- Log
- MemoryAllocation
- Msort
- POSIX
- Parseutils
- Qsort
- Unused
- Version
- Warning
- XANSI
Sole functions
void gt_lib_init(void)
Initialize this GenomeTools instance. This has to be called before the library is used!
void gt_lib_reg_atexit_func(void)
registers exit function which calls gt_lib_clean()
int gt_lib_clean(void)
returns 0 if no memory map, file pointer, or memory has been leaked and a value != 0 otherwise
const char* gt_readmode_show(GtReadmode readmode)
Returns the descriptive string for the readmode readmode.
int gt_readmode_parse(const char *string, GtError *err)
Returns the GtReadmode for the description string, which must be one
of "fwd","rev","cpl" or "rcl". If string does not equal any of them,
-1 is returned and err is set accordingly.
Class GtAlphabet
The following type is for storing alphabets.
GtAlphabet* gt_alphabet_new(bool isdna,
bool isprotein,
const GtStr *smapfile,
const GtStrArray *filenametab,
GtError *err)
Returns a new GtAlphabet object as described by the following parameters:
A DNA alphabet (see gt_alphabet_new_dna()) is created if isdna is set.
Analogously, an amino acid alphabet (see gt_alphabet_new_protein()) is
created if isprotein is set to true. If both are false, the alphabet will
be read from the file given in smapfile. If smapfile is empty, then the
sequence files in filenametab will be scanned to determine whether they
are DNA or protein sequences, and the appropriate alphabet will be used
(see gt_alphabet_guess()).
Returns NULL on error, see err for details.
GtAlphabet* gt_alphabet_new_dna(void)
Return a GtAlphabet object which represents a DNA alphabet.
GtAlphabet* gt_alphabet_new_protein(void)
Return a GtAlphabet object which represents a protein alphabet.
GtAlphabet* gt_alphabet_new_empty(void)
Return an empty GtAlphabet object.
GtAlphabet* gt_alphabet_new_from_file(const char *indexname, GtError *err)
Return a GtAlphabet object, as read from an .al1 file specified by
indexname (i.e. no al1 suffix necessary).
GtAlphabet* gt_alphabet_guess(const char *sequence, unsigned long seqlen)
Try to guess which type the given sequence with length has (DNA or
protein) and return an according GtAlphabet* object.
GtAlphabet* gt_alphabet_clone(const GtAlphabet *alphabet)
Return a clone of alphabet.
GtAlphabet* gt_alphabet_ref(GtAlphabet *alphabet)
Increase the reference count for alphabet and return it.
void gt_alphabet_delete(GtAlphabet *alphabet)
Decrease the reference count for alphabet or delete it, if this was the
last reference.
void gt_alphabet_add_mapping(GtAlphabet *alphabet,
const char *characters)
Add the mapping of all given characters to the given alphabet. The first
character is the result of subsequent gt_alphabet_decode() calls.
void gt_alphabet_add_wildcard(GtAlphabet *alphabet, char wildcard)
Add wildcard to the alphabet.
const GtUchar* gt_alphabet_symbolmap(const GtAlphabet *alphabet)
Returns the array of symbols from alphabet such that the index of the
character equals its encoding.
unsigned int gt_alphabet_num_of_chars(const GtAlphabet *alphabet)
Returns number of characters in alphabet (excluding wildcards).
unsigned int gt_alphabet_size(const GtAlphabet *alphabet)
Returns number of characters in alphabet (including wildcards).
const GtUchar* gt_alphabet_characters(const GtAlphabet *alphabet)
Returns an array of the characters in alphabet.
GtUchar gt_alphabet_wildcard_show(const GtAlphabet *alphabet)
Returns the character used in alphabet to represent wildcards in output.
unsigned int gt_alphabet_bits_per_symbol(const GtAlphabet *alphabet)
Returns the required number of bits required to represent a symbol
in alphabet.
void gt_alphabet_output(const GtAlphabet *alphabet, FILE *fpout)
Writes a representation of alphabet to the file pointer fpout.
int gt_alphabet_to_file(const GtAlphabet *alpha,
const char *indexname,
GtError *err)
Writes a representation of alphabet to the .al1 output file as specified
by indexname (i.e. without the .al1 suffix).
GtUchar gt_alphabet_pretty_symbol(const GtAlphabet *alphabet,
unsigned int currentchar)
Returns the printable character specified in alphabet for currentchar.
void gt_alphabet_echo_pretty_symbol(const GtAlphabet *alphabet,
FILE *fpout,
GtUchar currentchar)
Prints the printable character specified in alphabet for currentchar on
fpout.
bool gt_alphabet_is_protein(const GtAlphabet *alphabet)
The following method checks if the given alphabet is the protein
alphabet with the aminoacids A, C, D, E, F, G, H, I, K, L, M, N, P, Q, R, S,
T, V, W, Y written in lower or upper case and returns true, if this is the
case (false otherwise).
bool gt_alphabet_is_dna(const GtAlphabet *alphabet)
The following method checks if the given alphabet is the DNA alphabet with
the bases A, C, G, T written in lower or upper case and returns true, if
this is the case (false otherwise).
bool gt_alphabet_valid_input(const GtAlphabet *alphabet, char c)
Returns true if the character c is defined in alphabet.
GtUchar gt_alphabet_encode(const GtAlphabet *alphabet, char c)
Encode character c with given alphabet.
Ensure that c is encodable with the given alphabet!
char gt_alphabet_decode(const GtAlphabet *alphabet, GtUchar c)
Decode character c with given alphabet.
void gt_alphabet_encode_seq(const GtAlphabet *alphabet, GtUchar *out,
const char *in, unsigned long length)
Encode sequence in of given length with alphabet and store the result
in out. in has to be encodable with the given alphabet!
void gt_alphabet_decode_seq_to_fp(const GtAlphabet *alphabet,
FILE *fpout,
const GtUchar *src,
unsigned long wlen)
Suppose the string src of length wlen was transformed according to the
alphabet. The following method shows each character in w as the
printable character specified in the transformation. The output is written
to the given file pointer fpout.
void gt_alphabet_decode_seq_to_cstr(const GtAlphabet *alphabet,
char *dest,
const GtUchar *src,
unsigned long wlen)
Analog to gt_alphabet_decode_seq_to_fp() but writing the output to
dest.
GtStr* gt_alphabet_decode_seq_to_str(const GtAlphabet *alphabet,
const GtUchar *src,
unsigned long wlen)
Analog to gt_alphabet_decode_seq_to_fp() writing the output to
a new GtStr.
Class GtArray
GtArray* objects are generic arrays for elements of a certain size which
grow on demand.
GtArray* gt_array_new(size_t size_of_elem)
Return a new GtArray* object whose elements have the size
size_of_elem.
GtArray* gt_array_ref(GtArray *array)
Increase the reference count for array and return it.
If array is NULL, NULL is returned without any side effects.
GtArray* gt_array_clone(const GtArray *array)
Return a clone of array.
void* gt_array_get(const GtArray *array, unsigned long index)
Return pointer to element number index of array. index has to be
smaller than gt_array_size(array).
void* gt_array_get_first(const GtArray *array)
Return pointer to first element of array.
void* gt_array_get_last(const GtArray *array)
Return pointer to last element of array.
void* gt_array_pop(GtArray *array)
Return pointer to last element of array and remove it from array.
void* gt_array_get_space(const GtArray *array)
Return pointer to the internal space of array where the elements are
stored.
#define gt_array_add(array, elem)
Add element elem to array. The size of elem must equal the given
element size when the array was created and is determined automatically
with the sizeof operator.
void gt_array_add_elem(GtArray *array, void *elem,
size_t size_of_elem)
Add element elem with size size_of_elem to array. size_of_elem must
equal the given element size when the array was created. Usually, this
method is not used directly and the macro gt_array_add() is used
instead.
void gt_array_add_array(GtArray *dest, const GtArray *src)
Add all elements of array src to the array dest. The element sizes of
both arrays must be equal.
void gt_array_rem(GtArray *array, unsigned long index)
Remove element with number index from array in O(gt_array_size(array))
time. index has to be smaller than gt_array_size(array).
void gt_array_rem_span(GtArray *array, unsigned long frompos,
unsigned long topos)
Remove elements starting with number frompos up to (and including) topos
from array in O(gt_array_size(array)) time. frompos has to be smaller
or equal than topos and both have to be smaller than
gt_array_size(array).
void gt_array_reverse(GtArray *array)
Reverse the order of the elements in array.
void gt_array_set_size(GtArray *array, unsigned long size)
Set the size of array to size. size must be smaller or equal than
gt_array_size(array).
void gt_array_reset(GtArray *array)
Reset the array. That is, afterwards the array has size 0.
size_t gt_array_elem_size(const GtArray *array)
Return the size of the elements stored in array.
unsigned long gt_array_size(const GtArray *array)
Return the number of elements in array. If array equals NULL, 0 is
returned.
void gt_array_sort(GtArray *array, GtCompare compar)
Sort array with the given compare function compar.
void gt_array_sort_stable(GtArray *array, GtCompare compar)
Sort array in a stable way with the given compare function compar.
void gt_array_sort_with_data(GtArray *array,
GtCompareWithData compar,
void *data)
Sort array with the given compare function compar. Passes a pointer to
userdata at data.
void gt_array_sort_stable_with_data(GtArray *array,
GtCompareWithData compar,
void *data)
Sort array in a stable way with the given compare function compar. Passes
a pointer to userdata at data.
int gt_array_cmp(const GtArray *array_a, const GtArray *array_b)
Compare the content of array_a with the content of array_b.
array_a and array_b must have the same gt_array_size() and
gt_array_elem_size().
void gt_array_delete(GtArray *array)
Decrease the reference count for array or delete it, if this was the last
reference.
Class GtBEDInStream
Implements the GtNodeStream interface.
GtNodeStream* gt_bed_in_stream_new(const char *filename)
Create a GtBEDInStream* which subsequently reads the BED file with the
given filename. If filename equals NULL, the BED data is read from
stdin.
void gt_bed_in_stream_set_feature_type(GtBEDInStream *bed_in_stream,
const char *type)
Create BED features parsed by bed_in_stream with given type (instead of
the default "BED_feature").
void gt_bed_in_stream_set_thick_feature_type(GtBEDInStream
*bed_in_stream,
const char *type)
Create thick BED features parsed by bed_in_stream with given type
(instead of the default "BED_thick_feature").
void gt_bed_in_stream_set_block_type(GtBEDInStream *bed_in_stream,
const char *type)
Create BED blocks parsed by bed_in_stream with given type (instead of
the default "BED_block").
Class GtBittab
Implements arbitrary-length bit arrays and various operations on them.
GtBittab* gt_bittab_new(unsigned long num_of_bits)
Creates a new GtBittab of length num_of_bits, initialised to 0
void gt_bittab_set_bit(GtBittab *b, unsigned long i)
Sets bit i in b to 1.
void gt_bittab_unset_bit(GtBittab *b, unsigned long i)
Sets bit i in b to 0.
void gt_bittab_complement(GtBittab *a, const GtBittab *b)
Sets a to be the complement of b.
void gt_bittab_equal(GtBittab *a, const GtBittab *b)
Sets a to be equal to b.
void gt_bittab_and(GtBittab *a, const GtBittab *b, const GtBittab *c)
Sets a to be the bitwise AND of b and c.
void gt_bittab_or(GtBittab *a, const GtBittab *b, const GtBittab *c)
Sets a to be the bitwise OR of b and c.
void gt_bittab_nand(GtBittab *a, const GtBittab *b, const GtBittab *c)
Sets a to be b NAND c.
void gt_bittab_and_equal(GtBittab *a, const GtBittab *b)
Sets a to be the bitwise AND of a and b.
void gt_bittab_or_equal(GtBittab *a, const GtBittab *b)
Sets a to be the bitwise OR of a and b.
void gt_bittab_shift_left_equal(GtBittab *b)
Shifts b by one position to the left.
void gt_bittab_shift_right_equal(GtBittab *b)
Shifts b by one position to the right.
void gt_bittab_unset(GtBittab *b)
Sets all bits in b to 0.
void gt_bittab_show(const GtBittab *b, FILE *fp)
Outputs a representation of b to fp.
void gt_bittab_get_all_bitnums(const GtBittab *b, GtArray *a)
Fills a with the indices of all set bits in b.
bool gt_bittab_bit_is_set(const GtBittab *b, unsigned long i)
Returns TRUE if bit i is set in b.
bool gt_bittab_cmp(const GtBittab *a, const GtBittab *b)
Returns TRUE if bittabs a and b are identical.
unsigned long gt_bittab_get_first_bitnum(const GtBittab *b)
Returns the index of the first set bit in b.
unsigned long gt_bittab_get_last_bitnum(const GtBittab *b)
Returns the index of the last set bit in b.
unsigned long gt_bittab_get_next_bitnum(const GtBittab *b, unsigned long i)
Returns the index of the next set bit in b with an index greater
than i.
unsigned long gt_bittab_count_set_bits(const GtBittab *b)
Returns the number of set bits in b.
unsigned long gt_bittab_size(GtBittab *b)
Returns the total number of bits of b.
void gt_bittab_delete(GtBittab *b)
Deletes b and frees all allocated space.
Class GtBlock
The GtBlock class represents a portion of screen space which relates to
a specific ``top-level'' feature (and maybe its collapsed child features).
It is the smallest layoutable unit in AnnotationSketch and has a caption
(which may be displayed above the block rendering).
GtBlock* gt_block_new(void)
Creates a new GtBlock object.
GtBlock* gt_block_ref(GtBlock*)
Increases the reference count.
GtBlock* gt_block_new_from_node(GtFeatureNode *node)
Create a new GtBlock object, setting block parameters (such as strand,
range) from a given node template.
GtRange gt_block_get_range(const GtBlock*)
Returns the base range of the GtBlock's top level element.
GtRange* gt_block_get_range_ptr(const GtBlock *block)
Returns a pointer to the base range of the GtBlock's top level element.
bool gt_block_has_only_one_fullsize_element(const GtBlock*)
Checks whether a GtBlock is occupied completely by a single element.
void gt_block_merge(GtBlock*, GtBlock*)
Merges the contents of two GtBlocks into the first one.
GtBlock* gt_block_clone(GtBlock*)
Returns an independent copy of a GtBlock.
void gt_block_set_caption_visibility(GtBlock*, bool)
Set whether a block caption should be displayed or not.
bool gt_block_caption_is_visible(const GtBlock*)
Returns whether a block caption should be displayed or not.
void gt_block_set_caption(GtBlock*, GtStr *caption)
Sets the GtBlock's caption to caption.
GtStr* gt_block_get_caption(const GtBlock*)
Returns the GtBlock's caption.
void gt_block_set_strand(GtBlock*, GtStrand strand)
Sets the GtBlock's strand to strand.
GtStrand gt_block_get_strand(const GtBlock*)
Returns the GtBlock's strand.
GtFeatureNode* gt_block_get_top_level_feature(const GtBlock*)
Returns the GtBlock's top level feature as a GtFeatureNode object.
unsigned long gt_block_get_size(const GtBlock*)
Returns the number of elements in the GtBlock.
void gt_block_delete(GtBlock*)
Deletes a GtBlock.
Class GtCanvas
This class is an abstraction of a stateful drawing surface. Constructors must be implemented in subclasses as different arguments are required for drawing to specific graphics back-ends.
unsigned long gt_canvas_get_height(GtCanvas *canvas)
Returns the height of the given canvas.
void gt_canvas_delete(GtCanvas *canvas)
Delete the given canvas.
Class GtCanvasCairoContext
Implements the GtCanvas interface using a Cairo context (cairo_t)
as input. This Canvas uses the GtGraphicsCairo class.
Drawing to a cairo_t allows the use of the AnnotationSketch engine
in any Cairo-based graphical application.
GtCanvas* gt_canvas_cairo_context_new(GtStyle *style, cairo_t *context,
double offsetpos,
unsigned long width,
unsigned long height,
GtImageInfo *image_info)
Create a new Canvas object tied to the cairo_t context, width and
height using the style given in style. The optional image_info is
filled when the created Canvas object is used to render a Diagram object.
offsetpos determines where to start drawing on the surface.
Class GtCanvasCairoFile
Implements the GtCanvas interface.
This Canvas uses the GtGraphicsCairo class.
GtCanvas* gt_canvas_cairo_file_new(GtStyle *style,
GtGraphicsOutType output_type,
unsigned long width,
unsigned long height,
GtImageInfo *image_info)
Create a new GtCanvasCairoFile object with given output_type and
width using the configuration given in style. The optional image_info
is filled when the created object is used to render a GtDiagram object.
Possible GtGraphicsOutType values are GRAPHICS_PNG, GRAPHICS_PS,
GRAPHICS_PDF and GRAPHICS_SVG. Dependent on the local Cairo installation,
not all of them may be available.
int gt_canvas_cairo_file_to_file(GtCanvasCairoFile *canvas,
const char *filename, GtError *err)
Write rendered canvas to the file with name filename. If this
method returns a value other than 0, check err for an error message.
int gt_canvas_cairo_file_to_stream(GtCanvasCairoFile *canvas,
GtStr *stream)
Append rendered canvas image data to given stream.
Class GtColor
The GtColor class holds a RGB color definition.
GtColor* gt_color_new(double red, double green, double blue, double alpha)
Create a new GtColor object with the color given by the red, green,
and blue arguments. The value for each color channel must be between 0
and 1.
void gt_color_set(GtColor *color, double red, double green, double blue,
double alpha)
Change the color of the color object to the color given by the red,
green, and blue arguments. The value for each color channel must be
between 0 and 1.
bool gt_color_equals(const GtColor *c1, const GtColor *c2)
Returns true if the colors c1 and c2 are equal.
void gt_color_delete(GtColor *color)
Delete the color object.
Class GtCommentNode
Implements the GtGenomeNode interface. Comment nodes correspond to comment
lines in GFF3 files (i.e., lines which start with a single #).
GtGenomeNode* gt_comment_node_new(const char *comment)
Create a new GtCommentNode* representing a comment. Please note that the
single leading # which denotes comment lines in GFF3 files should not be
part of comment.
const char* gt_comment_node_get_comment(const GtCommentNode
*comment_node)
Return the comment stored in comment_node.
Class GtCstrTable
Implements a table of C-strings.
void gt_cstr_table_delete(GtCstrTable *table)
Deletes table.
void gt_cstr_table_add(GtCstrTable *table, const char *cstr)
Add cstr to table.
const char* gt_cstr_table_get(const GtCstrTable *table, const char *cstr)
If a C-string equal to cstr is contained in table, it is returned.
Otherwise NULL is returned.
GtStrArray* gt_cstr_table_get_all(const GtCstrTable *table)
Return a GtStrArray* which contains all cstrs added to table in
alphabetical order. The caller is responsible to free it!
Class GtCustomTrack
The GtCustomTrack interface allows the GtCanvas to call user-defined
drawing functions on a GtGraphics object. Please refer to the specific
implementations' documentation for more information on a particular
custom track.
GtCustomTrack* gt_custom_track_ref(GtCustomTrack *ctrack)
Increase the reference count for ctrack.
void gt_custom_track_delete(GtCustomTrack *ctrack)
Delete the given ctrack.
Class GtCustomTrackGcContent
Implements the GtCustomTrack interface. This custom track draws a plot of
the GC content of a given sequence in the displayed range. As a window
size for GC content calculation, windowsize is used.
GtCustomTrack* gt_custom_track_gc_content_new(const char *seq,
unsigned long seqlen,
unsigned long windowsize,
unsigned long height,
double avg,
bool show_scale)
Creates a new GtCustomTrackGcContent for sequence seq with length
seqlen of height height with windowsize windowsize.
A horizontal line is drawn for the percentage value avg,
with avg between 0 and 1. If show_scale is set to true, then a vertical
scale rule is drawn at the left end of the curve.
Class GtCustomTrackScriptWrapper
Implements the GtCustomTrack interface. This custom track is
only used to store pointers to external callbacks, e.g. written in a
scripting language. This class does not store any state, relying on the
developer of the external custom track class to do so.
GtCustomTrack* gt_custom_track_script_wrapper_new(GtCtScriptRenderFunc
render_func,
GtCtScriptGetHeightFunc
get_height_func,
GtCtScriptGetTitleFunc
get_title_func,
GtCtScriptFreeFunc
free_func)
Creates a new GtCustomTrackScriptWrapper object.
Class GtDiagram
The GtDiagram class acts as a representation of a sequence annotation
diagram independent of any output format. Besides annotation features as
annotation graphs, it can contain one or more custom tracks. A individual
graphical representation of the GtDiagram contents is created by creating a
GtLayout object using the GtDiagram and then calling
gt_layout_sketch() with an appropriate GtCanvas object.
GtDiagram* gt_diagram_new(GtFeatureIndex *feature_index, const char *seqid,
const GtRange *range, GtStyle *style, GtError*)
Create a new GtDiagram object representing the feature nodes in
feature_index in region seqid overlapping with range. The GtStyle
object style will be used to determine collapsing options during the
layout process.
GtDiagram* gt_diagram_new_from_array(GtArray *features, const GtRange *range,
GtStyle *style)
Create a new GtDiagram object representing the feature nodes in
features. The features must overlap with range. The GtStyle
object style will be used to determine collapsing options during the
layout process.
GtRange gt_diagram_get_range(const GtDiagram *diagram)
Returns the sequence position range represented by the diagram.
void gt_diagram_set_track_selector_func(GtDiagram*, GtTrackSelectorFunc,
void*)
Assigns a GtTrackSelectorFunc to use to assign blocks to tracks. If none is set, or set to NULL, then track types are used as track keys (default behaviour).
void gt_diagram_reset_track_selector_func(GtDiagram *diagram)
Resets the track selection behaviour of this GtDiagram back to the
default.
void gt_diagram_add_custom_track(GtDiagram*, GtCustomTrack*)
Registers a new custom track in the diagram.
void gt_diagram_delete(GtDiagram*)
Delete the diagram and all its components.
Class GtDlist
A double-linked list which is sorted according to a GtCompare compare
function (qsort(3)-like, only if one was supplied to the constructor).
GtDlist* gt_dlist_new(GtCompare)
Creates a new GtDlist sorted according to the GtCompare function. If it
is NULL, no sorting is enforced.
GtDlistelem* gt_dlist_first(const GtDlist*)
Returns the first GtDlistelem in a GtDlist.
GtDlistelem* gt_dlist_last(const GtDlist*)
Returns the last GtDlistelem in a GtDlist.
GtDlistelem* gt_dlist_find(const GtDlist*, void *data)
Returns the first GtDlistelem in a GtDlist which contains data identical
to data. Takes O(n) time.
unsigned long gt_dlist_size(const GtDlist*)
Returns the number of GtDlistelems in a GtDlist.
void gt_dlist_add(GtDlist*, void *data)
Adds a new GtDlistelem containing data to a GtDlist. Usually O(n), but
O(1) if data is added in sorted order.
void gt_dlist_remove(GtDlist *dlist, GtDlistelem *dlistelem)
Remove dlistelem from dlist and free it.
int gt_dlist_example(GtError*)
Example for usage of the GtDlist class.
void gt_dlist_delete(GtDlist*)
Deletes a GtDlist.
Class GtDlistelem
GtDlistelem* gt_dlistelem_next(const GtDlistelem*)
Returns the successor of a GtDlistelem, or NULL if the element is the last
one in the GtDlist.
GtDlistelem* gt_dlistelem_previous(const GtDlistelem*)
Returns the predecessor of a GtDlistelem, or NULL if the element is the
first one in the GtDlist.
void* gt_dlistelem_get_data(const GtDlistelem*)
Returns the data pointer attached to a GtDlistelem.
Class GtEncseq
The GtEncseq class represents a concatenated collection of sequences from
one or more input files in a compressed encoding.
unsigned long gt_encseq_total_length(const GtEncseq *encseq)
Returns the total number of characters in all sequences of encseq,
not including separators.
unsigned long gt_encseq_num_of_sequences(const GtEncseq *encseq)
Returns the total number of sequences contained in encseq.
GtUchar gt_encseq_get_encoded_char(const GtEncseq *encseq,
unsigned long pos,
GtReadmode readmode)
Returns the encoded representation of the character at position pos of
encseq read in the direction as indicated by readmode.
GtEncseq* gt_encseq_ref(GtEncseq *encseq)
Increases the reference count of encseq.
GtEncseqReader* gt_encseq_create_reader_with_direction(const GtEncseq *encseq,
bool moveforward,
unsigned long startpos)
Returns a new GtEncseqReader for encseq, starting from position
startpos. If moveforward is true, the iterator will move forward in the
sequence, if false, it will move backwards.
GtEncseqReader* gt_encseq_create_reader_with_readmode(const GtEncseq *encseq,
GtReadmode readmode,
unsigned long startpos)
Returns a new GtEncseqReader for encseq, starting from position
startpos. Also supports reading the sequence from the reverse and
delivering (reverse) complement characters on DNA alphabets using the
readmode option. Please make sure that the GT_READMODE_COMPL and
GT_READMODE_REVCOMPL readmodes are only used on DNA alphabets.
void gt_encseq_extract_substring(const GtEncseq *encseq,
GtUchar *buffer,
unsigned long frompos,
unsigned long topos)
Returns the encoded representation of the substring from position frompos
to position topos of encseq. The result is written to the location
pointed to by buffer, which must be large enough to hold the result.
void gt_encseq_extract_decoded(const GtEncseq *encseq,
char *buffer,
unsigned long frompos,
unsigned long topos)
Returns the decoded version of the substring from position frompos
to position topos of encseq. The result is written to the location
pointed to by buffer, which must be large enough to hold the result.
unsigned long gt_encseq_seqlength(const GtEncseq *encseq,
unsigned long seqnum)
Returns the length of the seqnum-th sequence in the encseq.
unsigned long gt_encseq_seqstartpos(const GtEncseq *encseq,
unsigned long seqnum)
Returns the start position of the seqnum-th sequence in the encseq.
unsigned long gt_encseq_seqnum(const GtEncseq *encseq,
unsigned long position)
Returns the sequence number from the given position for a given
GtEncseq encseq.
const char* gt_encseq_description(const GtEncseq *encseq,
unsigned long *desclen,
unsigned long seqnum)
Returns a pointer to the description of the seqnum-th sequence in the
encseq. The length of the returned string is written to the
location pointed at by desclen.
The returned description pointer is not \0-terminated!
GtAlphabet* gt_encseq_alphabet(const GtEncseq *encseq)
Returns the GtAlphabet associated with encseq.
const GtStrArray* gt_encseq_filenames(const GtEncseq *encseq)
Returns a GtStrArray of the names of the original sequence files
contained in encseq.
void gt_encseq_delete(GtEncseq *encseq)
Deletes encseq and frees all associated space.
Class GtEncseqBuilder
The GtEncseqBuilder class creates GtEncseq objects by constructing
uncompressed, encoded string copies in memory.
GtEncseqBuilder* gt_encseq_builder_new(GtAlphabet *alpha)
Creates a new GtEncseqBuilder using the alphabet alpha as a basis for
on-the-fly encoding of sequences in memory.
void gt_encseq_builder_enable_range_iterator(GtEncseqBuilder *eb)
Enables support for faster access to special ranges in the
GtEncseq created by eb. Enabled by default.
void gt_encseq_builder_disable_range_iterator(GtEncseqBuilder *eb)
Disables support for faster access to special ranges in the
GtEncseq created by eb.
void gt_encseq_builder_enable_description_support(
GtEncseqBuilder *eb)
Enables support for retrieving descriptions from the encoded sequence
to be built by eb. Requires additional memory to hold the descriptions and
a position index.
Activated by default.
void gt_encseq_builder_disable_description_support(
GtEncseqBuilder *eb)
Disables support for retrieving descriptions from the encoded sequence
to be built by eb. Disabling this support will result in an error when
trying to call the method gt_encseq_description() on the
GtEncseq object created by eb.
void gt_encseq_builder_enable_multiseq_support(GtEncseqBuilder *eb)
Enables support for random access to multiple sequences in the encoded
sequence to be built by eb. Requires additional memory for an index of
starting positions. Activated by default.
void gt_encseq_builder_disable_multiseq_support(
GtEncseqBuilder *eb)
Disables support for random access to multiple sequences in the encoded
sequence to be built by eb. Disabling this support will result in an
error when trying to call the method gt_encseq_seqinfo() on
the GtEncseq object created by eb
void gt_encseq_builder_create_tis_tab(GtEncseqBuilder *eb)
Enables creation of the .esq table containing the encoded sequence itself. Naturally, enabled by default.
void gt_encseq_builder_do_not_create_tis_tab(GtEncseqBuilder *eb)
Disables creation of the .esq table.
void gt_encseq_builder_create_des_tab(GtEncseqBuilder *eb)
Enables creation of the .des table containing sequence descriptions. Not enabled by default.
void gt_encseq_builder_do_not_create_des_tab(GtEncseqBuilder *eb)
Disables creation of the .des table.
void gt_encseq_builder_create_ssp_tab(GtEncseqBuilder *eb)
Enables creation of the .ssp table containing indexes for multiple sequences. Not enabled by default.
void gt_encseq_builder_do_not_create_ssp_tab(GtEncseqBuilder *eb)
Disables creation of the .ssp table.
void gt_encseq_builder_create_sds_tab(GtEncseqBuilder *eb)
Enables creation of the .sds table containing indexes for sequence descriptions. Not enabled by default.
void gt_encseq_builder_do_not_create_sds_tab(GtEncseqBuilder *eb)
Disables creation of the .sds table.
void gt_encseq_builder_add_cstr(GtEncseqBuilder *eb,
const char *str,
unsigned long strlen,
const char *desc)
Adds a sequence given as a C string str of length strlen to the
encoded sequence to be built by eb. Additionally, a description can be
given (desc). If description support is enabled, this must not be NULL.
A copy will be made during the addition process and the sequence will
be encoded using the alphabet set at the construction time of eb. Thus it
must only contain symbols compatible with the alphabet.
void gt_encseq_builder_add_str(GtEncseqBuilder *eb, GtStr *str,
const char *desc)
Adds a sequence given as a GtStr str to the encoded sequence to be built
by eb. Additionally, a description can be given. If description support
is enabled, desc must not be NULL.
A copy will be made during the addition process and the sequence will
be encoded using the alphabet set at the construction time of eb. Thus it
must only contain symbols compatible with the alphabet.
void gt_encseq_builder_add_encoded(GtEncseqBuilder *eb,
const GtUchar *str,
unsigned long strlen,
const char *desc)
Adds a sequence given as a pre-encoded string str of length strlen to
the encoded sequence to be built by eb. str must be encoded using the
alphabet set at the construction time of eb.
Does not take ownership of str.
Additionally, a description desc can be given. If description support
is enabled, this must not be NULL.
void gt_encseq_builder_set_logger(GtEncseqBuilder*, GtLogger *l)
Sets the logger to use by ee during encoding to l. Default is NULL (no
logging).
GtEncseq* gt_encseq_builder_build(GtEncseqBuilder *eb, GtError *err)
Creates a new GtEncseq from the sequences added to eb.
Returns a GtEncseq instance on success, or NULL on error.
If an error occurred, err is set accordingly.
The state of eb is reset to empty after successful creation of a new
GtEncseq (like having called gt_encseq_builder_reset()).
void gt_encseq_builder_reset(GtEncseqBuilder *eb)
Clears all added sequences and descriptions, resetting eb to a state
similar to the state immediately after its initial creation.
void gt_encseq_builder_delete(GtEncseqBuilder *eb)
Deletes eb.
Class GtEncseqEncoder
The GtEncseqEncoder class creates objects encapsulating a parameter
set for conversion from sequence files into encoded sequence files on
secondary storage.
GtEncseqEncoder* gt_encseq_encoder_new(void)
Creates a new GtEncseqEncoder.
void gt_encseq_encoder_set_progresstimer(GtEncseqEncoder *ee,
GtProgressTimer *pt)
Sets pt to be the progress timer for ee. Default is NULL (no progress
reporting).
int gt_encseq_encoder_use_representation(GtEncseqEncoder *ee,
GtStr *sat,
GtError *err)
Sets the representation of ee to sat which must be one of 'direct',
'bytecompress', 'bit', 'uchar', 'ushort' or 'uint32'. Returns 0 on success,
and a negative value on error (err is set accordingly).
int gt_encseq_encoder_use_symbolmap_file(GtEncseqEncoder *ee,
GtStr *smap,
GtError *err)
Sets the symbol map file to use in ee to smap which must a valid
alphabet description file. Returns 0 on success, and a negative value on
error (err is set accordingly). Default is NULL (no alphabet
transformation).
void gt_encseq_encoder_set_logger(GtEncseqEncoder *ee,
GtLogger *l)
Sets the logger to use by ee during encoding to l. Default is NULL (no
logging).
void gt_encseq_encoder_enable_description_support(
GtEncseqEncoder *ee)
Enables support for retrieving descriptions from the encoded sequence
encoded by ee. That is, the .des and .sds tables are created.
This is a prerequisite for being able to activate description support in
gt_encseq_loader_require_description_support(). Activated by default.
void gt_encseq_encoder_disable_description_support(
GtEncseqEncoder *ee)
Disables support for retrieving descriptions from the encoded sequence
encoded by ee. That is, the .des and .sds tables are not created.
Encoded sequences created without this support will not be able to be
loaded via a GtEncseqLoader with
gt_encseq_loader_require_description_support() enabled.
void gt_encseq_encoder_enable_multiseq_support(GtEncseqEncoder *ee)
Enables support for random access to multiple sequences in the encoded
sequence encoded by ee. That is, the .ssp table is created.
This is a prerequisite for being able to activate description support in
gt_encseq_loader_require_multiseq_support(). Activated by default.
void gt_encseq_encoder_disable_multiseq_support(
GtEncseqEncoder *ee)
Disables support for random access to multiple sequences in the encoded
sequence encoded by ee. That is, the .ssp table is not created.
Encoded sequences created without this support will not be able to be
loaded via a GtEncseqLoader with
gt_encseq_loader_require_multiseq_support() enabled.
void gt_encseq_encoder_create_tis_tab(GtEncseqEncoder *ee)
Enables creation of the .esq table containing the encoded sequence itself. Naturally, enabled by default.
void gt_encseq_encoder_do_not_create_tis_tab(GtEncseqEncoder *ee)
Disables creation of the .esq table.
void gt_encseq_encoder_create_des_tab(GtEncseqEncoder *ee)
Enables creation of the .des table containing sequence descriptions. Enabled by default.
void gt_encseq_encoder_do_not_create_des_tab(GtEncseqEncoder *ee)
Disables creation of the .des table.
void gt_encseq_encoder_create_ssp_tab(GtEncseqEncoder *ee)
Enables creation of the .ssp table containing indexes for multiple sequences. Enabled by default.
void gt_encseq_encoder_do_not_create_ssp_tab(GtEncseqEncoder *ee)
Disables creation of the .ssp table.
void gt_encseq_encoder_create_sds_tab(GtEncseqEncoder *ee)
Enables creation of the .sds table containing indexes for sequence descriptions. Enabled by default.
void gt_encseq_encoder_do_not_create_sds_tab(GtEncseqEncoder *ee)
Disables creation of the .sds table.
void gt_encseq_encoder_set_input_dna(GtEncseqEncoder *ee)
Sets the sequence input type for ee to DNA.
void gt_encseq_encoder_set_input_protein(GtEncseqEncoder *ee)
Sets the sequence input type for ee to protein/amino acids.
int gt_encseq_encoder_encode(GtEncseqEncoder *ee,
GtStrArray *seqfiles,
const char *indexname,
GtError *err)
Encodes the sequence files given in seqfiles using the settings in ee
and indexname as the prefix for the index tables. Returns 0 on success, or
a negative value on error (err is set accordingly).
void gt_encseq_encoder_delete(GtEncseqEncoder *ee)
Deletes ee.
Class GtEncseqLoader
The GtEncseqLoader class creates GtEncseq objects by mapping index files
from secondary storage into memory.
GtEncseqLoader* gt_encseq_loader_new(void)
Creates a new GtEncseqLoader.
void gt_encseq_loader_require_description_support(
GtEncseqLoader *el)
Enables support for retrieving descriptions from the encoded sequence
to be loaded by el. That is, the .des and .sds tables must be present.
For example, these tables are created by having enabled the
gt_encseq_encoder_enable_description_support() option when encoding.
Activated by default.
void gt_encseq_loader_drop_description_support(GtEncseqLoader *el)
Disables support for retrieving descriptions from the encoded sequence
to be loaded by el. That is, the .des and .sds tables need not be present.
However, disabling this support will result in an error when trying to call
the method gt_encseq_description() on the GtEncseq
object created by el.
void gt_encseq_loader_require_multiseq_support(GtEncseqLoader *el)
Enables support for random access to multiple sequences in the encoded
sequence to be loaded by el. That is, the .ssp table must be present.
For example, this table is created by having enabled the
gt_encseq_encoder_enable_multiseq_support() option when encoding.
Activated by default.
void gt_encseq_loader_drop_multiseq_support(GtEncseqLoader *el)
Disables support for random access to multiple sequences in the encoded
sequence to be loaded by el. That is, the .ssp table needs not be present.
However, disabling this support will result in an error when trying to call
the method gt_encseq_seqinfo() on the GtEncseq
object created by el.
void gt_encseq_loader_require_tis_tab(GtEncseqLoader *el)
Requires presence of the .esq table containing the encoded sequence itself. Naturally, enabled by default.
void gt_encseq_loader_do_not_require_tis_tab(GtEncseqLoader *el)
Disables requirement of the .esq table for loading a GtEncseq
using el.
void gt_encseq_loader_require_des_tab(GtEncseqLoader *el)
Requires presence of the .des table containing sequence descriptions. Enabled by default.
void gt_encseq_loader_do_not_require_des_tab(GtEncseqLoader *el)
Disables requirement of the .des table for loading a GtEncseq
using el.
void gt_encseq_loader_require_ssp_tab(GtEncseqLoader *el)
Requires presence of the .ssp table containing indexes for multiple sequences. Enabled by default.
void gt_encseq_loader_do_not_require_ssp_tab(GtEncseqLoader *el)
Disables requirement of the .ssp table for loading a GtEncseq
using el.
void gt_encseq_loader_require_sds_tab(GtEncseqLoader *el)
Requires presence of the .sds table containing indexes for sequence descriptions. Enabled by default.
void gt_encseq_loader_do_not_require_sds_tab(GtEncseqLoader *el)
Disables requirement of the .sds table for loading a GtEncseq
using el.
void gt_encseq_loader_enable_range_iterator(GtEncseqLoader *el)
Enables support for faster access to special ranges in the
GtEncseq loaded by el. Enabled by default.
void gt_encseq_loader_disable_range_iterator(GtEncseqLoader *el)
Disables support for faster access to special ranges in the
GtEncseq loaded by el.
void gt_encseq_loader_set_logger(GtEncseqLoader *el, GtLogger *l)
Sets the logger to use by ee during encoding to l. Default is NULL (no
logging).
GtEncseq* gt_encseq_loader_load(GtEncseqLoader *el,
const char *indexname,
GtError *err)
Attempts to map the index files as specified by indexname using the options
set in el using this interface. Returns a GtEncseq instance
on success, or NULL on error. If an error occurred, err is set
accordingly.
void gt_encseq_loader_delete(GtEncseqLoader *el)
Deletes el.
Class GtEncseqReader
The GtEncseqReader class represents the current state of a
sequential scan of a GtEncseq region as an iterator.
void gt_encseq_reader_reinit_with_readmode(GtEncseqReader *esr,
const GtEncseq *encseq,
GtReadmode readmode,
unsigned long startpos)
Reinitializes the given esr with the values as described in
gt_encseq_create_reader_with_readmode().
void gt_encseq_reader_reinit_with_direction(GtEncseqReader *esr,
const GtEncseq *encseq,
bool moveforward,
unsigned long startpos)
Reinitializes the given esr with the values as described in
gt_encseq_create_reader_with_direction().
GtUchar gt_encseq_reader_next_encoded_char(GtEncseqReader *esr)
Returns the next encoded character from current position of esr, advancing
the iterator by one position.
char gt_encseq_reader_next_decoded_char(GtEncseqReader *esr)
Returns the next decoded character from current position of esr, advancing
the iterator by one position.
void gt_encseq_reader_delete(GtEncseqReader *esr)
Deletes esr, freeing all associated space.
Class GtError
This class is used for the handling of user errors in GenomeTools.
Thereby, the actual GtError* object is used to store the error message
while it is signaled by the return value of the called function, if an error
occured.
By convention in GenomeTools, the GtError* object is always passed
into a function as the last parameter and -1 (or NULL for constructors) is
used as return value to indicate that an error occurred.
Success is usually indicated by 0 as return value or via a non-NULL object
pointer for constructors.
It is possible to use NULL as an GtError* object, if one is not
interested in the actual error message.
Functions which do not get an GtError* object cannot fail due to a user
error and it is not necessary to check their return code for an error
condition.
GtError* gt_error_new(void)
Return a new GtError* object
#define gt_error_check(err)
Insert an assertion to check that the error err is not set or is NULL.
This macro should be used at the beginning of every routine which has an
GtError* argument to make sure the error propagation has been coded
correctly.
void gt_error_set(GtError *err, const char *format, ...)
Set the error message stored in err according to format (as in
printf(3)).
void gt_error_vset(GtError *err, const char *format, va_list ap)
Set the error message stored in err according to format (as in
vprintf(3)).
void gt_error_set_nonvariadic(GtError *err, const char *msg)
Set the error message stored in err to msg.
bool gt_error_is_set(const GtError *err)
Return true if the error err is set, false otherwise.
void gt_error_unset(GtError *err)
Unset the error err.
const char* gt_error_get(const GtError *err)
Return the error string stored in err (the error must be set).
void gt_error_delete(GtError *err)
Delete the error object err.
Class GtFeatureIndex
This interface represents a searchable container for FeatureNode objects,
typically root nodes of larger structures. How storage and searching takes
place is left to the discretion of the implementing class.
Output from a gt_feature_index_get_features_*() method should always
be sorted by feature start position.
void gt_feature_index_add_region_node(GtFeatureIndex *feature_index,
GtRegionNode *region_node)
Add region_node to feature_index.
void gt_feature_index_add_feature_node(GtFeatureIndex *feature_index,
GtFeatureNode *feature_node)
Add feature_node to feature_index, associating it with a sequence
region denoted by its identifier string.
int gt_feature_index_add_gff3file(GtFeatureIndex *feature_index,
const char *gff3file, GtError *err)
Add all features contained in gff3file to feature_index, if gff3file is
valid. Otherwise, feature_index is not changed and err is set.
GtArray* gt_feature_index_get_features_for_seqid(GtFeatureIndex*,
const char *seqid)
Returns an array of GtFeatureNodes associated with a given sequence region
identifier seqid.
int gt_feature_index_get_features_for_range(GtFeatureIndex
*feature_index,
GtArray *results,
const char *seqid,
const GtRange *range,
GtError*)
Look up genome features in feature_index for sequence region seqid in
range and store them in results.
const char* gt_feature_index_get_first_seqid(const GtFeatureIndex
*feature_index)
Returns the first sequence region identifier added to feature_index.
GtStrArray* gt_feature_index_get_seqids(const GtFeatureIndex *feature_index)
Returns a GtStrArray of all sequence region identifiers contained in
feature_index (in alphabetical order).
void gt_feature_index_get_range_for_seqid(GtFeatureIndex *feature_index,
GtRange *range,
const char *seqid)
Writes the range of all features contained in the feature_index for
region identifier seqid to the GtRange pointer range.
bool gt_feature_index_has_seqid(const GtFeatureIndex *feature_index,
const char *seqid)
Returns true if the sequence region identified by seqid has been
registered in the feature_index.
void gt_feature_index_delete(GtFeatureIndex*)
Deletes the feature_index and all its referenced features.
Class GtFeatureIndexMemory
The GtFeatureIndexMemory class implements a GtFeatureIndex in memory.
Features are organised by region node. Each region node collects its
feature nodes in an interval tree structure, which allows for efficient
range queries.
GtFeatureIndex* gt_feature_index_memory_new(void)
Creates a new GtFeatureIndexMemory object.
Class GtFeatureNode
Implements the GtGenomeNode interface. A single feature node corresponds
to a regular GFF3 line (i.e., a line which does not start with #).
Part-of relationships (which are realised in GFF3 with the Parent and ID
attributes) are realised in the C API with the
gt_feature_node_add_child() method.
GtGenomeNode* gt_feature_node_new(GtStr *seqid, const char *type,
unsigned long start, unsigned long end,
GtStrand strand)
Create an new GtFeatureNode* on sequence with ID seqid and type type
which lies from start to end on strand strand.
The GtFeatureNode* stores a new reference to seqid, so make sure you do
not modify the original seqid afterwards!
start and end always refer to the forward strand, therefore start has
to be smaller or equal than end.
GtGenomeNode* gt_feature_node_new_standard_gene(void)
Return the ``standard gene'' (mainly for testing purposes).
void gt_feature_node_add_child(GtFeatureNode *parent,
GtFeatureNode *child)
Add child node to parent node. parent takes ownership of child.
const char* gt_feature_node_get_source(const GtFeatureNode *feature_node)
Return the source of feature_node. If no source has been set, "." is
returned. Corresponds to column 2 of regular GFF3 lines.
void gt_feature_node_set_source(GtFeatureNode *feature_node,
GtStr *source)
Set the source of feature_node. Stores a new reference to source.
Corresponds to column 2 of regular GFF3 lines.
bool gt_feature_node_has_source(const GtFeatureNode *feature_node)
Return true if feature_node has a defined source (i.e., on different
from "."). false otherwise.
const char* gt_feature_node_get_type(const GtFeatureNode *feature_node)
Return the type of feature_node.
Corresponds to column 3 of regular GFF3 lines.
void gt_feature_node_set_type(GtFeatureNode *feature_node,
const char *type)
Set the type of feature_node to type.
bool gt_feature_node_has_type(GtFeatureNode *feature_node,
const char *type)
Return true if feature_node has given type, false otherwise.
bool gt_feature_node_score_is_defined(const GtFeatureNode
*feature_node)
Return true if the score of feature_node is defined, false
otherwise.
float gt_feature_node_get_score(const GtFeatureNode *feature_node)
Return the score of feature_node. The score has to be defined.
Corresponds to column 6 of regular GFF3 lines.
void gt_feature_node_set_score(GtFeatureNode *feature_node,
float score)
Set the score of feature_node to score.
void gt_feature_node_unset_score(GtFeatureNode *feature_node)
Unset the score of feature_node.
GtStrand gt_feature_node_get_strand(const GtFeatureNode *feature_node)
Return the strand of feature_node.
Corresponds to column 7 of regular GFF3 lines.
void gt_feature_node_set_strand(GtFeatureNode *feature_node,
GtStrand strand)
Set the strand of feature_node to strand.
GtPhase gt_feature_node_get_phase(const GtFeatureNode *feature_node)
Return the phase of feature_node.
Corresponds to column 8 of regular GFF3 lines.
void gt_feature_node_set_phase(GtFeatureNode *feature_node,
GtPhase phase)
Set the phase of feature_node to phase.
const char* gt_feature_node_get_attribute(const GtFeatureNode *feature_node,
const char *name)
Return the attribute of feature_node with the given name.
If no such attribute has been added, NULL is returned.
The attributes are stored in column 9 of regular GFF3 lines.
GtStrArray* gt_feature_node_get_attribute_list(const GtFeatureNode
*feature_node)
Return a string array containing the used attribute names of feature_node.
The caller is responsible to free the returned GtStrArray*.
void gt_feature_node_add_attribute(GtFeatureNode *feature_node,
const char *tag, const char *value)
Add attribute tag=value to feature_node. tag and value must at
least have length 1. feature_node must not contain an attribute with the
given tag already. You should not add Parent and ID attributes, use
gt_feature_node_add_child() to denote part-of relationships.
void gt_feature_node_set_attribute(GtFeatureNode* feature_node,
const char *tag, const char *value)
Set attribute tag to new value in feature_node, if it exists already.
Otherwise the attribute tag=value is added to feature_node.
tag and value must at least have length 1.
You should not set Parent and ID attributes, use
gt_feature_node_add_child() to denote part-of relationships.
Class GtFeatureNodeIterator
GtFeatureNodeIterator* gt_feature_node_iterator_new(const GtFeatureNode
*feature_node)
Return a new GtFeatureNodeIterator* which performs a depth-first
traversal of feature_node (including feature_node itself).
GtFeatureNodeIterator* gt_feature_node_iterator_new_direct(const GtFeatureNode
*feature_node)
Return a new GtFeatureNodeIterator* which iterates over all direct
children of feature_node (without feature_node itself).
GtFeatureNode* gt_feature_node_iterator_next(GtFeatureNodeIterator
*feature_node_iterator)
Return the next GtFeatureNode* in feature_node_iterator or NULL if none
exists.
void gt_feature_node_iterator_delete(GtFeatureNodeIterator
*feature_node_iterator)
Delete feature_node_iterator.
Class GtFile
This class defines (generic) files in GenomeTools. A generic file is is a
file which either uncompressed or compressed (with gzip or bzip2).
A NULL-pointer as generic file implies stdout.
GtFile* gt_file_new(const char *path, const char *mode, GtError *err)
Create a new GtFile object and open the underlying file handle with given
mode. Returns NULL and sets err accordingly, if the file path could not
be opened. The compression mode is determined by the ending of path (gzip
compression if it ends with '.gz', bzip2 compression if it ends with '.bz2',
and uncompressed otherwise).
void gt_file_delete(GtFile *file)
Close the underlying file handle and destroy the file object.
void gt_file_xfputs(const char *str, GtFile *file)
Write \0-terminated string str to file. Similar to fputs(3), but
terminates on error.
Class GtGFF3InStream
Implements the GtNodeStream interface.
GtNodeStream* gt_gff3_in_stream_new_unsorted(int num_of_files,
const char **filenames)
Create a GtGFF3InStream* which subsequently reads the num_of_files many
GFF3 files denoted in filenames. The GFF3 files do not have to be sorted.
If num_of_files is 0 or a file name is "-", it is read from stdin.
The memory footprint is O(file size) in the worst-case.
GtNodeStream* gt_gff3_in_stream_new_sorted(const char *filename)
Create a GtGFF3InStream* which reads the sorted GFF3 file denoted by
filename. If filename is NULL, it is read from stdin.
The memory footprint is O(1) on average.
void gt_gff3_in_stream_check_id_attributes(GtGFF3InStream
*gff3_in_stream)
Make sure all ID attributes which are parsed by gff3_in_stream are correct.
Increases the memory footprint to O(file size).
void gt_gff3_in_stream_show_progress_bar(GtGFF3InStream
*gff3_in_stream)
Show progress bar on stdout to convey the progress of parsing the GFF3
files underlying gff3_in_stream.
Class GtGFF3OutStream
Implements the GtNodeStream interface.
GtNodeStream* gt_gff3_out_stream_new(GtNodeStream *in_stream,
GtFile *outfp)
Create a GtGFF3OutStream* which uses in_stream as input.
It shows the nodes passed through it as GFF3 on outfp.
void gt_gff3_out_stream_set_fasta_width(GtNodeStream
*gff3_out_stream,
unsigned long
fasta_width)
Set the width with which the FASTA sequences of GtSequenceNodes passed
through gff3_out_stream are shown to fasta_width.
Per default, each FASTA entry is shown on a single line.
void gt_gff3_out_stream_retain_id_attributes(GtNodeStream
*gff3_out_stream)
If this method is called upon gff3_out_stream, use the original ID
attributes provided in the input (instead of creating new ones, which
is the default). Memory consumption for gff3_out_stream is raised from O(1)
to O(input_size), because bookkeeping of used IDs becomes necessary to
avoid ID collisions.
Class GtGTFInStream
Implements the GtNodeStream interface.
GtNodeStream* gt_gtf_in_stream_new(const char *filename)
Create a GtGTFInStream* which subsequently reads the GTF file with the
given filename. If filename equals NULL, the GTF data is read from
stdin.
Class GtGenomeNode
The GtGenomeNode interface.
GtGenomeNode* gt_genome_node_ref(GtGenomeNode *genome_node)
Increase the reference count for genome_node and return it.
genome_node cannot be NULL.
void gt_genome_node_delete(GtGenomeNode *genome_node)
Decrease the reference count for genome_node or delete it, if this was the
last reference.
GtStr* gt_genome_node_get_seqid(GtGenomeNode *genome_node)
Return the sequence ID of genome_node.
Corresponds to column 1 of regular GFF3 lines.
GtRange gt_genome_node_get_range(GtGenomeNode *genome_node)
Return the genomic range of of genome_node.
Corresponds to columns 4 and 5 of regular GFF3 lines.
unsigned long gt_genome_node_get_start(GtGenomeNode *genome_node)
Return the start of genome_node.
Corresponds to column 4 of regular GFF3 lines.
unsigned long gt_genome_node_get_end(GtGenomeNode *genome_Node)
Return the end of genome_node.
Corresponds to column 5 of regular GFF3 lines.
const char* gt_genome_node_get_filename(const GtGenomeNode* genome_node)
Return the filename the genome_node was read from.
If the node did not originate from a file, an appropriate string is
returned.
unsigned int gt_genome_node_get_line_number(const GtGenomeNode*)
Return the line of the source file the genome_node was encountered on
(if the node was read from a file)
void gt_genome_node_set_range(GtGenomeNode *genome_node,
const GtRange *range)
Set the genomic range of genome_node to given range.
void gt_genome_node_add_user_data(GtGenomeNode *node,
const char *key,
void *data,
GtFree free_func)
Attaches a pointer to data to the node using a given string as key.
void* gt_genome_node_get_user_data(const GtGenomeNode*,
const char *key)
Returns the pointer attached to the node for a given key.
void gt_genome_node_release_user_data(GtGenomeNode*, const char *key)
Calls the destructor function associated with the user data attached under
the key on the attached data.
Class GtGraphics
The GtGraphics interface acts as a low-level abstraction of a drawing
surface. It is used as a common drawing object in GtCanvas and
GtCustomTrack implementations and supports a variety of drawing operations
for both text and basic primitive shapes.
void gt_graphics_draw_text(GtGraphics*, double x, double y, const char*)
Draws text in black to the right of (x,y). The coordinate y is used as
a baseline.
void gt_graphics_draw_text_clip(GtGraphics*, double x, double y, const char*)
Draws text in black to the right of (x,y). The coordinate y is used as
a baseline. If the text exceeds the margins, it is clipped.
#define gt_graphics_draw_text_left(g,x,y,t)
Synonym to gt_graphics_draw_text()
void gt_graphics_draw_text_centered(GtGraphics*, double x, double y,
const char*)
Draws text in black centered at (x,y). The coordinate y is used as a
baseline.
void gt_graphics_draw_text_right(GtGraphics*, double x, double y,
const char*)
Draws text in black to the left of (x,y). The coordinate y is used as a
baseline.
void gt_graphics_draw_colored_text(GtGraphics*, double x, double y,
GtColor, const char*)
Draws text in a given GtColor to the right of (x,y). The coordinate y
is used as a baseline.
double gt_graphics_get_text_height(GtGraphics*)
Returns the height of a capital letter in pixels/points.
int gt_graphics_set_background_color(GtGraphics*, GtColor)
Sets the background color of the GtGraphics to a specific color.
Note that this may only be supported for bitmap output formats.
double gt_graphics_get_text_width(GtGraphics*, const char *text)
Returns the width of the given string in pixels/points.
void gt_graphics_set_font(GtGraphics *g, const char *family,
FontSlant slant, FontWeight weight, double size)
Sets basic font family, slant and weight options. Font families are implementation-specific, e.g. in Cairo there is no operation to list available family names on the system, but the standard CSS2 generic family names, ("serif", "sans-serif", "cursive", "fantasy", "monospace"), are likely to work as expected.
double gt_graphics_get_image_width(GtGraphics*)
Returns the width of the image in pixels/points.
double gt_graphics_get_image_height(GtGraphics*)
Returns the height of the image in pixels/points.
void gt_graphics_set_margins(GtGraphics*, double margin_x,
double margin_y)
Set margins (space to the image boundaries that are clear of elements)
in the graphics.
margin_x denotes the Margin to the left and right, in pixels.
margin_y denotes the Margin to the top and bottom, in pixels.
double gt_graphics_get_xmargins(GtGraphics*)
Returns the horizontal margins in pixels/points.
double gt_graphics_get_ymargins(GtGraphics*)
Returns the vertical margins in pixels/points.
void gt_graphics_draw_horizontal_line(GtGraphics *g, double x, double y,
GtColor color, double width,
double stroke_width)
Draws a horizontal line of length width beginning at the given coordinates
to the right in the color color with stroke width stroke_width.
void gt_graphics_draw_vertical_line(GtGraphics *g, double x, double y,
GtColor color, double length,
double stroke_width)
Draws a vertical line of length length beginning at the given coordinates
downwards in the color color with stroke width stroke_width.
void gt_graphics_draw_line(GtGraphics *g, double x, double y,
double xto, double yto, GtColor color,
double stroke_width)
Draws a line beginning at (x,y) to (xto,yto) in the color color
with stroke width stroke_width.
void gt_graphics_draw_box(GtGraphics*, double x, double y, double width,
double height, GtColor fill_color,
ArrowStatus arrow_status, double arrow_width,
double stroke_width, GtColor stroke_color,
bool dashed)
Draws a arrow-like box glyph at (x,y) where these are the top left
coordinates. The box extends width pixels (incl. arrowhead) into the x
direction and height pixels into the y direction. It will be filled with
fill_color and stroked with width stroke_width and color stroke_color.
The width of the arrowhead is given by the arrow_width parameter.
The arrow_status parameter determines whether an arrowhead will be drawn
at the left or right end, both ends, or none.
If dashed is set to true, then the outline will be dashed instead of
solid.
void gt_graphics_draw_dashes(GtGraphics*, double x, double y,
double width, double height,
ArrowStatus arrow_status, double arrow_width,
double stroke_width, GtColor stroke_color)
Draws a transparent box with a dashed line at the center at (x,y)
(where these are the top left coordinates). The box extends width pixels
(incl. arrowhead) into the x direction and height pixels into the y
direction. It will be stroked with width stroke_width and color
stroke_color. The width of the arrowhead is given by the arrow_width
parameter. The arrow_status parameter determines whether an arrowhead will
be drawn at the left or right end, both ends, or none.
void gt_graphics_draw_caret(GtGraphics*, double x, double y, double width,
double height, ArrowStatus arrow_status,
double arrow_width, double stroke_width,
GtColor stroke_color)
Draws a caret (``hat'') style glyph at (x,y) (where these are the top
left coordinates). The box extends width pixels (incl. arrowhead) into the
x direction and height pixels into the y direction. It will be stroked
with width stroke_width and color stroke_color. The width of the
arrowhead is given by the arrow_width parameter. The arrow_status
parameter determines whether an arrowhead will be drawn at the left or right
end, both ends, or none.
void gt_graphics_draw_rectangle(GtGraphics*, double x, double y,
bool filled, GtColor fill_color,
bool stroked, GtColor stroke_color,
double stroke_width, double width,
double height)
Draws a rectangle at (x,y) where these are the top left coordinates.
The rectangle extends width pixels (incl. arrowhead) into the x
direction and height pixels into the y direction. It will be filled with
fill_color if filled is set to true and stroked with width stroke_width
and color stroke_color if stroked is set to true.
void gt_graphics_draw_arrowhead(GtGraphics*, double x, double y, GtColor,
ArrowStatus arrow_status)
Draws an arrowhead at (x,y) where these are the top left coordinates.
The direction ais determined by the arrow_status parameter.
void gt_graphics_draw_curve_data(GtGraphics *g, double x, double y,
GtColor color,
double data[], unsigned long ndata,
GtRange valrange, unsigned long height)
Draws a curve over the full visible image width (without margins) at
(x,y) where these are the top left coordinates. As input, the array of
double values data with ndata data points is used. The valrange gives
the minimum and maximum value of the displayed data. If a value outside the
data range is encountered, the drawing will be stopped at this data point.
int gt_graphics_save_to_file(const GtGraphics*, const char *filename,
GtError*)
Write out the GtGraphics object to the given file with filename.
void gt_graphics_save_to_stream(const GtGraphics*, GtStr *stream)
Write out the GtGraphics object to the given stream.
void gt_graphics_delete(GtGraphics*)
Deletes the the GtGraphics object.
Class GtHashmap
A hashmap allowing to index any kind of pointer (as a value). As keys, strings or any other pointer can be used.
GtHashmap* gt_hashmap_new(GtHashType keyhashtype, GtFree keyfree,
GtFree valuefree)
Creates a new GtHashmap of type keyhashtype. If keyfree and/or
valuefree are given, they will be used to free the hashmap members
when the GtHashmap is deleted. keyhashtype defines how to hash the
keys given when using the GtHashmap.
GT_HASH_DIRECT uses the key pointer as a basis for the hash function.
Equal pointers will refer to the same value. If GT_HASH_STRING is used, the
keys will be evaluated as strings and keys will be considered equal if the
strings are identical, regardless of their address in memory
void* gt_hashmap_get(GtHashmap *hm, const void *key)
Returns the value stored in hm for key or NULL if no such key exists.
void gt_hashmap_add(GtHashmap *hm, void *key, void *value)
Sets the value stored in hm for key to value, overwriting the prior
value for that key if present.
void gt_hashmap_remove(GtHashmap *hm, const void *key)
Removes the member with key key from hm.
int gt_hashmap_foreach_ordered(GtHashmap *hm, GtHashmapVisitFunc func,
void *data, GtCompare cmp, GtError*)
Iterate over hm in order given by compare function cmp.
For each member, func is called (see interface).
int gt_hashmap_foreach(GtHashmap *hm, GtHashmapVisitFunc func,
void *data, GtError*)
Iterate over hm in arbitrary order given by compare function cmp.
For each member, func is called (see interface).
int gt_hashmap_foreach_in_key_order(GtHashmap *hm,
GtHashmapVisitFunc func,
void *data, GtError*)
Iterate over hm in either alphabetical order (if GtHashType was specified
as GT_HASH_STRING) or numerical order (if GtHashType was specified as
GT_HASH_DIRECT).
void gt_hashmap_reset(GtHashmap *hm)
Resets hm by unsetting values for all keys, calling the free function if
necessary.
void gt_hashmap_delete(GtHashmap *hm)
Deletes hm, calling the free function if necessary.
Class GtImageInfo
The GtImageInfo class is a container for 2D coordinate to GtFeatureNode
mappings which could, for example, be used to associate sections of a
rendered image with GUI widgets or HTML imagemap areas. This information is
given in the form of GtRecMap objects. They are created during the
image rendering process and stored inside a GtImageInfo object for later
retrieval. Additionally, the rendered width of an image can be obtained via
a GtImageInfo method.
GtImageInfo* gt_image_info_new(void)
Creates a new GtImageInfo object.
unsigned int gt_image_info_get_height(GtImageInfo *image_info)
Returns the height of the rendered image (in pixels or points).
unsigned long gt_image_info_num_of_rec_maps(GtImageInfo *image_info)
Returns the total number of mappings in image_info.
const GtRecMap* gt_image_info_get_rec_map(GtImageInfo *image_info,
unsigned long i)
Returns the i-th GtRecMap mapping in image_info.
void gt_image_info_delete(GtImageInfo *image_info)
Deletes image_info and all the GtRecMap objects created by it.
Class GtIntervalTree
This is an interval tree data structure, implemented according to Cormen et al., Introduction to Algorithms, 2nd edition, MIT Press, Cambridge, MA, USA, 2001
GtIntervalTree* gt_interval_tree_new(GtFree)
Creates a new GtIntervalTree. If a GtFree function is given as an
argument, it is applied on the data pointers in all inserted nodes when the
GtIntervalTree is deleted.
unsigned long gt_interval_tree_size(GtIntervalTree*)
Returns the number of elements in the GtIntervalTree.
GtIntervalTreeNode* gt_interval_tree_find_first_overlapping(GtIntervalTree*,
unsigned long start,
unsigned long end)
Returns the first node in the GtIntervalTree which overlaps the given
range (from start to end).
void gt_interval_tree_insert(GtIntervalTree *tree,
GtIntervalTreeNode *node)
Inserts node node into tree.
void gt_interval_tree_find_all_overlapping(GtIntervalTree*,
unsigned long start,
unsigned long end,
GtArray*)
Collects data pointers of all GtIntervalTreeNodes in the tree which
overlapp with the query range (from start to end) in a GtArray.
int gt_interval_tree_traverse(GtIntervalTree*,
GtIntervalTreeIteratorFunc func,
void *data)
Traverses the GtIntervalTree in a depth-first fashion, applying func to
each node encountered. The data pointer can be used to reference arbitrary
data needed in the GtIntervalTreeIteratorFunc.
void gt_interval_tree_delete(GtIntervalTree*)
Deletes a GtIntervalTree. If a GtFree function was set in the tree
constructor, data pointers specified in the nodes are freed using the given
GtFree function.
Class GtIntervalTreeNode
GtIntervalTreeNode* gt_interval_tree_node_new(void *data,
unsigned long low,
unsigned long high)
Creates a new GtIntervalTreeNode. Transfers ownership of data to interval
tree if inserted into a GtIntervalTree in which a
GtIntervalTreeDataFreeFunc is set.
void* gt_interval_tree_node_get_data(GtIntervalTreeNode* node)
Returns a pointer to the data associated with node node.
Class GtLayout
The GtLayout class represents contents (tracks) of a GtDiagram broken up
into lines such that a given horizontal space allotment given in pixels
or points is used up most efficiently. This is done using the GtLineBreaker
and GtTextWidthCalculator classes. As defaults, Cairo-based instances of
these classes are used but can be specified separately.
A GtLayout can be queried for the height of the laid out representation and
finally be rendered to a GtCanvas.
GtLayout* gt_layout_new(GtDiagram *diagram, unsigned int width, GtStyle*,
GtError*)
Creates a new GtLayout object for the contents of diagram.
The layout is done for a target image width of width and using the rules in
GtStyle object style.
GtLayout* gt_layout_new_with_twc(GtDiagram*,
unsigned int width,
GtStyle*,
GtTextWidthCalculator*,
GtError*)
Like gt_layout_new(), but allows use of a different GtTextWidthCalculator
implementation.
void gt_layout_set_track_ordering_func(GtLayout *layout,
GtTrackOrderingFunc func,
void *data)
Sets the GtTrackOrderingFunc comparator function func which defines an
order on the tracks contained in layout. This determines the order in
which the tracks are drawn vertically.
Additional data necessary in the comparator function can be given in data,
the caller is responsible to free it.
unsigned long gt_layout_get_height(const GtLayout *layout)
Returns the height of layout in pixels.
int gt_layout_sketch(GtLayout *layout, GtCanvas *target_canvas,
GtError*)
Renders layout on the target_canvas.
void gt_layout_delete(GtLayout*)
Destroys a layout.
Class GtLogger
GtLogger* gt_logger_new(bool enabled, const char *prefix, FILE *target)
Creates a new GtLogger, with logging enabled or not,
and prefixing all log entries with prefix (e.g. "debug").
The log output is terminated by a newline. All log output will
be written to target.
void gt_logger_enable(GtLogger *logger)
Enable logging on logger.
void gt_logger_disable(GtLogger *logger)
Disable logging on logger.
bool gt_logger_enabled(GtLogger *logger)
Returns true if logging is enabled on logger, false otherwise.
FILE* gt_logger_target(GtLogger *logger)
Returns logging target of logger.
void gt_logger_set_target(GtLogger *logger, FILE *fp)
Set logging target of logger to fp.
void gt_logger_log_force(GtLogger *logger, const char *format, ...)
Log to target regardless of logging status.
void gt_logger_log(GtLogger *logger, const char *format, ...)
Log to target depending on logging status.
void gt_logger_log_va(GtLogger *logger, const char *format, va_list)
Log to target depending on logging status, using a va_list argument.
Class GtNodeStream
The GtNodeStream interface.
GtNodeStream* gt_node_stream_ref(GtNodeStream *node_stream)
Increase the reference count for node_stream and return it.
int gt_node_stream_next(GtNodeStream *node_stream,
GtGenomeNode **genome_node,
GtError *err)
Try to get the the next GtGenomeNode from node_stream and store it in
genome_node (transfers ownership to genome_node).
If no error occurs, 0 is returned and genome_node contains either the next
GtGenomeNode or NULL, if the node_stream is exhausted.
If an error occurs, -1 is returned and err is set accordingly (the status
of genome_node is undefined, but no ownership transfer occured).
int gt_node_stream_pull(GtNodeStream *node_stream, GtError *err)
Calls gt_node_stream_next() on node_stream repeatedly until the
node_stream is exhausted (0 is returned) or an error occurs (-1 is returned
and err is set). All retrieved GtGenomeNodes are deleted automatically
with calls to gt_genome_node_delete().
This method is basically a convenience method which simplifies calls to
gt_node_stream_next() in a loop where retrieved GtGenomeNodes are not
processed any further.
bool gt_node_stream_is_sorted(GtNodeStream *node_stream)
Return true if node_stream is a sorted stream, false otherwise.
void gt_node_stream_delete(GtNodeStream *node_stream)
Decrease the reference count for node_stream or delete it, if this was the
last reference.
GtNodeStream* gt_node_stream_create(const GtNodeStreamClass
*node_stream_class,
bool ensure_sorting)
Create a new object of the given node_stream_class. If ensure_sorting is
true, it is enforced that all genome node objects pulled from this class
are sorted. That is, for consecutive nodes a and b obtained from the
given node_stream_class the return code of gt_genome_node_compare(a, b)
has to be smaller or equal than 0. If this condition is not met, an assertion
fails.
void* gt_node_stream_cast(const GtNodeStreamClass
*node_stream_class,
GtNodeStream *node_stream)
Cast node_stream to the given node_stream_class.
That is, if node_stream is not from the given node_stream_class, an
assertion will fail.
Class GtNodeStreamClass
const
GtNodeStreamClass* gt_node_stream_class_new(size_t size,
GtNodeStreamFreeFunc free,
GtNodeStreamNextFunc next)
Create a new node stream class (that is, a class which implements the node
stream interface). size denotes the size of objects of the new node stream
class. The optional free method is called once, if an object of the new
class is deleted. The mandatory next method has to implement the
gt_node_stream_next() semantic for the new class.
Class GtPhase
This enum type defines the possible phases, namely GT_PHASE_ZERO,
GT_PHASE_ONE, GT_PHASE_TWO, and GT_PHASE_UNDEFINED.
#define GT_PHASE_CHARS
Use this string to map phase enum types to their corresponding character.
GtPhase gt_phase_get(char phase_char)
Map phase_char to the corresponding phase enum type.
An assertion will fail if phase_char is not a valid one.
Class GtProgressTimer
The GtProgressTimer class implements a timer which can be used to
measure the time needed for several consecutive steps.
GtProgressTimer* gt_progress_timer_new(const char *desc, bool with_bar)
Creates a new GtProgressTimer with the intitial state desc.
Optionally, a flag with_bar can be set describing the use of a progress
bar, so the progress timer will not interfere in that case.
void gt_progress_timer_start_new_state(GtProgressTimer *pt,
const char *newevent,
FILE *fp)
Announce the end of the current state and the beginning of the new state
to pt. The new state will be described by newevent. The time needed for
the now completed state is written to fp.
bool gt_progress_timer_use_bar(const GtProgressTimer *pt)
Returns whether progress bar usage has been set in pt or not.
void gt_progress_timer_delete(GtProgressTimer *pt)
Deletes pt and frees all associated space.
Class GtRange
The GtRange class is used to represent genomic ranges in GenomeTools.
Thereby, the start must always be smaller or equal than the end.
int gt_range_compare(const GtRange *range_a, const GtRange *range_b)
Compare range_a and range_b. Returns 0 if range_a equals range_b, -1
if range_a starts before range_b or (for equal starts) range_a ends
before range_b, and 1 else.
int gt_range_compare_with_delta(const GtRange *range_a,
const GtRange *range_b,
unsigned long delta)
Compare range_a and range_b with given delta.
Returns 0 if range_a equals range_b modulo delta (i.e., the start and
end points of range_a and range_b are at most delta bases apart), -1
if range_a starts before range_b or (for equal starts) range_a ends
before range_b, and 1 else.
bool gt_range_overlap(const GtRange *range_a, const GtRange *range_b)
Returns true if range_a and range_b overlap, false otherwise.
bool gt_range_overlap_delta(const GtRange *range_a,
const GtRange *range_b,
unsigned long delta)
Returns true if range_a and range_b overlap at least delta many
positions, false otherwise.
bool gt_range_contains(const GtRange *range_a, const GtRange *range_b)
Returns true if range_b is contained in range_a, false otherwise.
bool gt_range_within(const GtRange *range, unsigned long point)
Returns true if point lies within range, false otherwise.
GtRange gt_range_join(const GtRange *range_a, const GtRange *range_b)
Join range_a and range_b and return the result.
GtRange gt_range_offset(const GtRange *range, long offset)
Transform start and end of range by offset and return the result.
unsigned long gt_range_length(const GtRange *range)
Returns the length of the given range.
Class GtRecMap
A GtRecMap object contains a mapping from a 2D coordinate pair
which identifies a rectangle in a rendered image to the GtFeatureNode it
represents. The rectangle is defined by the coordinates of its upper left
(``northwest'') and lower right (``southeast'') points.
GtRecMap objects are created by an GtImageInfo object which is filled
during the generation of an image by AnnotationSketch.
double gt_rec_map_get_northwest_x(const GtRecMap*)
Retrieve x value of the the upper left point of the rectangle.
double gt_rec_map_get_northwest_y(const GtRecMap*)
Retrieve y value of the the upper left point of the rectangle.
double gt_rec_map_get_southeast_x(const GtRecMap*)
Retrieve x value of the the lower right point of the rectangle.
double gt_rec_map_get_southeast_y(const GtRecMap*)
Retrieve y value of the the lower right point of the rectangle.
const GtFeatureNode* gt_rec_map_get_genome_feature(const GtRecMap*)
Retrieve GtFeatureNode associated with this rectangle.
bool gt_rec_map_has_omitted_children(const GtRecMap*)
Returns true if the rectangle represents a block root whose elements
have not been drawn due to size restrictions.
Class GtRegionNode
Implements the GtGenomeNode interface. Region nodes correspond to the
##sequence-region lines in GFF3 files.
GtGenomeNode* gt_region_node_new(GtStr *seqid, unsigned long start,
unsigned long end)
Create a new GtRegionNode* representing sequence with ID seqid from
base position start to base position end (1-based).
start has to be smaller or equal than end.
The GtRegionNode* stores a new reference to seqid, so make sure you do
not modify the original seqid afterwards!
Class GtSequenceNode
Implements the GtGenomeNode interface. Sequence nodes correspond to
embedded FASTA sequences in GFF3 files.
GtGenomeNode* gt_sequence_node_new(const char *description,
GtStr *sequence)
Create a new GtSequenceNode* representing a FASTA entry with the given
description and sequence. Takes ownership of sequence.
const char* gt_sequence_node_get_description(const
GtSequenceNode
*sequence_node)
Return the description of sequence_node.
const char* gt_sequence_node_get_sequence(const GtSequenceNode
*sequence_node)
Return the sequence of sequence_node.
unsigned long gt_sequence_node_get_sequence_length(const
GtSequenceNode
*sequence_node)
Return the sequence length of sequence_node.
Class GtSplitter
The GtSplitter class defines objects which can split given strings into
tokens delimited by a given character, allowing for convenient access to
each token.
GtSplitter* gt_splitter_new(void)
Create a new GtSplitter object.
void gt_splitter_split(GtSplitter*, char *string, unsigned long length,
char delimiter)
Split string of given length into tokens delimited by 'delimiter'.
Note that string is modified in the splitting process!
char** gt_splitter_get_tokens(GtSplitter*)
Get all tokens in an array.
char* gt_splitter_get_token(GtSplitter*, unsigned long token_num)
Get token with number token_num.
void gt_splitter_reset(GtSplitter*)
Reset the splitter.
unsigned long gt_splitter_size(GtSplitter*)
Returns the number of tokens.
void gt_splitter_delete(GtSplitter*)
Delete the GtSplitter object.
Class GtStr
Objects of the GtStr class are strings which grow on demand.
GtStr* gt_str_new(void)
Return an empty GtStr* object.
GtStr* gt_str_new_cstr(const char *cstr)
Return a new GtStr* object whose content is set to cstr.
GtStr* gt_str_clone(const GtStr *str)
Return a clone of str.
GtStr* gt_str_ref(GtStr *str)
Increase the reference count for str and return it.
If str is NULL, NULL is returned without any side effects.
char* gt_str_get(const GtStr *str)
Return the content of str. Never returns NULL, and the content is always
\0-terminated
void gt_str_set(GtStr *str, const char *cstr)
Set the content of str to cstr.
void gt_str_append_str(GtStr *dest, const GtStr *src)
Append the string src to dest.
void gt_str_append_cstr(GtStr *str, const char *cstr)
Append the \0-terminated cstr to str.
void gt_str_append_cstr_nt(GtStr *str,
const char *cstr, unsigned long length)
Append the non \0-terminated cstr with given length to str.
void gt_str_append_char(GtStr *str, char c)
Append character c to str.
void gt_str_append_double(GtStr*, double d, int precision)
Append double d to str with given precision.
void gt_str_append_ulong(GtStr*, unsigned long ulong)
Append ulong to str.
void gt_str_append_int(GtStr*, int intval)
Append intval to str.
void gt_str_append_uint(GtStr*, unsigned int uint)
Append uint to str.
void gt_str_set_length(GtStr*, unsigned long length)
Set length of str to length. length must be smaller or equal than
gt_str_length(str).
void gt_str_reset(GtStr *str)
Reset str to length 0.
int gt_str_cmp(const GtStr *str1, const GtStr *str2)
Compare str1 and str2 and return the result (similar to strcmp(3)).
unsigned long gt_str_length(const GtStr *str)
Return the length of str. If str is NULL, 0 is returned.
void gt_str_delete(GtStr *str)
Decrease the reference count for str or delete it, if this was the last
reference.
Class GtStrArray
GtStrArray* objects are arrays of string which grow on demand.
GtStrArray* gt_str_array_new(void)
Return a new GtStrArray* object.
GtStrArray* gt_str_array_ref(GtStrArray*)
Increases the reference to a GtStrArray.
void gt_str_array_add_cstr(GtStrArray *str_array, const char *cstr)
Add cstr to str_array. Thereby, an internal copy of cstr is created.
void gt_str_array_add_cstr_nt(GtStrArray *str_array, const char *cstr,
unsigned long length)
Add the non \0-terminated cstr with given length to str_array.
Thereby, an internal copy of cstr is created.
void gt_str_array_add(GtStrArray *str_array, const GtStr *str)
Add str to str_array. Thereby, an internal copy of str is created.
const char* gt_str_array_get(const GtStrArray *str_array,
unsigned long strnum)
Return pointer to internal string with number strnum of str_array.
strnum must be smaller than gt_str_array_size(str_array).
void gt_str_array_set_size(GtStrArray *str_array, unsigned long size)
Set the size of str_array to size. size must be smaller or equal than
gt_str_array_size(str_array).
unsigned long gt_str_array_size(const GtStrArray *str_array)
Return the number of strings stored in str_array.
void gt_str_array_delete(GtStrArray *str_array)
Delete str_array.
Class GtStrand
This enum type defines the possible strands, namely GT_STRAND_FORWARD,
GT_STRAND_REVERSE, GT_STRAND_BOTH, and GT_STRAND_UNKNOWN.
#define GT_STRAND_CHARS
Use this string to map strand enum types to their corresponding character.
GtStrand gt_strand_get(char strand_char)
Map strand_char to the corresponding strand enum type.
Returns GT_NUM_OF_STRAND_TYPES if strand_char is not a valid one.
Class GtStyle
Objects of the GtStyle class hold AnnotationSketch style information
like colors, margins, collapsing options, and others. The class provides
methods to set values of various types. Each value is organised into
a section and is identified by a key. That is, a section, key
pair must uniquely identify a value.
GtStyle* gt_style_new(GtError*)
Creates a new GtStyle object.
GtStyle* gt_style_ref(GtStyle*)
Increments the reference count of the given GtStyle.
void gt_style_unsafe_mode(GtStyle*)
Enables unsafe mode (``io'' and ``os'' libraries loaded).
void gt_style_safe_mode(GtStyle*)
Enables safe mode (``io'' and ``os'' libraries not accessible).
bool gt_style_is_unsafe(GtStyle *sty)
Returns true if sty is in unsafe mode.
GtStyle* gt_style_clone(const GtStyle*, GtError*)
Creates a independent (``deep'') copy of the given GtStyle object.
int gt_style_load_file(GtStyle*, const char *filename, GtError*)
Loads and executes Lua style file with given filename.
This file must define a global table called style.
int gt_style_load_str(GtStyle*, GtStr *instr, GtError*)
Loads and executes Lua style code from the given GtStr instr.
This code must define a global table called style.
int gt_style_to_str(const GtStyle*, GtStr *outstr, GtError*)
Generates Lua code which represents the given GtStyle object and
writes it into the GtStr object outstr.
void gt_style_reload(GtStyle*)
Reloads the Lua style file.
void gt_style_set_color(GtStyle*, const char *section,
const char *key, const GtColor *color)
Sets a color value in the GtStyle for section section and key to a
certain color.
void gt_style_set_str(GtStyle*, const char *section, const char *key,
GtStr *value)
Set string with key key in section to value.
void gt_style_set_num(GtStyle*, const char *section, const char *key,
double number)
Set numeric value of key key in section to number.
void gt_style_set_bool(GtStyle*, const char *section,
const char *key, bool val)
Set boolean value of key key in section to val.
void gt_style_unset(GtStyle*, const char *section, const char *key)
Unset value of key key in section.
void gt_style_delete(GtStyle *style)
Deletes this style.
Class GtTextWidthCalculator
The GtTextWidthCalculator interface answers queries w.r.t.
text width in a specific drawing backend. This interface is needed to do
proper line breaking in a GtLayout even if there is no GtCanvas or
GtGraphics created yet.
GtTextWidthCalculator* gt_text_width_calculator_ref(GtTextWidthCalculator*)
Increases the reference count of the GtTextWidthCalculator.
double gt_text_width_calculator_get_text_width(
GtTextWidthCalculator*,
const char *text)
Requests the width of text from the GtTextWidthCalculator.
void gt_text_width_calculator_delete(GtTextWidthCalculator*)
Deletes a GtTextWidthCalculator instance.
Class GtTextWidthCalculatorCairo
Implements the GtTextWidthCalculator interface with Cairo as the drawing
backend. If text width is to be calculated with regard to a specific
transformation etc. which is in effect in a cairo_t and which should be
used later via a GtCanvasCairoContext, create a
GtTextWidthCalculatorCairo object and pass it to the GtLayout via
gt_layout_new_with_twc().
GtTextWidthCalculator* gt_text_width_calculator_cairo_new(cairo_t*, GtStyle*)
Creates a new GtTextWidthCalculatorCairo object for the given context
using the text size options given in the GtStyle. If the GtStyle is NULL,
the current font settings in the cairo_t will be used for all text
width calculations.
Class GtTimer
The GtTimer class encapsulates a timer which can be used for run-time
measurements.
GtTimer* gt_timer_new(void)
Creates a new GtTimer object.
void gt_timer_start(GtTimer *t)
Starts the time measurement on t.
void gt_timer_stop(GtTimer *t)
Stops the time measurement on t.
void gt_timer_show(GtTimer *t, FILE *fp)
Outputs the current state of t in the format
"%ld.%06lds real %lds user %lds system" to file
pointer fp (see gt_timer_show_formatted).
void gt_timer_show_formatted(GtTimer *t, const char *fmt, FILE *fp)
Outputs the current state of t in a user-defined format given by fmt.
fmt must be a format string for four %ld numbers, which are filled with:
elapsed seconds, elapsed microseconds, used usertime in seconds,
system time in seconds. The output is written to fp.
void gt_timer_delete(GtTimer *t)
Deletes t.
Class GtTranslator
Implements a translator class supporting all translation schemes from
http://www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi.
The GtTranslator can be used to generate single-frame translations of
a DNA string to a GtStr or to produce 3-frame translations via an iterator
interface.
#define GT_TRANSLATOR_STANDARD_SCHEME
The number of the standard translation scheme.
int gt_translator_set_translation_scheme(GtTranslator *translator,
unsigned int transnum,
GtError *err)
Selects the translation scheme in translator to the one identified by
transnum. transnum refers to the numbers as reported by
gt_translator_get_translation_table_descriptions() or the list given
at the NCBI web site.
Returns a negative value if an error occurred, see err for details.
int gt_translator_start(GtTranslator *translator,
const char *dnaseq,
unsigned long dnalen,
char *translated,
unsigned int *frame,
GtError *err)
Starts a translation iteration process at the string position pointed to by
dnaseq, intended to go on for dnalen bases. The current translation
scheme set in translator will be used. The currently translated character
is put in translated while the current reading frame (in reference to
dnaseq position) is put in frame.
Returns a negative value if an error occurred, see err for details.
int gt_translator_next(GtTranslator *translator,
char *translated,
unsigned int *frame,
GtError *err)
Continues a translation iteration process started by gt_translator_start().
The currently translated character is put in translated while the current
reading frame is put in frame.
Returns a negative value if an error occurred, see err for details.
int gt_translator_translate_string(GtTranslator *translator,
GtStr *protein,
const char *dnaseq,
unsigned long dnalen,
unsigned int frame,
GtError *err)
Translates dnaseq of length dnalen in reading frame frame using the
settings currently active in translator. The resulting amino acid sequence
is appended to protein.
Returns a negative value if an error occurred, see err for details.
int gt_translator_find_startcodon(GtTranslator *translator,
const char *dnaseq,
unsigned long dnalen,
unsigned long *pos,
GtError *err)
Determines the offset of the beginning of the first codon in dnaseq (of
length dnalen) which is a start codon according to the current translation
scheme in translator.
The offset is written to the location pointed to by pos.
Returns a negative value if an error occurred, see err for details.
int gt_translator_codon2amino(const GtTranslator *translator,
char c1, char c2, char c3,
char *amino,
GtError *err)
Writes the translation for the codon c1,c2,c3 to the position pointed
to by amino. The current translation scheme set in translator is used.
Returns a negative value if an error occurred, see err for details.
void gt_translator_delete(GtTranslator *translator)
Deletes translator and frees all associated memory.
Module Array2dim
#define gt_array2dim_malloc(ARRAY2DIM, ROWS, COLUMNS)
Allocates a new 2-dimensional array with dimensions ROWS x COLUMNS and
assigns a pointer to the newly allocated space to ARRAY2DIM.
The size of each element is determined automatically from the type of the
ARRAY2DIM pointer.
#define gt_array2dim_calloc(ARRAY2DIM, ROWS, COLUMNS)
Allocates a new 2-dimensional array with dimensions ROWS x COLUMNS and
assigns a pointer to the newly allocated space to ARRAY2DIM.
The allocated space is initialized to be filled with zeroes.
The size of each element is determined automatically from the type of the
ARRAY2DIM pointer.
int gt_array2dim_example(GtError*)
An example for usage of the Array2dim module.
#define gt_array2dim_delete(ARRAY2DIM)
Frees the space allocated for the 2-dimensional array pointed to by
ARRAY2DIM.
Module Assert
#define gt_assert(expression)
The gt_assert() macro tests the given expression and if it is false, the
calling process is terminated. A diagnostic message is written to stderr
and the exit(3) function is called (with error code 2 as argument),
effectively terminating the program.
If expression is true, the gt_assert() macro does nothing.
Module Bsearch
void* gt_bsearch_data(const void *key, const void *base, size_t nmemb,
size_t size, GtCompareWithData, void *data)
Similar interface to bsearch(3), except that the GtCompareWithData
function gets an additional data pointer.
void gt_bsearch_all(GtArray *members, const void *key, const void *base,
size_t nmemb, size_t size, GtCompareWithData, void *data)
Similar interface to gt_bsearch_data(), except that all members which
compare as equal are stored in the members array. The order in which the
elements are added is undefined.
void gt_bsearch_all_mark(GtArray *members, const void *key, const void *base,
size_t nmemb, size_t size, GtCompareWithData,
void *data, GtBittab*)
Similar interface to gt_bsearch_all(). Additionally, if a bittab is given
(which must be of size nmemb), the bits corresponding to the found
elements are marked (i.e., set).
Module Countingsort
void gt_countingsort(void *out, const void *in, size_t elem_size,
unsigned long size, unsigned long max_elemvalue,
void *data, GtGetElemvalue get_elemvalue)
Sort the array of elements pointed to by in containing size many elements
of size elem_size and store the result in the array out of the same size.
max_elemvalue denotes the maximum value an element can have.
get_elemvalue should return an integer value for the given element elem.
Implements the counting sort algorithm. For a description
see example page 175 to page 177 of the book:
T.H. Cormen, C.E. Leiserson and R.L. Rivest. Introduction to Algorithms.
MIT Press: Cambridge, MA, 1990.
unsigned long gt_countingsort_get_max(const void *in, size_t elem_size,
unsigned long size, void *data,
GtGetElemvalue get_elemvalue)
If max_elemvalue is not known, it can be determined with this function.
Module Cstr
char* gt_cstr_dup(const char *cstr)
Creates a duplicate of string cstr using the GenomeTools memory
allocator.
char* gt_cstr_dup_nt(const char *cstr, unsigned long length)
Creates a duplicate of string cstr using the GenomeTools memory allocator.
The string needs not be \0-terminated, instead its length must be given.
void gt_cstr_rep(char *cstr, char f, char t)
Replace each occurence of f in cstr to t.
void gt_cstr_show(const char *cstr, unsigned long length, FILE *outfp)
Outputs the first length characters of the string cstr to file pointer
outfp.
unsigned long gt_cstr_length_up_to_char(const char *cstr, char c)
Returns the length of the prefix of cstr ending just before c, if cstr
does not contain c, strlen(cstr) is returned.
char* gt_cstr_rtrim(char* cstr, char remove)
Removes all occurrences of remove from the right end of cstr.
Module Endianess
bool gt_is_little_endian(void)
Returns true if host CPU is little-endian, false otherwise.
Module Fileutils
bool gt_file_exists(const char *path)
Returns true if the file with the given path exists, false otherwise.
bool gt_file_is_newer(const char *a, const char *b)
Returns true if the file with path a has a later modification time than the
file with path b, false otherwise.
unsigned long gt_file_number_of_lines(const char*)
Returns the number of lines in a file.
const char* gt_file_suffix(const char *path)
Returns the suffix of path, if there is any. Returns "" otherwise.
The suffix is the part after and including the last '.' but after the last
'/'. Except if path ends with ".gz" or ".bz2", then the suffix is the part
after and including the second last '.'.
void gt_file_dirname(GtStr *path, const char *file)
Set path to the dirname of file, if it has one, to "" otherwise.
int gt_file_find_in_path(GtStr *path, const char *file, GtError*)
Find file in $PATH, if it has no dirname; set path to dirname otherwise.
Sets path to the empty string if file could not be found in $PATH.
int gt_file_find_in_env(GtStr *path, const char *file,
const char *env, GtError*)
Find file in the ':'-separated directory list specified in environment
variable $env, if it has no dirname; set path to dirname otherwise.
Sets path to the empty string if file could not be found in $env.
off_t gt_file_estimate_size(const char *file)
Return the (estimated) size of file. If file is uncompressed, the exact
size is returned. If file is compressed, an estimation which assumes that
file contains a DNA sequence is returned.
off_t gt_files_estimate_total_size(const GtStrArray *filenames)
Return the (estimated) total size of all files given in filenames.
Uses gt_file_estimate_size().
int gt_files_guess_if_protein_sequences(const GtStrArray *filenames,
GtError *err)
Guesse if the sequences contained in the files given in filenames are
protein sequences. Returns 1 if the guess is that the files contain protein
sequences. Returns 0 if the guess is that the files contain DNA sequences.
Returns -1 if an error occurs while reading the files (err is set
accordingly).
Module FunctionPointer
int (*GtCompare)(const void *a, const void *b)
Functions of this type return less than 0 if a is smaller than b,
0 if a is equal to b, and greater 0 if a is larger than b.
Thereby, the operators smaller, equal, and larger are
implementation dependent.
Do not count on these functions to return -1, 0, or 1!
int (*GtCompareWithData)(const void*, const void*, void *data)
Similar to GtCompare, but with an additional data pointer.
void (*GtFree)(void*)
The generic free function pointer type.
Module Grep
int gt_grep(bool *match, const char *pattern, const char *line, GtError*)
Sets match to true if pattern matches line, to false otherwise.
Module Log
void gt_log_enable(void)
Enable logging.
bool gt_log_enabled(void)
Returns true if logging is enabled, false otherwise
void gt_log_log(const char *format, ...)
Prints the log message obtained from format and following parameters according if logging is enabled. The logging output is prefixed with the string "debug: " and finished by a newline.
void gt_log_vlog(const char *format, va_list)
Prints the log message obtained from format and following parameter according
to if logging is enabled analog to gt_log_log(). But in contrast to
gt_log_log() gt_log_vlog() does not accept individual arguments but a single
va_list argument instead.
FILE* gt_log_fp(void)
Return logging file pointer.
void gt_log_set_fp(FILE *fp)
Set logging file pointer to fp.
Module MemoryAllocation
#define gt_malloc(size)
Allocate uninitialized space for an object whose size is specified by
size and return it.
Besides the fact that it never returns NULL analog to malloc(3).
#define gt_calloc(nmemb, size)
Allocate contiguous space for an array of nmemb objects, each of whose size
is size. The space is initialized to zero.
Besides the fact that it never returns NULL analog to calloc(3).
#define gt_realloc(ptr, size)
Change the size of the object pointed to by ptr to size bytes and return
a pointer to the (possibly moved) object.
Besides the fact that it never returns NULL analog to realloc(3).
#define gt_free(ptr)
Free the space pointed to by ptr. If ptr equals NULL, no action occurs.
Analog to free(3).
void gt_free_func(void *ptr)
Analog to gt_free(), but usable as a function pointer.
Module Msort
void gt_msort(void *base, size_t nmemb, size_t size, GtCompare compar)
Sorts an array of nmemb elements, each of size size, according to compare
function compar. Uses the merge sort algorithm, the interface equals
qsort(3).
void gt_msort_r(void *base, size_t nmemb, size_t size, void *comparinfo,
GtCompareWithData compar)
Identical to gt_msort() except that the compare function is of
GtCompareWithData type accepting comparinfo as arbitrary data.
Module POSIX
char* gt_basename(const char *path)
This module implements the function gt_basename() according to the
specifications in
http://www.unix-systems.org/onlinepubs/7908799/xsh/basename.html
and
http://www.opengroup.org/onlinepubs/009695399/
gt_basename() is equivalent to the function basename(3) which
is available on most unix systems, but in different libraries and
with slightly different functionality.
gt_basename() takes the pathname pointed to by path and returns a pointer to
the final component of the pathname, deleting any trailing '/' characters.
If path consists entirely of the '/' character, then gt_basename() returns
a pointer to the string "/".
If path is a null pointer or points to an empty string, gt_basename()
returns a pointer to the string ".".
See the implementation of gt_basename_unit_test() for additional examples.
The caller is responsible for freeing the received pointer!
Module Parseutils
int gt_parse_int(int *out, const char *nptr)
Parse integer from nptr and store result in out.
Returns 0 upon success and -1 upon failure.
int gt_parse_uint(unsigned int *out, const char *nptr)
Parse unsigned integer from nptr and store result in out.
Returns 0 upon success and -1 upon failure.
int gt_parse_long(long *out, const char *nptr)
Parse long from nptr and store result in out.
Returns 0 upon success and -1 upon failure.
int gt_parse_ulong(unsigned long *out, const char *nptr)
Parse unsigned long from nptr and store result in out.
Returns 0 upon success and -1 upon failure.
int gt_parse_double(double *out, const char *nptr)
Parse double from nptr and store result in out.
Returns 0 upon success and -1 upon failure.
int gt_parse_range(GtRange *rng, const char *start, const char *end,
unsigned int line_number, const char *filename, GtError*)
Parse a range given by start and end, writing the result into rng.
Enforces that = filename and line_number for
error reporting. Returns 0 upon success and -1 upon failure.
int gt_parse_range_tidy(GtRange *rng, const char *start, const char *end,
unsigned int line_number, const char *filename,
GtError*)
Like gt_parse_range, but issues a warning if start is larger then end
and swaps both values.
Module Qsort
void gt_qsort_r(void *a, size_t n, size_t es, void *data,
GtCompareWithData cmp)
Like qsort(3), but allows an additional data pointer passed to the
GtCompareWithData comparison function cmp.
Module Unused
#define GT_UNUSED
Unused function arguments should be annotated with this macro to get rid of compiler warnings.
Module Version
const char* gt_version_check(unsigned int required_major,
unsigned int required_minor,
unsigned int required_micro)
Check that the GenomeTools library in use is compatible with the given
version. Generally you would pass in the constants GT_MAJOR_VERSION,
GT_MINOR_VERSION, and GT_MICRO_VERSION as the three arguments to this
function.
Returns NULL if the GenomeTools library is compatible with the given
version, or a string describing the version mismatch, if the library is not
compatible.
Module Warning
void (*GtWarningHandler)(void *data, const char *format, va_list ap)
Handler type used to process warnings.
void gt_warning(const char *format, ...)
Print a warning according to format and ..., if a handler is set.
void gt_warning_disable(void)
Disable that warnings are shown. That is, subsequent gt_warning() calls
have no effect.
void gt_warning_set_handler(GtWarningHandler warn_handler, void *data)
Set warn_handler to handle all warnings issued with gt_warning().
The data is passed to warning_handler on each invocation.
void gt_warning_default_handler(void *data, const char *format, va_list ap)
The default warning handler which prints on stderr.
"warning: " is prepended and a newline is appended to the message defined by
format and ap. Does not use data.
GtWarningHandler gt_warning_get_handler(void)
Return currently used GtWarningHandler.
void* gt_warning_get_data(void)
Return currently used data which is passed to the currently used
GtWarningHandler.
Module XANSI
void gt_xatexit(void (*function)
Similar to atexit(3), terminates on error.
void gt_xfclose(FILE*)
Similar to fclose(3), terminates on error.
void gt_xfflush(FILE*)
Similar to fflush(3), terminates on error.
int gt_xfgetc(FILE*)
Similar to fgetc(3), terminates on error.
char* gt_xfgets(char *s, int size, FILE *stream)
Similar to fgets(3), terminates on error.
void gt_xfgetpos(FILE*, fpos_t*)
Similar to fgetpos(3), terminates on error.
FILE* gt_xfopen(const char *path, const char *mode)
Similar to fopen(3), terminates on error.
void gt_xfputc(int, FILE*)
Similar to fputc(3), terminates on error.
void gt_xfputs(const char*, FILE*)
Similar to fputs(3), terminates on error.
size_t gt_xfread(void *ptr, size_t size, size_t nmemb, FILE*)
Similar to fread(3), terminates on error.
void gt_xfseek(FILE*, long offset, int whence)
Similar to fseek(3), terminates on error.
void gt_xfsetpos(FILE*, const fpos_t*)
Similar to fsetpos(3), terminates on error.
void gt_xfwrite(const void *ptr, size_t size, size_t nmemb, FILE*)
Similar to fwrite(3), terminates on error.
void gt_xputchar(int)
Similar to putchar(3), terminates on error.
void gt_xputs(const char*)
Similar to puts(3), terminates on error.
void gt_xremove(const char*)
Similar to remove(3), terminates on error.
void gt_xungetc(int, FILE*)
Similar to ungetc(3), terminates on error.
void gt_xvfprintf(FILE *stream, const char *format, va_list ap)
Similar to vfprintf(3), terminates on error.
int gt_xvsnprintf(char *str, size_t size, const char *format, va_list ap)
Similar to vsnprintf(3), terminates on error.
Index
GT_PHASE_CHARSGT_STRAND_CHARSGT_TRANSLATOR_STANDARD_SCHEMEGT_UNUSEDgt_alphabet_add_mappinggt_alphabet_add_wildcardgt_alphabet_bits_per_symbolgt_alphabet_charactersgt_alphabet_clonegt_alphabet_decodegt_alphabet_decode_seq_to_cstrgt_alphabet_decode_seq_to_fpgt_alphabet_decode_seq_to_strgt_alphabet_deletegt_alphabet_echo_pretty_symbolgt_alphabet_encodegt_alphabet_encode_seqgt_alphabet_guessgt_alphabet_is_dnagt_alphabet_is_proteingt_alphabet_newgt_alphabet_new_dnagt_alphabet_new_emptygt_alphabet_new_from_filegt_alphabet_new_proteingt_alphabet_num_of_charsgt_alphabet_outputgt_alphabet_pretty_symbolgt_alphabet_refgt_alphabet_sizegt_alphabet_symbolmapgt_alphabet_to_filegt_alphabet_valid_inputgt_alphabet_wildcard_showgt_array2dim_callocgt_array2dim_deletegt_array2dim_examplegt_array2dim_mallocgt_array_addgt_array_add_arraygt_array_add_elemgt_array_clonegt_array_cmpgt_array_deletegt_array_elem_sizegt_array_getgt_array_get_firstgt_array_get_lastgt_array_get_spacegt_array_newgt_array_popgt_array_refgt_array_remgt_array_rem_spangt_array_resetgt_array_reversegt_array_set_sizegt_array_sizegt_array_sortgt_array_sort_stablegt_array_sort_stable_with_datagt_array_sort_with_datagt_assertgt_basenamegt_bed_in_stream_newgt_bed_in_stream_set_block_typegt_bed_in_stream_set_feature_typegt_bed_in_stream_set_thick_feature_typegt_bittab_andgt_bittab_and_equalgt_bittab_bit_is_setgt_bittab_cmpgt_bittab_complementgt_bittab_count_set_bitsgt_bittab_deletegt_bittab_equalgt_bittab_get_all_bitnumsgt_bittab_get_first_bitnumgt_bittab_get_last_bitnumgt_bittab_get_next_bitnumgt_bittab_nandgt_bittab_newgt_bittab_orgt_bittab_or_equalgt_bittab_set_bitgt_bittab_shift_left_equalgt_bittab_shift_right_equalgt_bittab_showgt_bittab_sizegt_bittab_unsetgt_bittab_unset_bitgt_block_caption_is_visiblegt_block_clonegt_block_deletegt_block_get_captiongt_block_get_rangegt_block_get_range_ptrgt_block_get_sizegt_block_get_strandgt_block_get_top_level_featuregt_block_has_only_one_fullsize_elementgt_block_mergegt_block_newgt_block_new_from_nodegt_block_refgt_block_set_captiongt_block_set_caption_visibilitygt_block_set_strandgt_bsearch_allgt_bsearch_all_markgt_bsearch_datagt_callocgt_canvas_cairo_context_newgt_canvas_cairo_file_newgt_canvas_cairo_file_to_filegt_canvas_cairo_file_to_streamgt_canvas_deletegt_canvas_get_heightgt_color_deletegt_color_equalsgt_color_newgt_color_setgt_comment_node_get_commentgt_comment_node_newgt_countingsortgt_countingsort_get_maxgt_cstr_dupgt_cstr_dup_ntgt_cstr_length_up_to_chargt_cstr_repgt_cstr_rtrimgt_cstr_showgt_cstr_table_addgt_cstr_table_deletegt_cstr_table_getgt_cstr_table_get_allgt_custom_track_deletegt_custom_track_gc_content_newgt_custom_track_refgt_custom_track_script_wrapper_newgt_diagram_add_custom_trackgt_diagram_deletegt_diagram_get_rangegt_diagram_newgt_diagram_new_from_arraygt_diagram_reset_track_selector_funcgt_diagram_set_track_selector_funcgt_dlist_addgt_dlist_deletegt_dlist_examplegt_dlist_findgt_dlist_firstgt_dlist_lastgt_dlist_newgt_dlist_removegt_dlist_sizegt_dlistelem_get_datagt_dlistelem_nextgt_dlistelem_previousgt_encseq_alphabetgt_encseq_builder_add_cstrgt_encseq_builder_add_encodedgt_encseq_builder_add_strgt_encseq_builder_buildgt_encseq_builder_create_des_tabgt_encseq_builder_create_sds_tabgt_encseq_builder_create_ssp_tabgt_encseq_builder_create_tis_tabgt_encseq_builder_deletegt_encseq_builder_disable_description_supportgt_encseq_builder_disable_multiseq_supportgt_encseq_builder_disable_range_iteratorgt_encseq_builder_do_not_create_des_tabgt_encseq_builder_do_not_create_sds_tabgt_encseq_builder_do_not_create_ssp_tabgt_encseq_builder_do_not_create_tis_tabgt_encseq_builder_enable_description_supportgt_encseq_builder_enable_multiseq_supportgt_encseq_builder_enable_range_iteratorgt_encseq_builder_newgt_encseq_builder_resetgt_encseq_builder_set_loggergt_encseq_create_reader_with_directiongt_encseq_create_reader_with_readmodegt_encseq_deletegt_encseq_descriptiongt_encseq_encoder_create_des_tabgt_encseq_encoder_create_sds_tabgt_encseq_encoder_create_ssp_tabgt_encseq_encoder_create_tis_tabgt_encseq_encoder_deletegt_encseq_encoder_disable_description_supportgt_encseq_encoder_disable_multiseq_supportgt_encseq_encoder_do_not_create_des_tabgt_encseq_encoder_do_not_create_sds_tabgt_encseq_encoder_do_not_create_ssp_tabgt_encseq_encoder_do_not_create_tis_tabgt_encseq_encoder_enable_description_supportgt_encseq_encoder_enable_multiseq_supportgt_encseq_encoder_encodegt_encseq_encoder_newgt_encseq_encoder_set_input_dnagt_encseq_encoder_set_input_proteingt_encseq_encoder_set_loggergt_encseq_encoder_set_progresstimergt_encseq_encoder_use_representationgt_encseq_encoder_use_symbolmap_filegt_encseq_extract_decodedgt_encseq_extract_substringgt_encseq_filenamesgt_encseq_get_encoded_chargt_encseq_loader_deletegt_encseq_loader_disable_range_iteratorgt_encseq_loader_do_not_require_des_tabgt_encseq_loader_do_not_require_sds_tabgt_encseq_loader_do_not_require_ssp_tabgt_encseq_loader_do_not_require_tis_tabgt_encseq_loader_drop_description_supportgt_encseq_loader_drop_multiseq_supportgt_encseq_loader_enable_range_iteratorgt_encseq_loader_loadgt_encseq_loader_newgt_encseq_loader_require_des_tabgt_encseq_loader_require_description_supportgt_encseq_loader_require_multiseq_supportgt_encseq_loader_require_sds_tabgt_encseq_loader_require_ssp_tabgt_encseq_loader_require_tis_tabgt_encseq_loader_set_loggergt_encseq_num_of_sequencesgt_encseq_reader_deletegt_encseq_reader_next_decoded_chargt_encseq_reader_next_encoded_chargt_encseq_reader_reinit_with_directiongt_encseq_reader_reinit_with_readmodegt_encseq_refgt_encseq_seqlengthgt_encseq_seqnumgt_encseq_seqstartposgt_encseq_total_lengthgt_error_checkgt_error_deletegt_error_getgt_error_is_setgt_error_newgt_error_setgt_error_set_nonvariadicgt_error_unsetgt_error_vsetgt_feature_index_add_feature_nodegt_feature_index_add_gff3filegt_feature_index_add_region_nodegt_feature_index_deletegt_feature_index_get_features_for_rangegt_feature_index_get_features_for_seqidgt_feature_index_get_first_seqidgt_feature_index_get_range_for_seqidgt_feature_index_get_seqidsgt_feature_index_has_seqidgt_feature_index_memory_newgt_feature_node_add_attributegt_feature_node_add_childgt_feature_node_get_attributegt_feature_node_get_attribute_listgt_feature_node_get_phasegt_feature_node_get_scoregt_feature_node_get_sourcegt_feature_node_get_strandgt_feature_node_get_typegt_feature_node_has_sourcegt_feature_node_has_typegt_feature_node_iterator_deletegt_feature_node_iterator_newgt_feature_node_iterator_new_directgt_feature_node_iterator_nextgt_feature_node_newgt_feature_node_new_standard_genegt_feature_node_score_is_definedgt_feature_node_set_attributegt_feature_node_set_phasegt_feature_node_set_scoregt_feature_node_set_sourcegt_feature_node_set_strandgt_feature_node_set_typegt_feature_node_unset_scoregt_file_deletegt_file_dirnamegt_file_estimate_sizegt_file_existsgt_file_find_in_envgt_file_find_in_pathgt_file_is_newergt_file_newgt_file_number_of_linesgt_file_suffixgt_file_xfputsgt_files_estimate_total_sizegt_files_guess_if_protein_sequencesgt_freegt_free_funcgt_genome_node_add_user_datagt_genome_node_deletegt_genome_node_get_endgt_genome_node_get_filenamegt_genome_node_get_line_numbergt_genome_node_get_rangegt_genome_node_get_seqidgt_genome_node_get_startgt_genome_node_get_user_datagt_genome_node_refgt_genome_node_release_user_datagt_genome_node_set_rangegt_gff3_in_stream_check_id_attributesgt_gff3_in_stream_new_sortedgt_gff3_in_stream_new_unsortedgt_gff3_in_stream_show_progress_bargt_gff3_out_stream_newgt_gff3_out_stream_retain_id_attributesgt_gff3_out_stream_set_fasta_widthgt_graphics_deletegt_graphics_draw_arrowheadgt_graphics_draw_boxgt_graphics_draw_caretgt_graphics_draw_colored_textgt_graphics_draw_curve_datagt_graphics_draw_dashesgt_graphics_draw_horizontal_linegt_graphics_draw_linegt_graphics_draw_rectanglegt_graphics_draw_textgt_graphics_draw_text_centeredgt_graphics_draw_text_clipgt_graphics_draw_text_leftgt_graphics_draw_text_rightgt_graphics_draw_vertical_linegt_graphics_get_image_heightgt_graphics_get_image_widthgt_graphics_get_text_heightgt_graphics_get_text_widthgt_graphics_get_xmarginsgt_graphics_get_ymarginsgt_graphics_save_to_filegt_graphics_save_to_streamgt_graphics_set_background_colorgt_graphics_set_fontgt_graphics_set_marginsgt_grepgt_gtf_in_stream_newgt_hashmap_addgt_hashmap_deletegt_hashmap_foreachgt_hashmap_foreach_in_key_ordergt_hashmap_foreach_orderedgt_hashmap_getgt_hashmap_newgt_hashmap_removegt_hashmap_resetgt_image_info_deletegt_image_info_get_heightgt_image_info_get_rec_mapgt_image_info_newgt_image_info_num_of_rec_mapsgt_interval_tree_deletegt_interval_tree_find_all_overlappinggt_interval_tree_find_first_overlappinggt_interval_tree_insertgt_interval_tree_newgt_interval_tree_node_get_datagt_interval_tree_node_newgt_interval_tree_sizegt_interval_tree_traversegt_is_little_endiangt_layout_deletegt_layout_get_heightgt_layout_newgt_layout_new_with_twcgt_layout_set_track_ordering_funcgt_layout_sketchgt_lib_cleangt_lib_initgt_lib_reg_atexit_funcgt_log_enablegt_log_enabledgt_log_fpgt_log_loggt_log_set_fpgt_log_vloggt_logger_disablegt_logger_enablegt_logger_enabledgt_logger_loggt_logger_log_forcegt_logger_log_vagt_logger_newgt_logger_set_targetgt_logger_targetgt_mallocgt_msortgt_msort_rgt_node_stream_castgt_node_stream_class_newgt_node_stream_creategt_node_stream_deletegt_node_stream_is_sortedgt_node_stream_nextgt_node_stream_pullgt_node_stream_refgt_parse_doublegt_parse_intgt_parse_longgt_parse_rangegt_parse_range_tidygt_parse_uintgt_parse_ulonggt_phase_getgt_progress_timer_deletegt_progress_timer_newgt_progress_timer_start_new_stategt_progress_timer_use_bargt_qsort_rgt_range_comparegt_range_compare_with_deltagt_range_containsgt_range_joingt_range_lengthgt_range_offsetgt_range_overlapgt_range_overlap_deltagt_range_withingt_readmode_parsegt_readmode_showgt_reallocgt_rec_map_get_genome_featuregt_rec_map_get_northwest_xgt_rec_map_get_northwest_ygt_rec_map_get_southeast_xgt_rec_map_get_southeast_ygt_rec_map_has_omitted_childrengt_region_node_newgt_sequence_node_get_descriptiongt_sequence_node_get_sequencegt_sequence_node_get_sequence_lengthgt_sequence_node_newgt_splitter_deletegt_splitter_get_tokengt_splitter_get_tokensgt_splitter_newgt_splitter_resetgt_splitter_sizegt_splitter_splitgt_str_append_chargt_str_append_cstrgt_str_append_cstr_ntgt_str_append_doublegt_str_append_intgt_str_append_strgt_str_append_uintgt_str_append_ulonggt_str_array_addgt_str_array_add_cstrgt_str_array_add_cstr_ntgt_str_array_deletegt_str_array_getgt_str_array_newgt_str_array_refgt_str_array_set_sizegt_str_array_sizegt_str_clonegt_str_cmpgt_str_deletegt_str_getgt_str_lengthgt_str_newgt_str_new_cstrgt_str_refgt_str_resetgt_str_setgt_str_set_lengthgt_strand_getgt_style_clonegt_style_deletegt_style_is_unsafegt_style_load_filegt_style_load_strgt_style_newgt_style_refgt_style_reloadgt_style_safe_modegt_style_set_boolgt_style_set_colorgt_style_set_numgt_style_set_strgt_style_to_strgt_style_unsafe_modegt_style_unsetgt_text_width_calculator_cairo_newgt_text_width_calculator_deletegt_text_width_calculator_get_text_widthgt_text_width_calculator_refgt_timer_deletegt_timer_newgt_timer_showgt_timer_show_formattedgt_timer_startgt_timer_stopgt_translator_codon2aminogt_translator_deletegt_translator_find_startcodongt_translator_nextgt_translator_set_translation_schemegt_translator_startgt_translator_translate_stringgt_version_checkgt_warninggt_warning_default_handlergt_warning_disablegt_warning_get_datagt_warning_get_handlergt_warning_set_handlergt_xatexitgt_xfclosegt_xfflushgt_xfgetcgt_xfgetposgt_xfgetsgt_xfopengt_xfputcgt_xfputsgt_xfreadgt_xfseekgt_xfsetposgt_xfwritegt_xputchargt_xputsgt_xremovegt_xungetcgt_xvfprintfgt_xvsnprintf