bpp-core3
3.0.0
AAIndex1Entry.cpp
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: The Bio++ Development Group
2
//
3
// SPDX-License-Identifier: CECILL-2.1
4
5
#include <Bpp/Io/FileTools.h>
6
#include <Bpp/Text/StringTokenizer.h>
7
#include <Bpp/Text/TextTools.h>
8
9
#include "
AAIndex1Entry.h
"
10
11
using namespace
bpp
;
12
using namespace
std
;
13
14
AAIndex1Entry::AAIndex1Entry
(std::istream& input) :
15
ProteicAlphabetIndex1
(),
16
property_(20)
17
{
18
// Parse entry:
19
string
line;
20
bool
ok =
false
;
21
do
22
{
23
line = FileTools::getNextLine(input);
24
if
(line[0] ==
'I'
)
25
{
26
string
line1 = FileTools::getNextLine(input);
27
string
line2 = FileTools::getNextLine(input);
28
StringTokenizer st1(line1,
" "
);
29
StringTokenizer st2(line2,
" "
);
30
if
(st1.numberOfRemainingTokens() != 10 || st1.numberOfRemainingTokens() != 10)
31
break
;
32
// Amino acids are in the same order in the AAIndex1 database than in the ProteicAlphabet class:
33
for
(
unsigned
int
i = 0; i < 10; i++)
34
{
35
property_
[i] = TextTools::toDouble(st1.nextToken());
36
}
37
for
(
unsigned
int
i = 10; i < 20; i++)
38
{
39
property_
[i] = TextTools::toDouble(st2.nextToken());
40
}
41
// Jump to next entry...
42
FileTools::getNextLine(input);
43
ok =
true
;
44
}
45
}
46
while
(!ok);
47
if
(!ok)
48
throw
IOException(
"AAIndex1Entry: invalid AAIndex1 entry."
);
49
}
bpp
This alphabet is used to deal NumericAlphabet.
Definition:
AbstractAlphabet.h:18
bpp::ProteicAlphabetIndex1
Definition:
AlphabetIndex1.h:75
bpp::AAIndex1Entry::AAIndex1Entry
AAIndex1Entry(std::istream &input)
Create a new AAIndex1Entry from an input stream.
Definition:
AAIndex1Entry.cpp:14
std
STL namespace.
AAIndex1Entry.h
bpp::AAIndex1Entry::property_
std::vector< double > property_
Definition:
AAIndex1Entry.h:20
Bpp
Seq
AlphabetIndex
AAIndex1Entry.cpp
Generated on Wed Jul 3 2024 11:29:32 for bpp-core3 by
1.8.13