| 1 |
/** |
| 2 |
|
| 3 |
Copyright (c) 2010-2014, Daniel S. Standage and CONTRIBUTORS |
| 4 |
|
| 5 |
The AEGeAn Toolkit is distributed under the ISC License. See |
| 6 |
the 'LICENSE' file in the AEGeAn source code distribution or |
| 7 |
online at https://github.com/standage/AEGeAn/blob/master/LICENSE. |
| 8 |
|
| 9 |
**/ |
| 10 |
#ifndef AEGEAN_TRANSCRIPT_CLIQUE |
| 11 |
#define AEGEAN_TRANSCRIPT_CLIQUE |
| 12 |
|
| 13 |
#include "extended/feature_node_api.h" |
| 14 |
#include "core/hashmap_api.h" |
| 15 |
#include "AgnUnitTest.h" |
| 16 |
#include "AgnUtils.h" |
| 17 |
|
| 18 |
/** |
| 19 |
* @class AgnTranscriptClique |
| 20 |
* |
| 21 |
* The purpose of the AgnTranscriptClique class is to store data pertaining to |
| 22 |
* an individual maximal transcript clique. This clique may only contain a |
| 23 |
* single transcript, or it may contain many. The only stipulation is that the |
| 24 |
* transcripts do not overlap. Under the hood, each ``AgnTranscriptClique`` |
| 25 |
* instance is a pseudo node (a GtFeatureNode object) with one or more |
| 26 |
* transcript features as direct children. |
| 27 |
*/ |
| 28 |
typedef GtGenomeNode AgnTranscriptClique; |
| 29 |
|
| 30 |
/** |
| 31 |
* @functype |
| 32 |
* The signature that functions must match to be applied to each transcript in |
| 33 |
* the given clique. The function will be called once for each transcript in the |
| 34 |
* clique. The transcript will be passed as the first argument, and a second |
| 35 |
* argument is available for an optional pointer to supplementary data (if |
| 36 |
* needed). See :c:func:`agn_transcript_clique_traverse`. |
| 37 |
*/ |
| 38 |
typedef void (*AgnCliqueVisitFunc)(GtFeatureNode*, void*); |
| 39 |
|
| 40 |
|
| 41 |
/** |
| 42 |
* @function Add a transcript to this clique. |
| 43 |
*/ |
| 44 |
void agn_transcript_clique_add(AgnTranscriptClique *clique, |
| 45 |
GtFeatureNode *transcript); |
| 46 |
|
| 47 |
/** |
| 48 |
* @function Get the combined CDS length (in base pairs) for all transcripts in |
| 49 |
* this clique. |
| 50 |
*/ |
| 51 |
GtUword agn_transcript_clique_cds_length(AgnTranscriptClique *clique); |
| 52 |
|
| 53 |
/** |
| 54 |
* @function Make a shallow copy of this transcript clique. |
| 55 |
*/ |
| 56 |
AgnTranscriptClique* agn_transcript_clique_copy(AgnTranscriptClique *clique); |
| 57 |
|
| 58 |
/** |
| 59 |
* @function Class destructor. |
| 60 |
*/ |
| 61 |
void agn_transcript_clique_delete(AgnTranscriptClique *clique); |
| 62 |
|
| 63 |
/** |
| 64 |
* @function Get a pointer to the string representing this clique's transcript |
| 65 |
* structure. |
| 66 |
*/ |
| 67 |
const char *agn_transcript_clique_get_model_vector(AgnTranscriptClique *clique); |
| 68 |
|
| 69 |
/** |
| 70 |
* @function Determine whether any of the transcript IDs associated with this |
| 71 |
* clique are keys in the given hash map. |
| 72 |
*/ |
| 73 |
bool agn_transcript_clique_has_id_in_hash(AgnTranscriptClique *clique, |
| 74 |
GtHashmap *map); |
| 75 |
|
| 76 |
/** |
| 77 |
* @function Retrieve the ID attribute of the transcript associated with this |
| 78 |
* clique. User is responsible to free the string. |
| 79 |
*/ |
| 80 |
char *agn_transcript_clique_id(AgnTranscriptClique *clique); |
| 81 |
|
| 82 |
/** |
| 83 |
* @function Retrieve the ID attributes of all transcripts associated with this |
| 84 |
* clique. |
| 85 |
*/ |
| 86 |
GtArray *agn_transcript_clique_ids(AgnTranscriptClique *clique); |
| 87 |
|
| 88 |
/** |
| 89 |
* @function Class constructor. ``locusrange`` should be a pointer to the |
| 90 |
* genomic coordinates of the locus to which this transcript clique belongs. |
| 91 |
*/ |
| 92 |
AgnTranscriptClique *agn_transcript_clique_new(AgnSequenceRegion *region); |
| 93 |
|
| 94 |
/** |
| 95 |
* @function Get the number of exons in this clique. |
| 96 |
*/ |
| 97 |
GtUword agn_transcript_clique_num_exons(AgnTranscriptClique *clique); |
| 98 |
|
| 99 |
/** |
| 100 |
* @function Get the number of UTR segments in this clique. |
| 101 |
*/ |
| 102 |
GtUword agn_transcript_clique_num_utrs(AgnTranscriptClique *clique); |
| 103 |
|
| 104 |
/** |
| 105 |
* @function Add all of the IDs associated with this clique to the given hash |
| 106 |
* map. |
| 107 |
*/ |
| 108 |
void agn_transcript_clique_put_ids_in_hash(AgnTranscriptClique *clique, |
| 109 |
GtHashmap *map); |
| 110 |
|
| 111 |
/** |
| 112 |
* @function Get the number of transcripts in this clique. |
| 113 |
*/ |
| 114 |
GtUword agn_transcript_clique_size(AgnTranscriptClique *clique); |
| 115 |
|
| 116 |
/** |
| 117 |
* @function Get an array containing all the transcripts in this clique. User is |
| 118 |
* responsible for deleting the array. |
| 119 |
*/ |
| 120 |
GtArray* agn_transcript_clique_to_array(AgnTranscriptClique *clique); |
| 121 |
|
| 122 |
/** |
| 123 |
* @function Print the transcript clique to the given outstream in GFF3 format, |
| 124 |
* optionally with a prefix. |
| 125 |
*/ |
| 126 |
void agn_transcript_clique_to_gff3(AgnTranscriptClique *clique, FILE *outstream, |
| 127 |
const char *prefix); |
| 128 |
|
| 129 |
/** |
| 130 |
* @function Apply ``func`` to each transcript in the clique. See |
| 131 |
* :c:type:`AgnCliqueVisitFunc`. |
| 132 |
*/ |
| 133 |
void agn_transcript_clique_traverse(AgnTranscriptClique *clique, |
| 134 |
AgnCliqueVisitFunc func, void *funcdata); |
| 135 |
|
| 136 |
/** |
| 137 |
* @function Run unit tests for this class. Returns true if all tests passed. |
| 138 |
*/ |
| 139 |
bool agn_transcript_clique_unit_test(AgnUnitTest *test); |
| 140 |
|
| 141 |
#endif |