~ubuntu-branches/ubuntu/quantal/genometools/quantal-backports

« back to all changes in this revision

Viewing changes to src/extended/genome_node_api.h

  • Committer: Package Import Robot
  • Author(s): Sascha Steinbiss
  • Date: 2012-07-09 14:10:23 UTC
  • Revision ID: package-import@ubuntu.com-20120709141023-juuu4spm6chqsf9o
Tags: upstream-1.4.1
ImportĀ upstreamĀ versionĀ 1.4.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  Copyright (c) 2006-2011 Gordon Gremme <gremme@zbh.uni-hamburg.de>
 
3
  Copyright (c) 2006-2008 Center for Bioinformatics, University of Hamburg
 
4
 
 
5
  Permission to use, copy, modify, and distribute this software for any
 
6
  purpose with or without fee is hereby granted, provided that the above
 
7
  copyright notice and this permission notice appear in all copies.
 
8
 
 
9
  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 
10
  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 
11
  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 
12
  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 
13
  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 
14
  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 
15
  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
16
*/
 
17
 
 
18
#ifndef GENOME_NODE_API_H
 
19
#define GENOME_NODE_API_H
 
20
 
 
21
#include "core/fptr_api.h"
 
22
#include "core/range_api.h"
 
23
#include "core/str_api.h"
 
24
 
 
25
typedef struct GtGenomeNodeClass GtGenomeNodeClass;
 
26
 
 
27
/* The <GtGenomeNode> interface. The different implementation of the
 
28
   <GtGenomeNode> interface represent different parts of genome annotations (as
 
29
   they are usually found in GFF3 files). */
 
30
typedef struct GtGenomeNode GtGenomeNode;
 
31
 
 
32
#include "extended/node_visitor_api.h"
 
33
 
 
34
/* Increase the reference count for <genome_node> and return it.
 
35
   <genome_node> cannot be <NULL>.*/
 
36
GtGenomeNode* gt_genome_node_ref(GtGenomeNode *genome_node);
 
37
 
 
38
/* Return the sequence ID of <genome_node>.
 
39
   Corresponds to column 1 of GFF3 feature lines. */
 
40
GtStr*        gt_genome_node_get_seqid(GtGenomeNode *genome_node);
 
41
 
 
42
/* Return the genomic range of of <genome_node>.
 
43
   Corresponds to columns 4 and 5 of GFF3 feature lines. */
 
44
GtRange       gt_genome_node_get_range(GtGenomeNode *genome_node);
 
45
 
 
46
/* Return the start of <genome_node>.
 
47
   Corresponds to column 4 of GFF3 feature lines. */
 
48
unsigned long gt_genome_node_get_start(GtGenomeNode *genome_node);
 
49
 
 
50
/* Return the end of <genome_node>.
 
51
   Corresponds to column 5 of GFF3 feature lines. */
 
52
unsigned long gt_genome_node_get_end(GtGenomeNode *genome_node);
 
53
 
 
54
/* Return the length of <genome_node>.
 
55
   Computed from column 4 and 5 of GFF3 feature lines. */
 
56
unsigned long gt_genome_node_get_length(GtGenomeNode *genome_node);
 
57
 
 
58
/* Return the filename the <genome_node> was read from.
 
59
   If the node did not originate from a file, an appropriate string is
 
60
   returned. */
 
61
const char*   gt_genome_node_get_filename(const GtGenomeNode* genome_node);
 
62
 
 
63
/* Return the line of the source file the <genome_node> was encountered on
 
64
   (if the node was read from a file, otherwise 0 is returned). */
 
65
unsigned int  gt_genome_node_get_line_number(const GtGenomeNode*);
 
66
 
 
67
/* Set the genomic range of <genome_node> to given <range>. */
 
68
void          gt_genome_node_set_range(GtGenomeNode *genome_node,
 
69
                                       const GtRange *range);
 
70
 
 
71
/* Attach a pointer to <data> to the <genome_node> using a given string as
 
72
   <key>. <free_func> is the optional destructor for <data>. */
 
73
void          gt_genome_node_add_user_data(GtGenomeNode *genome_node,
 
74
                                           const char *key, void *data,
 
75
                                           GtFree free_func);
 
76
 
 
77
/* Return the pointer attached to the <genome_node> for a given <key>. */
 
78
void*         gt_genome_node_get_user_data(const GtGenomeNode *genome_node,
 
79
                                           const char *key);
 
80
 
 
81
/* Call the destructor function associated with the user data attached to
 
82
   <genome_node> under the <key> on the attached data. */
 
83
void          gt_genome_node_release_user_data(GtGenomeNode *genome_node,
 
84
                                               const char *key);
 
85
 
 
86
/* Compare <genome_node_a> with <genome_node_b> and return the result (similar
 
87
   to <strcmp(3)>). This method is the criterion used to sort genome nodes. */
 
88
int           gt_genome_node_cmp(GtGenomeNode *genome_node_a,
 
89
                                 GtGenomeNode *genome_node_b);
 
90
 
 
91
/* Let <genome_node> accept the <node_visitor>.
 
92
   In the case of an error, -1 is returned and <err> is set accordingly. */
 
93
int           gt_genome_node_accept(GtGenomeNode *genome_node,
 
94
                                    GtNodeVisitor *node_visitor, GtError *err);
 
95
 
 
96
/* Decrease the reference count for <genome_node> or delete it, if this was the
 
97
   last reference. */
 
98
void          gt_genome_node_delete(GtGenomeNode *genome_node);
 
99
 
 
100
#endif