-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathsv.h
91 lines (85 loc) · 3.61 KB
/
sv.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#ifndef SV_H_
#define SV_H_
#include<iostream>
#include<fstream>
#include<string>
#include<cstdlib>
#include<vector>
#include<map>
#include<algorithm>
#include<list>
#include<climits>
#include<cmath>
#include<utility>
#include<iomanip>
using namespace std;
//to store coordinates at alignment level
struct mI {
string rn;
string qn;
int x1;//reference start
int x2;//reference end
int y1;//query start
int y2;//query end
char c;//qualifier. special comments or information can be added to this:i=inversion;
vector<int> mv;
int l;//length of the MUM
bool operator < (const mI& mum1) const
{
//sort the mums by ref chrom name and then by start cords of refs
return (rn < mum1.rn)|| ((rn == mum1.rn) && (x1 < mum1.x1)) || ((rn == mum1.rn) && (x1 == mum1.x1) && (x2 < mum1.x2));
}
bool operator == (const mI& mum1) const
{
return x1 == mum1.x1 && x2 == mum1.x2 && y1 == mum1.y1 && y2 == mum1.y2 && rn == mum1.rn && qn == mum1.qn;
}
};
struct qord {
string name;
int cord;
bool operator < (const qord& q1) const
{
return(name<q1.name) || ((name == q1.name) && (cord<q1.cord));
}
};
class chromPair {
public:
vector<mI> mums;
vector<mI> cm; //conserved mems
vector<mI> ncm; //conserved mems from reverse side
vector<mI> gap;
vector<mI> last;
};
bool qusort(mI mi1, mI mi2); //to sort the mI based on query coordinates
vector<int> makeChromBucket(int refLen);
bool msort(mI mi1, mI mi2);
bool lsort(mI m1,mI m2);
void storeCords(vector<int> & masterRef,vector<int> & masterQ, mI & mi);
void storeCords(vector<int> & masterQ, mI & mi);//overloaded
void storeNameCount(vector<int> & chromDensityRef,vector<int> & chromDensityQ,map<string,int> & lookUpRef,map<string,int> & lookUpQ, mI & mi);
void storeCords(map<int,vector<qord> > & mRef, mI & mi, ofstream & fout); //overloaded
void storeCordsCm(map<int,vector<qord>> & mRef, mI & mi);
mI findClosest(mI & mi, vector<mI> & mums);//overloaded function
mI findClosestCm(mI & mi, vector<mI> & mums,unsigned int k);
vector<double> getCoverage(mI & mi, vector<int> & masterRef,vector<int> & masterQ);
vector<double> getCoverage(mI & mi, vector<int> & masterRef,vector<int> & masterQ,float p);
vector<double> getChromCount(mI & mi, vector<int> & chromDensityRef, vector<int> & chromDensityQ);
void gapCloser(mI & mi, vector<mI> ncm, vector<mI>& cm);
mI returnMumByQ1(int & y1,vector<mI> & mums);
mI returnMumByQ2(int & y1,vector<mI> & mums);
void gapCloserRev(mI & mi, vector<mI> ncm, vector<mI> & cm);
int nearestInt(double d);
void annotGaps(vector<mI> & cm,vector<int> & masterRef, vector<int> & masterQ,vector<int> & chromDensityRef, vector<int> & chromDensityQ,vector<mI> & cnv,map<int,vector<qord> > & umRef, string & refseq, string & qseq,vector<int> & seqlen,ofstream & fout, ofstream & fsmall,int & id);
void readUniq(ifstream & fin,vector<mI> & cm, map<int,vector<qord> > & umRef,vector<int> & masterHQ);
void callSmall(mI & mi,map<int,vector<qord> > & umRef, string & refseq, string & qseq,vector<int> & seqlen,ofstream & fsmall);
void findCnvOverlap(mI & gapmi,vector<mI> ncm, vector<mI> & cnv, vector<mI> & indels,vector<int> & masterRef, vector<int> & masterQ,vector<int> & chromDensityRef,vector<int> & chromDensityQ,ofstream & fout, int & id);
mI findDupRef(mI & mi1, mI & mi2);
mI findDupQ(mI & m1, mI & m2);
char comp(char & N);
void findInnie(vector<mI> & mums,mI & mi);
void findInnieQ(vector<mI> & mums,mI & mi);
void findInnieLast(vector<mI> & mums,mI & mi);
mI readLast(string str);
bool chkIndel(mI & gapmi,vector <mI> & indels);
int findTrans(vector<mI> & mums, mI & m);
#endif