forked from Jaffar-Hussein/PhyloExplora
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.h
92 lines (77 loc) · 2.12 KB
/
utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*--------------------------------
Master BIBS
Universite Paris-Saclay
Projet MiniInfo 1 2023-2024
Sujet propose par George Marchment
----------------------------------*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
// Escape codes for colors
#define COLOR_RED "\x1b[31m"
#define COLOR_GREEN "\x1b[32m"
#define COLOR_BLUE "\x1b[34m"
#define COLOR_YELLOW "\x1b[33m"
#define COLOR_RESET "\x1b[0m"
#define BOLD_TEXT "\x1b[1m"
#define UNDERLINE_TEXT "\x1b[4m"
#define COLOR_PURPLE "\x1b[35m"
// Sequence
#define ID_MAX_LENGTH 50
#define seq_MAX_LENGTH 400
typedef struct Sequence
{
char ID[ID_MAX_LENGTH];
char seq[seq_MAX_LENGTH];
} Sequence;
void show_sequences_file(char* file);
void set_empty_string(char* str);
void parse_file(char* address, Sequence tab_sequences[]);
void appendString(char* str, char c);
void affiche_sequence(Sequence* sequence);
// Alignment
#define NB_BASE 5
typedef enum Base_Azotee
{
A = 0,
C = 1,
G = 2,
T = 3,
E = 4
} Base_Azotee;
int score_alignement(char* alignement1, char* alignement2);
int get_number_entries(char* address);
void print_quality_alignement(char* ali1, char* ali2, int score);
void set_sequence(Sequence* sequence, char* ID, char* seq);
void needleman_wunsch(Sequence seq1, Sequence seq2, char* alignement1, char* alignement2);
char symbole(int entier);
// Distance Matrix
void show_distance_matrix(char* file_aligne);
void initialise_matrice(int entries, float matrice_distance[][entries]);
void fill_distance_matrix(int entries, float matrice_distance[][entries], Sequence sequences[]);
void print_matrix_float(int row, int col, float matrice_distance[][col]);
// Tree
typedef struct Noeud {
char* valeur;
struct Noeud* suivant_left;
struct Noeud* suivant_right;
int nb_noeud;
} Noeud;
typedef struct Element
{
struct Element *next;
Noeud *data;
} Element;
typedef struct List_Noeuds
{
Element *head;
int nb_elements;
} List_Noeuds;
typedef struct Arbre
{
Noeud *tete;
} Arbre;
void show_tree(char *file_aligne, char Algorithme);