sequencesMatrix.h
Go to the documentation of this file.
1 /* *****************************************************************************
2 
3  trimAl v2.0: a tool for automated alignment trimming in large-scale
4  phylogenetics analyses.
5 
6  readAl v2.0: a tool for automated alignment conversion among different
7  formats.
8 
9  2009-2019
10  Fernandez-Rodriguez V. (victor.fernandez@bsc.es)
11  Capella-Gutierrez S. (salvador.capella@bsc.es)
12  Gabaldon, T. (tgabaldon@crg.es)
13 
14  This file is part of trimAl/readAl.
15 
16  trimAl/readAl are free software: you can redistribute it and/or modify
17  it under the terms of the GNU General Public License as published by
18  the Free Software Foundation, the last available version.
19 
20  trimAl/readAl are distributed in the hope that it will be useful,
21  but WITHOUT ANY WARRANTY; without even the implied warranty of
22  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  GNU General Public License for more details.
24 
25  You should have received a copy of the GNU General Public License
26  along with trimAl/readAl. If not, see <http://www.gnu.org/licenses/>.
27 
28 ***************************************************************************** */
29 
30 #ifndef STATISTICSFILES_H
31 #define STATISTICSFILES_H
32 
33 #include <iostream>
34 #include <iomanip>
35 
36 #include "Alignment/Alignment.h"
37 
38 using namespace std;
39 
40 // class Alignment;
41 
42 /** \brief Internal Alignment Class that represents a sequences matrix
43  *
44  * A Sequence matrix is a 2D matrix that represents
45  * MSA without any gaps included.\n
46  *
47  * This class stores the alignment sequences matrix.\n It provides
48  * methods to \b build the sequences matrix and print the matrix.\n
49  * It also provides methods for look to a column in the matrix and
50  * for look to value at the position (row, column) in the matrix.\n
51  * See: \n
52  * - Statistics::Consistency::compareAndChoose
53  * - Statistics::Consistency::forceComparison
54  */
56  /**
57  * \brief Number of residues per sequence.
58  */
59  int resNumber;
60  /**
61  * \brief Number of sequences in the matrix.
62  */
64 
65  /**
66  * \brief Matrix container. \n
67  * It contains the sequences and residues of each sequence.
68  */
69  int **matrix;
70 
71  /**
72  * \brief Sequences names container.
73  */
74  string *seqsName;
75 
76 public:
77 
78  /** \brief Null constructor.
79  *
80  * This construction method initializes all attributes
81  * of the new object with 0 or nullptr value.
82  */
84 
85  /** \brief Manual constructor.
86  *
87  * This construction method initializes all attributes
88  * using the information passed as arguments.
89  *
90  * \param alignmentMatrix
91  * Sequences of the alignment to convert to sequenceMatrix
92  * \param alignmentSeqsName
93  * Sequences names
94  * \param sequences
95  * Number of sequences
96  * \param residues
97  * Number of residues
98  */
99  sequencesMatrix(string *alignmentMatrix, string *alignmentSeqsName,
100  int sequences, int residues);
101 
102  /** \brief Automatic constructor.
103  *
104  * This construction method initializes all attributes
105  * using the information present in the alignment pointer passed.
106  *
107  * \param parent Alignment to associate the sequences matrix to.
108  */
109  explicit sequencesMatrix(Alignment *parent);
110 
112 
113  /**
114  * \brief Destructor.
115  *
116  * Destruction method that frees, if exists, previously allocated memory.
117  */
118  ~sequencesMatrix();
119 
120  /** \brief Sequences Matrix printing method.
121  *
122  * Method that prints the alignment sequences matrix.
123  *
124  * \warning Not In Use
125  */
126  void printMatrix();
127 
128  /** \brief Method to get a column out of the matrix
129  * \param column
130  * Column number at sequences matrix.
131  * \param [out] numResidueseqMatrix
132  * Vector where storage a column's sequences matrix.
133  *
134  * Method that storages a column's sequences matrix in a vector.
135  */
136  void getColumn(int column, int *numResidueseqMatrix);
137 
138  /** \brief
139  * Method that looks to value in a row and stores a column's,
140  * corresponding to row, sequences matrix in a vector.
141  * \param value to look in a row's sequences matrix.
142  * \param row where to look for a value.
143  * \param columnSeqMatrix Vector where storage a column's sequences matrix.
144  *
145  */
146  void getColumn(int value, int row, int *columnSeqMatrix);
147 
148  /**
149  * \brief Method that reorders the stored sequences with a given order list.
150  * \param order Pointer that contains the new order we want to give the matrix.
151  */
152  void setOrder(int *order);
153 
154  /**
155  * \brief Method to obtain a sequence based on its name.
156  * \param seqName Name of the sequence to find.
157  * \param[out] sequence Where to store the sequence.
158  * \return \b True if found. \b False if not.
159  */
160  bool getSequence(string seqName, int *sequence);
161 
162  /**
163  * \brief Number of sequences getter.
164  * \return Number of sequences.
165  */
166  int getSeqNumber();
167 
168  /**
169  * \brief Number of residues getter.
170  * \return Number of residues.
171  */
172  int getResidNumber();
173 
174 private:
175  /**
176  * \brief Pointer to the alignment this object is related to.
177  */
179 };
180 
181 #endif
Alignment * alig
Pointer to the alignment this object is related to.
int getSeqNumber()
Number of sequences getter.
sequencesMatrix(string *alignmentMatrix, string *alignmentSeqsName, int sequences, int residues)
Manual constructor.
int resNumber
Number of residues per sequence.
Class containing an alignment This class stores the alignment sequences with it&#39;s names...
Definition: Alignment.h:49
void getColumn(int column, int *numResidueseqMatrix)
Method to get a column out of the matrix.
sequencesMatrix & operator=(const sequencesMatrix &)
bool getSequence(string seqName, int *sequence)
Method to obtain a sequence based on its name.
int getResidNumber()
Number of residues getter.
sequencesMatrix()
Null constructor.
void getColumn(int value, int row, int *columnSeqMatrix)
Method that looks to value in a row and stores a column&#39;s, corresponding to row, sequences matrix in ...
void printMatrix()
Sequences Matrix printing method.
Internal Alignment Class that represents a sequences matrix.
void setOrder(int *order)
Method that reorders the stored sequences with a given order list.
string * seqsName
Sequences names container.
int seqsNumber
Number of sequences in the matrix.
int ** matrix
Matrix container. It contains the sequences and residues of each sequence.
sequencesMatrix(Alignment *parent)
Automatic constructor.