-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmisc.h
48 lines (41 loc) · 985 Bytes
/
misc.h
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
/**
**
** Author: Nadia Davidson, [email protected]
** Modified: 26 October 2016
**/
#include <iostream>
#include <fstream>
#include <istream>
#include <string>
#include <sstream>
#include <map>
#include <stdlib.h>
#include <vector>
#include <algorithm>
using namespace std;
struct g_interval {
string chrom;
int start, end;
int support;
string strand;
bool operator==(const g_interval& other)
{
return ((chrom==other.chrom) && (start==other.start) && (end==other.end));
};
} ;
bool g_interval_compare(const g_interval& a, const g_interval&b){
return(a.start < b.start);
};
void sort_vector( vector<string> & a){
sort(a.begin(), a.end());
a.resize(distance(a.begin(),unique(a.begin(),a.end())));
};
vector<int> get_vector_from_list(string comm_list){
vector<int> result;
istringstream string_stream(comm_list);
string pos;
while(getline(string_stream,pos,',')){
result.push_back(atoi(pos.c_str()));
};
return result;
};