ARB
SQ_ambiguities.cxx
Go to the documentation of this file.
1 // ============================================================= //
2 // //
3 // File : SQ_ambiguities.cxx //
4 // Purpose : //
5 // //
6 // Institute of Microbiology (Technical University Munich) //
7 // http://www.arb-home.de/ //
8 // //
9 // ============================================================= //
10 
11 #include "SQ_ambiguities.h"
12 #include <arbdb.h>
13 
14 using namespace std;
15 
16 void SQ_ambiguities::SQ_count_ambiguities(const char *iupac, int length, GBDATA *gb_quality) {
17  char c;
18 
19  for (int i = 0; i < length; i++) {
20  c = iupac[i];
21  switch (c) {
22  case 'R':
23  number++;
24  iupac_value = iupac_value + 2;
25  break;
26  case 'Y':
27  number++;
28  iupac_value = iupac_value + 3;
29  break;
30  case 'M':
31  number++;
32  iupac_value = iupac_value + 2;
33  break;
34  case 'K':
35  number++;
36  iupac_value = iupac_value + 3;
37  break;
38  case 'W':
39  number++;
40  iupac_value = iupac_value + 3;
41  break;
42  case 'S':
43  number++;
44  iupac_value = iupac_value + 2;
45  break;
46  case 'B':
47  number++;
48  iupac_value = iupac_value + 4;
49  break;
50  case 'D':
51  number++;
52  iupac_value = iupac_value + 4;
53  break;
54  case 'H':
55  number++;
56  iupac_value = iupac_value + 4;
57  break;
58  case 'V':
59  number++;
60  iupac_value = iupac_value + 3;
61  break;
62  case 'N':
63  number++;
64  iupac_value = iupac_value + 5;
65  break;
66  }
67  }
68  percent = (100 * number) / length;
69 
70  GBDATA *gb_result1 = GB_search(gb_quality, "iupac_value", GB_INT);
71  seq_assert(gb_result1);
72  GB_write_int(gb_result1, iupac_value);
73 }
74 
Definition: iupac.cxx:21
STL namespace.
void SQ_count_ambiguities(const char *iupac, int length, GBDATA *gb_quality)
#define seq_assert(bed)
GB_ERROR GB_write_int(GBDATA *gbd, long i)
Definition: arbdb.cxx:1250
GBDATA * GB_search(GBDATA *gbd, const char *fieldpath, GB_TYPES create)
Definition: adquery.cxx:531
size_t length
Definition: arbdb.h:66