bpp-seq
2.2.0
AAIndex2Entry.cpp
Go to the documentation of this file.
1
//
2
// File: AAIndex2Entry.cpp
3
// Created by: Julien Dutheil
4
// Created on: Fri Jan 19 17:07 2007
5
//
6
7
/*
8
Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
9
10
This software is a computer program whose purpose is to provide classes
11
for sequences analysis.
12
13
This software is governed by the CeCILL license under French law and
14
abiding by the rules of distribution of free software. You can use,
15
modify and/ or redistribute the software under the terms of the CeCILL
16
license as circulated by CEA, CNRS and INRIA at the following URL
17
"http://www.cecill.info".
18
19
As a counterpart to the access to the source code and rights to copy,
20
modify and redistribute granted by the license, users are provided only
21
with a limited warranty and the software's author, the holder of the
22
economic rights, and the successive licensors have only limited
23
liability.
24
25
In this respect, the user's attention is drawn to the risks associated
26
with loading, using, modifying and/or developing or reproducing the
27
software by the user in light of its specific status of free software,
28
that may mean that it is complicated to manipulate, and that also
29
therefore means that it is reserved for developers and experienced
30
professionals having in-depth computer knowledge. Users are therefore
31
encouraged to load and test the software's suitability as regards their
32
requirements in conditions enabling the security of their systems and/or
33
data to be ensured and, more generally, to use and operate it in the
34
same conditions as regards security.
35
36
The fact that you are presently reading this means that you have had
37
knowledge of the CeCILL license and that you accept its terms.
38
*/
39
40
#include "
AAIndex2Entry.h
"
41
#include "../Alphabet/AlphabetTools.h"
42
43
using namespace
bpp
;
44
using namespace
std
;
45
46
#include <Bpp/Io/FileTools.h>
47
#include <Bpp/Text/TextTools.h>
48
#include <Bpp/Text/StringTokenizer.h>
49
50
AAIndex2Entry::AAIndex2Entry
(std::istream& input,
bool
sym)
throw
(IOException) :
51
property_(20, 20),
52
alpha_(&
AlphabetTools::PROTEIN_ALPHABET
),
53
sym_(sym)
54
{
55
// Parse entry:
56
string
line;
57
bool
ok =
false
;
58
bool
diag =
false
;
59
do
60
{
61
line = FileTools::getNextLine(input);
62
if
(line[0] ==
'M'
)
63
{
64
for
(
size_t
i = 0; i < 20; ++i)
65
{
66
line = FileTools::getNextLine(input);
67
StringTokenizer st1(line,
" "
);
68
if
(i == 0 && st1.numberOfRemainingTokens() == 1)
69
{
70
// Lower triangle only:
71
diag =
true
;
72
}
73
// Amino acids are in the same order in the AAIndex1 database than in the ProteicAlphabet class:
74
if
(diag)
75
{
76
if
(st1.numberOfRemainingTokens() != i + 1)
77
break
;
78
for
(
size_t
j = 0; j <= i; ++j)
79
{
80
property_(i, j) = TextTools::toDouble(st1.nextToken());
81
}
82
}
83
else
84
{
85
if
(st1.numberOfRemainingTokens() != 20)
86
break
;
87
for
(
size_t
j = 0; j < 20; ++j)
88
{
89
property_(i, j) = TextTools::toDouble(st1.nextToken());
90
}
91
}
92
}
93
// Jump to next entry...
94
FileTools::getNextLine(input);
95
ok =
true
;
96
}
97
}
98
while
(!ok);
99
if
(!ok)
100
throw
IOException(
"AAIndex2Entry: invalid AAIndex2 entry."
);
101
if
(!diag)
102
sym_ =
false
;
103
}
104
bpp
This alphabet is used to deal NumericAlphabet.
Definition:
AbstractAlphabet.h:54
std
STL namespace.
bpp::AAIndex2Entry::AAIndex2Entry
AAIndex2Entry(std::istream &input, bool sym=true)
Create a new AAIndex2Entry from an input stream.
Definition:
AAIndex2Entry.cpp:50
AAIndex2Entry.h
bpp::AlphabetTools::PROTEIN_ALPHABET
static const ProteicAlphabet PROTEIN_ALPHABET
Definition:
AlphabetTools.h:64
Bpp
Seq
AlphabetIndex
AAIndex2Entry.cpp
Generated on Sat May 23 2020 12:00:21 for bpp-seq by
1.8.14