-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinsert_raw_bp.cpp
58 lines (55 loc) · 1.72 KB
/
insert_raw_bp.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//
#include <map>
#include <string>
#include "globals.h"
using namespace std;
bool insert_raw_bp(multimap<string, multimap<unsigned long, BPINFO> >* rawbpmap,
string chr,
unsigned long leftp,
unsigned long rightp,
double score,
string order,
string bpline)
{
/*
struct BPINFO
{
string chr;
unsigned long leftp;
unsigned long rightp;
unsigned long leftMax;
unsigned long rightMin;
double score;
string order; // allele transition order, either "12" or "21"
string bpline;// raw bp info line
string ovline;// bp info line overlapping with the above, the smaller interval used as a representative
};
*/
BPINFO tmpbp;
tmpbp.chr = chr;
tmpbp.leftp = leftp;
tmpbp.rightp = rightp;
tmpbp.leftMax = 0;
tmpbp.rightMin = 0;
tmpbp.bpline = bpline;
tmpbp.ovline = "";
tmpbp.score = score;
tmpbp.order = order;
//
multimap<string, multimap<unsigned long, BPINFO> >::iterator chritr;
chritr = (*rawbpmap).find(chr);
if(chritr == (*rawbpmap).end())
{
// initialize map with new item of chr
multimap<unsigned long, BPINFO> tmp;
tmp.insert(std::pair<unsigned long, BPINFO>(leftp, tmpbp));
//
(*rawbpmap).insert(std::pair<string, multimap<unsigned long, BPINFO> >(chr, tmp));
}
else
{
// update map of chr
((*chritr).second).insert(std::pair<unsigned long, BPINFO>(leftp, tmpbp));
}
return true;
}