-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
186 lines (165 loc) · 7.32 KB
/
main.cpp
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
#include "Genoma.h"
#include <iostream>
#include <stdlib.h>
#include <string>
using namespace std;
// Funciones de Estetica
void genetica();
void caballo();
int main() {
// Variables
string comando;
Genoma genoma;
genetica();
//cargar test_genome.fa
//codificar test_genome.fabin
//ruta_mas_corta Full_SEQUENCE 0 0 1 44
//base_remota Full_SEQUENCE 0 0
//cargar AligSeq85678-lin.fa
//codificar AligSeq85678-lin.fabin
while (true) {
cout << "$";
getline(cin, comando);
if (comando == "");
else if (comando == "listar_secuencias") {
list<string> lista = genoma.listarSecuencias();
list<string>::iterator it = lista.begin();
for (; it != lista.end(); it++)
cout << "\t" << *it << endl;
cout << endl;
}
else if (comando == "conteo") {
string cnt = genoma.conteo();
cout << "\t" << cnt << endl << endl;
}
else if (comando == "cls") {
system("clear");
genetica();
}
else if (comando == "salir") {
system("clear");
cout << "Saliendo... HIIIII" << endl;
caballo();
return 0;
}
else {
string buffer = comando, arg;
istringstream i(buffer);
i >> comando;
i >> arg;
if (comando == "cargar") {
cout << "\t";
arg = "ArchivosFasta/" + arg;
int retorno = genoma.cargarInfoArchivo(arg);
if (retorno == -1)
cout << arg << " no se encuentra o no puede leerse." << endl << endl;
else if (retorno == 0)
cout << arg << " no contiene ninguna secuencia." << endl << endl;
else if (retorno == 1)
cout << "1 secuencia cargada correctamente desde " << arg << "." << endl << endl;
else
cout << retorno << " secuencias cargadas correctamente desde " << arg << "." << endl << endl;
}
else if (comando == "histograma") {
list<string> lista = genoma.listarhistograma(arg);
list<string>::iterator it = lista.begin();
for (; it != lista.end(); it++)
cout << "\t" << *it << endl;
cout << endl;
}
else if (comando == "codificar") {
cout << "\t";
if(arg != ""){
arg = "ArchivosFasta/"+arg;
if(!genoma.codificar(arg))
cout << "No se pueden guardar las secuencias cargadas en " << arg << endl << endl;
else
cout << "Secuencias codificadas y almacenadas en " << arg << endl << endl;
}
}
else if (comando == "decodificar") {
cout << "\t";
if(arg != ""){
arg = "ArchivosFasta/"+arg;
if(!genoma.decodificar(arg))
cout << "No se pueden cargar las secuencias en " << arg << endl << endl;
else
cout << "Secuencias decodificadas desde " << arg << " y cargadas en memoria." << endl << endl;
}
}
else if(comando == "ruta_mas_corta"){
int ic, j, x, y;
i >> ic; i >> j; i >> x; i >> y;
list<string> lista = genoma.rutaMasCorta(arg, ic, j, x, y);
list<string>::iterator it = lista.begin();
it++;
cout << "\t";
cout << "Para la secuencia " << arg << endl;
cout << "\tLa ruta más corta entre la base en [" << ic << "," << j << "] y la base en [" << x << "," << y << "] es: \n\t\t";
for(; it != lista.end() ; it++)
cout << *it;
cout << endl << "\tEl costo total de la ruta es: " << *lista.begin() << endl << endl;
}
else if (comando == "base_remota"){
int ic, j;
string coordenadasRemotas;
i >> ic; i >> j;
list<string> lista = genoma.rutaBaseRemota(arg, ic, j);
list<string>::iterator it = lista.begin();
it++;
coordenadasRemotas = *it;
it++;
cout << "\t";
cout << "Para la secuencia " << arg << "," << endl;
cout << "\tla base remota esta ubicada en [" << coordenadasRemotas << "]," << endl;
cout << "\tY la ruta entre la base en ["<< ic << "," <<j<< "] y la base remota en ["<< coordenadasRemotas << "] es: \n\t\t";
for (; it != lista.end(); it++)
cout << *it;
it = lista.begin();
cout << endl << "\tEl costo total de la ruta es: "<< *it << endl << endl;
}
else
cout << "\tComando invalido " << endl << endl;
}
}
}
void genetica() {
cout << " -----------------------------------------------------------------" << endl;
cout << "| _____ ______ _ _ ______ _______ _____ _____ |" << endl;
cout << "| / ____|| ____|| \\ | || ____||__ __||_ _|/ ____| /\\ |" << endl;
cout << "| | | __ | |__ | \\| || |__ | | | | | | / \\ |" << endl;
cout << "| | | |_ || __| | . ` || __| | | | | | | / /\\ \\ |" << endl;
cout << "| | |__| || |____ | |\\ || |____ | | _| |_| |____ / ____ \\ |" << endl;
cout << "| \\_____||______||_| \\_||______| |_| |_____|\\_____|/_/ \\_\\ |" << endl;
cout << " -----------------------------------------------------------------" << endl << endl;
}
void caballo() {
cout << " ▒" << endl;
cout << " ▒▒▒" << endl;
cout << " ▒▒░▒" << endl;
cout << " ▒▒░░▒" << endl;
cout << " ████▒▒▒░░▒" << endl;
cout << " ███████▒▒░░▒█" << endl;
cout << " █████████▒▒████" << endl;
cout << " ████████▒█▒▒█████" << endl;
cout << " ████████▒▒▒▒██████" << endl;
cout << " ████████▒▒▒▒▒███████" << endl;
cout << " ██████▒█▒▒▒▒▒████████" << endl;
cout << " ████▒█▒▒▒▒▒▒▒██████████" << endl;
cout << " ░▒▒▒░▒▒▒▒▒▒▒███████████" << endl;
cout << " ░▒▒▒▒██░▒▒▒▒▒▒███████████" << endl;
cout << " ░▒▒▒▒██░▒▒▒▒▒▒███████████" << endl;
cout << " ░▒▒▒▒▒▒▒▒▒▒▒▒▒▒█▒█████████" << endl;
cout << " ░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█████████" << endl;
cout << " ░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██▒██████" << endl;
cout << " ░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██▒██████" << endl;
cout << " ░▒█▒▒▒▒▒▒▒▒▒▒▒░ ░▒▒█▒▒██████" << endl;
cout << " ░▒██▒▒▒▒▒▒▒▒░░ ░▒▒▒▒██████" << endl;
cout << " ░▒▒▒▒▒▒█▒░░ ░▒▒▒██▒███" << endl;
cout << " ░▒▒▒▒▒█▒▒░ ░▒▒▒██▒███" << endl;
cout << " ░▒▒▒██▒░ ░▒▒██▒███" << endl;
cout << " ▒█▒░ ░▒▒█▒███" << endl;
cout << " ░▒▒█▒███" << endl;
cout << " ░▒▒▒███" << endl;
cout << " ░▒░█░█" << endl;
}