Fixes for failed test cases (most was due to the data being used or problems with...
[jabaws.git] / binaries / src / tcoffee / t_coffee_source / fast_tree_header.h
1 /*!
2  * Node of a Tree
3  */
4 typedef struct
5 {
6         ///number of this node
7         int name;
8         ///left child
9         int left;
10         ///right child
11         int right;
12 //  ///weight of the node
13 //      double weight;
14         ///position of the leafs during construction
15         int *index;
16         ///position of...
17         int *index2;
18         ///number of leafes below this node
19         int num_leafs;
20 }
21 Tree_fastal;
22
23
24
25 /*!
26  * Saves all important paramters for the PartTree algorithm
27  *
28  */
29 typedef struct
30 {
31         ///Size of the ktup
32         short ktup;
33         ///power
34         short ng;
35         ///number of possible ktup
36         int tsize;
37         ///subgroup size
38         int subgroup;
39         ///File with the ktup tables
40         FILE *ktup_table_f;
41         ///Index of the positions in the ktup file
42         long *ktup_positions;
43         ///number of sequences
44         int num_sequences;
45         ///length of the sequences
46         int *seq_lengths;
47         ///threshold for filter
48         double threshold;
49         /*! \brief An Integer array to save the tree
50         *
51         * Always three fields in this array belong together. The first two denote the number of the children the third one the number of the current node.
52         */
53         Tree_fastal *tree;
54         /// Current position in the tree
55         int pos_tree;
56 }
57 PartTree_param;
58
59
60
61 //*******************************   METHODS   ***********************************
62
63
64 //*********** ktup-distance ***************
65 void makepointtable_fast(int *coded_seq, int ktup, int ng, int length);
66 void makecompositiontable_fastal(FILE* tables_f, int *table, int *pointt, int length);
67 void get_table(short *table, FILE *tables, long index);
68
69
70
71 void make_fast_tree(char *file_name, int n, int ktup);
72 int make_pos_len_index_of_file(char *file_name, char *ktable_f, long **file_positions, int **seq_lengths, int ktup, int is_dna);
73 int make_pos_len_index_of_file_retree(char *file_name, long **file_positions, int **seq_lengths);
74 // void ktup_one2all(FILE *seq_f, int* file_positions, int *least_similar);
75
76
77 int **make_distance_matrix(FILE *table_f, long *file_positions, int *sequence_group, int number, int **dist_mat);
78 int euclidean_dist(FILE* ktup_f, long pos1, long pos2, short *table1, short *table2, int length);
79 int euclidean_dist_half(FILE* ktup_f, long pos2, short *table1, short *table2, int length);
80
81 void partTree_r(PartTree_param *param_set);
82 void partTree_retree(PartTree_param *param_set);
83 void make_partTree(char *sequence_f, char *tree_f, int ktup, int subgroup, int is_dna, int retree);
84
85 int filter(int *sequence_group, int **dist_mat, int *seed_set_cleaned, PartTree_param *param_set);
86 int fast_aln2sim_mat2 (char *seq1, char *seq2);
87
88
89
90
91
92
93
94 /**
95  * \brief Struct to save the features for a set of sequences.
96  * 
97  */
98 typedef struct
99 {
100         /// The number of this sequence.
101         int seq_number;
102         /// The feature to use in qsort.
103         int *elem_2_compare;
104         /// An element of features.
105         double *features;
106 }
107 Cluster_info;
108
109
110 int                             cluster_recursive(int start, int end, Cluster_info* matrix, int dim, double *mean, double *variance, int *elem_2_compare, FILE* tree_f, int *node);
111 int*                    recode_sequence(char * seq, int seq_length, int *char2value, int alphabet_size, int word_length);
112 double*                 get_features(int *recoded_seq, int seq_length, int k_tup, int max_coding, int max_dist, int num_features);
113 Cluster_info*   feature_extract(char *seq_file_name, int max_dist, int k_tup, int *char2value, int alphabet_size, int *elem_2_compare, int *num_seq_p, int num_features);
114 void                    compute_oligomer_distance_tree(char *seq_file_name, int* char2value, char *tree_file_name, int max_dist, int word_length, int alphabet_size);
115
116 /******************************COPYRIGHT NOTICE*******************************/
117 /*© Centro de Regulacio Genomica */
118 /*and */
119 /*Cedric Notredame */
120 /*Fri Feb 18 08:27:45 CET 2011 - Revision 596. */
121 /*All rights reserved.*/
122 /*This file is part of T-COFFEE.*/
123 /**/
124 /*    T-COFFEE is free software; you can redistribute it and/or modify*/
125 /*    it under the terms of the GNU General Public License as published by*/
126 /*    the Free Software Foundation; either version 2 of the License, or*/
127 /*    (at your option) any later version.*/
128 /**/
129 /*    T-COFFEE is distributed in the hope that it will be useful,*/
130 /*    but WITHOUT ANY WARRANTY; without even the implied warranty of*/
131 /*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the*/
132 /*    GNU General Public License for more details.*/
133 /**/
134 /*    You should have received a copy of the GNU General Public License*/
135 /*    along with Foobar; if not, write to the Free Software*/
136 /*    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA*/
137 /*...............................................                                                                                      |*/
138 /*  If you need some more information*/
139 /*  cedric.notredame@europe.com*/
140 /*...............................................                                                                                                                                     |*/
141 /**/
142 /**/
143 /*      */
144 /******************************COPYRIGHT NOTICE*******************************/