annotate trimal_repo/source/sequencesMatrix.cpp @ 0:b15a3147e604 draft

"planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
author padge
date Fri, 25 Mar 2022 17:10:43 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
1 /* ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** *****
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
2 ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** *****
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
3
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
4 trimAl v1.4: a tool for automated alignment trimming in large-scale
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
5 phylogenetics analyses.
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
6
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
7 2009-2015 Capella-Gutierrez S. and Gabaldon, T.
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
8 [scapella, tgabaldon]@crg.es
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
9
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
10 This file is part of trimAl.
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
11
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
12 trimAl is free software: you can redistribute it and/or modify
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
13 it under the terms of the GNU General Public License as published by
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
14 the Free Software Foundation, the last available version.
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
15
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
16 trimAl is distributed in the hope that it will be useful,
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
19 GNU General Public License for more details.
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
20
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
21 You should have received a copy of the GNU General Public License
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
22 along with trimAl. If not, see <http://www.gnu.org/licenses/>.
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
23
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
24 ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** *****
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
25 ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** */
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
26
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
27 #include "sequencesMatrix.h"
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
28
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
29 sequencesMatrix::sequencesMatrix(void) {
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
30
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
31 resNumber = 0;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
32 seqsNumber = 0;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
33
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
34 seqsName = NULL;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
35 matrix = NULL;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
36
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
37 }
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
38
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
39 sequencesMatrix::sequencesMatrix(string *alignmentMatrix, string *alignmentSeqsName, int sequences, int residues) {
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
40 int i, j, k;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
41
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
42 /* ***** ***** ***** ***** ***** ***** ***** ***** */
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
43 seqsNumber = sequences;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
44 resNumber = residues;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
45 /* ***** ***** ***** ***** ***** ***** ***** ***** */
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
46
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
47 /* ***** ***** ***** ***** ***** ***** ***** ***** */
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
48 seqsName = new string[seqsNumber];
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
49 for(i = 0; i < seqsNumber; i++)
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
50 seqsName[i] = alignmentSeqsName[i];
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
51 /* ***** ***** ***** ***** ***** ***** ***** ***** */
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
52
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
53 /* ***** ***** ***** ***** ***** ***** ***** ***** */
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
54 matrix = new int*[seqsNumber];
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
55 for(i = 0; i < seqsNumber; i++) {
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
56 matrix[i] = new int[resNumber];
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
57 utils::initlVect(matrix[i], resNumber, 0);
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
58 }
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
59
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
60 /* Determinate the sequence for each alignment specie */
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
61 for(i = 0, k = 1; i < seqsNumber; i++, k = 1) {
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
62 for(j = 0; j < resNumber; j++) {
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
63 if(alignmentMatrix[i][j] != '-') {
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
64 matrix[i][j] = k;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
65 k++;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
66 }
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
67 }
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
68 }
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
69 /* ***** ***** ***** ***** ***** ***** ***** ***** */
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
70 }
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
71
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
72 sequencesMatrix &sequencesMatrix::operator=(const sequencesMatrix &old) {
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
73 int i, j;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
74
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
75 if(this != &old) {
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
76 /* ***** ***** ***** ***** ***** ***** ***** ***** */
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
77 seqsNumber = old.seqsNumber;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
78 resNumber = old.resNumber;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
79 /* ***** ***** ***** ***** ***** ***** ***** ***** */
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
80
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
81 /* ***** ***** ***** ***** ***** ***** ***** ***** */
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
82 seqsName = new string[seqsNumber];
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
83 for(i = 0; i < seqsNumber; i++)
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
84 seqsName[i] = old.seqsName[i];
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
85 /* ***** ***** ***** ***** ***** ***** ***** ***** */
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
86
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
87 /* ***** ***** ***** ***** ***** ***** ***** ***** */
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
88 matrix = new int*[seqsNumber];
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
89 for(i = 0; i < seqsNumber; i++) {
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
90 matrix[i] = new int[resNumber];
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
91 for(j = 0; j < resNumber; j++)
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
92 matrix[i][j] = matrix[i][j];
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
93 }
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
94 /* ***** ***** ***** ***** ***** ***** ***** ***** */
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
95 }
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
96 return *this;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
97 }
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
98
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
99 sequencesMatrix::~sequencesMatrix(void) {
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
100 int i;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
101
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
102 if(matrix != NULL) {
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
103 for(i = 0; i < seqsNumber; i++)
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
104 delete matrix[i];
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
105 delete [] matrix;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
106 }
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
107
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
108 if(seqsName != NULL)
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
109 delete [] seqsName;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
110
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
111 seqsNumber = 0;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
112 resNumber = 0;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
113
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
114 matrix = NULL;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
115 seqsName = NULL;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
116 }
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
117
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
118 void sequencesMatrix::printMatrix(void) {
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
119 int i, j, k;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
120
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
121 for(i = 0; i < resNumber; i += 20) {
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
122 for(j = 0; j < seqsNumber; j++) {
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
123 for(k = i; k < (20 + i) && k < resNumber; k++) {
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
124 cout << setw(4) << matrix[j][k] << " ";
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
125 }
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
126 cout << endl;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
127 }
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
128 cout << endl;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
129 }
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
130 }
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
131
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
132 void sequencesMatrix::getColumn(int column, int *columnSeqMatrix) {
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
133 int i;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
134
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
135 if(column < resNumber)
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
136 for(i = 0; i < seqsNumber; i++)
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
137 columnSeqMatrix[i] = matrix[i][column];
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
138
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
139 else
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
140 for(i = 0; i < seqsNumber; i++)
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
141 columnSeqMatrix[i] = 0;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
142
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
143 }
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
144
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
145 void sequencesMatrix::getColumn(int value, int row, int *columnSeqMatrix) {
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
146 int i, j;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
147
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
148 for(i = 0; i < resNumber; i++)
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
149 if(matrix[row][i] == value) break;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
150
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
151 if(i < resNumber)
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
152 for(j = 0; j < seqsNumber; j++)
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
153 columnSeqMatrix[j] = matrix[j][i];
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
154
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
155 else
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
156 for(j = 0; j < seqsNumber; j++)
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
157 columnSeqMatrix[j] = -1;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
158 }
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
159
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
160 void sequencesMatrix::setOrder(int *order) {
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
161 int i, j, **resg;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
162
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
163 resg = new int*[seqsNumber];
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
164 for(i = 0; i < seqsNumber; i++)
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
165 resg[i] = new int[resNumber];
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
166
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
167 for(i = 0; i < seqsNumber; i++)
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
168 for(j = 0; j < resNumber; j++)
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
169 resg[i][j] = matrix[order[i]][j];
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
170
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
171 for(i = 0; i < seqsNumber; i++) {
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
172 for(j = 0; j < resNumber; j++)
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
173 matrix[i][j] = resg[i][j];
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
174 delete [] resg[i];
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
175 }
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
176 delete [] resg;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
177 }
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
178
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
179 bool sequencesMatrix::getSequence(string seqName, int *sequence) {
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
180 int i, pos;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
181
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
182 /* ***** ***** ***** ***** ***** ***** ***** ***** */
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
183 for(pos = 0; pos < seqsNumber; pos++)
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
184 if(seqsName[pos].compare(seqName) == 0)
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
185 break;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
186 /* ***** ***** ***** ***** ***** ***** ***** ***** */
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
187
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
188 /* ***** ***** ***** ***** ***** ***** ***** ***** */
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
189 if(pos == seqsNumber)
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
190 return false;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
191 /* ***** ***** ***** ***** ***** ***** ***** ***** */
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
192
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
193 /* ***** ***** ***** ***** ***** ***** ***** ***** */
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
194 for(i = 0; i < resNumber; i++)
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
195 sequence[i] = matrix[pos][i];
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
196 /* ***** ***** ***** ***** ***** ***** ***** ***** */
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
197
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
198 return true;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
199 }
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
200
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
201 int sequencesMatrix::getSeqNumber(void) {
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
202 return seqsNumber;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
203 }
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
204
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
205 int sequencesMatrix::getResidNumber(void) {
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
206 return resNumber;
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
207 }
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
208
b15a3147e604 "planemo upload for repository https://github.com/inab/trimal commit cbe1e8577ecb1a46709034a40dff36052e876e7a-dirty"
padge
parents:
diff changeset
209