bpp-seq  2.2.0
BppOAlphabetIndex1Format.cpp
Go to the documentation of this file.
1 //
2 // File: BppOAlphabetIndex1Format.cpp
3 // Created by: Julien Dutheil
4 // Created on: Thursday Februar 07th, 16:30
5 //
6 
7 /*
8  Copyright or © or Copr. Bio++ Development Team, (November 16, 2004)
9 
10  This software is a computer program whose purpose is to provide classes
11  for phylogenetic data 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 
41 #include "../Alphabet/AlphabetTools.h"
42 #include "../AlphabetIndex/GranthamAAPolarityIndex.h"
43 #include "../AlphabetIndex/GranthamAAVolumeIndex.h"
44 #include "../AlphabetIndex/KleinAANetChargeIndex.h"
45 #include "../AlphabetIndex/AAChouFasmanAHelixIndex.h"
46 #include "../AlphabetIndex/AAChouFasmanBSheetIndex.h"
47 #include "../AlphabetIndex/AAChouFasmanTurnIndex.h"
48 #include "../AlphabetIndex/AAChenGuHuangHydrophobicityIndex.h"
49 #include "../AlphabetIndex/AASurfaceIndex.h"
50 #include "../AlphabetIndex/AAMassIndex.h"
51 #include "../AlphabetIndex/AAVolumeIndex.h"
52 #include "../AlphabetIndex/AAChargeIndex.h"
53 #include "../AlphabetIndex/AASEAInf10Index.h"
54 #include "../AlphabetIndex/AASEA1030Index.h"
55 #include "../AlphabetIndex/AASEASup30Index.h"
56 #include "../AlphabetIndex/AAIndex1Entry.h"
57 
58 #include <Bpp/Text/KeyvalTools.h>
59 #include <Bpp/App/ApplicationTools.h>
60 
61 #include <string>
62 #include <memory>
63 
64 using namespace bpp;
65 using namespace std;
66 
67 AlphabetIndex1* BppOAlphabetIndex1Format::read(const std::string& description) throw (Exception)
68 {
69  if (description != "None")
70  {
71  string name;
72  map<string, string> args;
73  KeyvalTools::parseProcedure(description, name, args);
74  if (verbose_)
75  ApplicationTools::displayResult(message_, description);
76 
77  //Currently, only protein indices are supported:
78  if (!AlphabetTools::isProteicAlphabet(alphabet_))
79  throw Exception("BppOAlphabetIndex1Format::read. This index is only supported with a protein alphabet.");
80  if (name == "GranthamPolarity")
81  {
82  return new GranthamAAPolarityIndex();
83  }
84  else if (name == "GranthamVolume")
85  {
86  return new GranthamAAVolumeIndex();
87  }
88  else if (name == "KleinCharge")
89  {
90  return new KleinAANetChargeIndex();
91  }
92  else if (name == "ChouFasmanAHelix")
93  {
94  return new AAChouFasmanAHelixIndex();
95  }
96  else if (name == "ChouFasmanBSheet")
97  {
98  return new AAChouFasmanBSheetIndex();
99  }
100  else if (name == "ChouFasmanTurn")
101  {
102  return new AAChouFasmanTurnIndex();
103  }
104  else if (name == "ChenGuHuangHydrophobicity")
105  {
107  }
108  else if (name == "Surface")
109  {
110  return new AASurfaceIndex();
111  }
112  else if (name == "Mass")
113  {
114  return new AAMassIndex();
115  }
116  else if (name == "Volume")
117  {
118  return new AAVolumeIndex();
119  }
120  else if (name == "Charge")
121  {
122  return new AAChargeIndex();
123  }
124  else if (name == "SEAMedium")
125  {
126  return new AASEA1030Index();
127  }
128  else if (name == "SEAHigh")
129  {
130  return new AASEASup30Index();
131  }
132  else if (name == "SEALow")
133  {
134  return new AASEAInf10Index();
135  }
136  else if (name == "User")
137  {
138  string aax1FilePath = ApplicationTools::getAFilePath("file", args, true, true, "", false);
139  ifstream aax1File(aax1FilePath.c_str(), ios::in);
140  AAIndex1Entry* I = new AAIndex1Entry (aax1File);
141  aax1File.close();
142  return I;
143  }
144  else
145  {
146  throw Exception("Invalid index1 '" + name + "'.");
147  }
148  }
149  else
150  {
151  return 0;
152  }
153 }
154 
Polarity index used in Grantham (1974).
Turn score for the Chou-Fasman algorithm of secondary structure prediction, according to http://prowl...
Percentage of amino acids having a Solvent Exposed Area above 30 Angström^2 for each type of amino ac...
B-sheet score for the Chou-Fasman algorithm of secondary structure prediction, according to http://pr...
This alphabet is used to deal NumericAlphabet.
Surface (Angström^2) of each amino acid, according to http://www.imb-jena.de/IMAGE_AA.html.
STL namespace.
Percentage of amino acids having a Solvent Exposed Area below 10 Angström^2 for each type of amino ac...
Charge of each amino acid.
Volume index used in Grantham (1974).
Mass (dalton) of each amino acid, according to http://www.imb-jena.de/IMAGE_AA.html.
Definition: AAMassIndex.h:52
Percentage of amino acids having a Solvent Exposed Area between 10 and 30 Angström^2 for each type of...
One dimensionnal alphabet index interface.
Charge of each amino acid.
Definition: AAChargeIndex.h:95
A-Helix score for the Chou-Fasman algorithm of secondary structure prediction, according to http://pr...
AlphabetIndex1 * read(const std::string &description)
Read a AlphabetIndex1 object from a string.
Hydrophobicity of each amino acid, according to Table 1 in Chen, Gu and Huang, BMC Bioinformatics 200...
static bool isProteicAlphabet(const Alphabet *alphabet)
Volume (Angström^3) of each amino acid, according to http://www.imb-jena.de/IMAGE_AA.html.
Definition: AAVolumeIndex.h:54
Create a AlphabetIndex1 object from an AAIndex2 entry.
Definition: AAIndex1Entry.h:51