Yurttas/PL/OOL/Cplusplus/F/07/03/02/00/mmap 10.cpp

From ZCubes Wiki
Jump to navigation Jump to search
 1/*
 2   Copyright(C) 2005
 3   All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4
 5   Permission to use, copy, modify, and distribute this
 6   software and its documentation for EDUCATIONAL purposes
 7   and without fee is hereby granted provided that this
 8   copyright notice appears in all copies.
 9
10   date   : September 1, 2005.
11   author : Salih Yurttas.
12
13   mmap_10.cpp
14*/
15
16#include <iostream>
17
18#include <vector>
19#include <string>
20
21#include <map>
22
23using namespace std;
24
25int main(int argc, char* argv[]) {
26
27  const int N_SEQS= 4;
28
29  string d_list[] = {"AGGCTAAT",
30                     "GGCTAATA",
31                     "TGTAAATT",
32                     "ACGAGGCT"};
33
34  vector<string> dna_list(d_list,
35                          d_list+N_SEQS);
36
37  vector< vector<int> > counts_positions_list;
38
39  vector<int> v;
40
41  v.push_back(2);
42  v.push_back(5);
43  v.push_back(8);
44
45  counts_positions_list.push_back(v);
46
47  v.clear();
48
49  v.push_back(2);
50  v.push_back(4);
51  v.push_back(7);
52
53  counts_positions_list.push_back(v);
54
55  v.clear();
56
57  v.push_back(4);
58  v.push_back(1);
59  v.push_back(3);
60  v.push_back(7);
61  v.push_back(8);
62
63  counts_positions_list.push_back(v);
64
65  v.clear();
66
67  v.push_back(1);
68  v.push_back(8);
69
70  counts_positions_list.push_back(v);
71
72  v.clear();
73
74  for(int i=0; i<N_SEQS; ++i) {
75    cout << dna_list.at(i) << " - ";
76    int m = counts_positions_list.at(i).at(0);
77    cout << m << " ";
78    for(int j=1; j<m; ++j)
79      cout << counts_positions_list.at(i).at(j) << ",";
80    cout << counts_positions_list.at(i).at(m) << endl;
81  }
82
83}