-
Notifications
You must be signed in to change notification settings - Fork 59
/
struct.h
197 lines (171 loc) · 4.25 KB
/
struct.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
#ifndef __STRUCT_H
#define __STRUCT_H
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <cstdio>
#include <cstring>
#include <cstdarg>
#include <cerrno>
#include <climits>
#include <cmath>
#include <ctime>
#include <sys/time.h>
#include <getopt.h>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#ifndef M_LN2
#define M_LN2 0.69314718055994530942
#endif
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
using namespace std;
#define sameString(a, b) (strcmp((a), (b))==0)
#define MAX(a, b) ((a)>(b)?(a):(b))
#define MIN(a, b) ((a)<(b)?(a):(b))
#define LABEL_LEN 200
#ifndef __GNUC__
#define __attribute__(x)
#endif
struct Blast_record
{
string gene1, gene2;
string mol_pair;
int pair_id;
int node;
double score;
};
struct more_feat
{
//int gene_id;
int tandem;
//bool break_point;
int depth;
};
struct Gene_feat
{
vector<int> cursor;
string name;
string mol;
int mid;
int gene_id;
// more_feat *m;
bool operator < (const Gene_feat &g) const
{
return (mol == g.mol && mid < g.mid) || mol < g.mol || (mol == g.mol && mid == g.mid && name.compare(g.name)<0);
}
};
struct geneCmp
{
bool operator() (const Gene_feat *a, const Gene_feat *b) const
{
return (a->mol == b->mol && a->mid < b->mid) || a->mol < b->mol || (a->mol == b->mol && a->mid == b->mid && a->name.compare(b->name)<0);
}
};
typedef set<Gene_feat *, geneCmp> geneSet;
struct Seg_feat
{
vector<int> pids;
int index;
Gene_feat *s1, *t1, *s2, *t2;
double score, e_value;
string mol_pair;
bool sameStrand;
};
struct Cell_t
{
float raw;
int score :
30;
unsigned from :
2;
};
struct Score_t
{
int pairID; // identifier of match pair
int x, y; // x,y coordinates
float score;
string gene1;
string gene2;
bool operator< (const Score_t & node) const
{
return (x < node.x || (x == node.x && y < node.y));
}
};
struct Path_t
{
float score;
int rc; // sum of row and column of last entry
int sub;
};
//////for MCScanX_orthomcl////////////////
struct ortho_stat
{
int all_num;
int syn_num;
};
extern map<string, ortho_stat> cmp_sp;
/////////////////////////////////////////
extern map<string, Gene_feat> gene_map;
//extern map<string, double>blast_map;
extern vector<Blast_record> match_list;
extern vector<Seg_feat> seg_list;
extern map<string, int> mol_pairs;
extern geneSet allg;
//extern vector<more_feat> gene_more;
//extern map<string, geneSet > chr_map;
/***** CONSTANTS *****/
// match bonus
extern int MATCH_SCORE;
extern int MATCH_SIZE;
// gap extension penalty
extern int GAP_PENALTY;
// length for a single gap in basepairs
extern int GAP_SIZE;
// The filter window for linking locally repetitive hits
extern int OVERLAP_WINDOW;
// significance cut-off
extern double E_VALUE;
// maximum gaps allowed
extern int MAX_GAPS;
// reference genome
//extern string PIVOT;
// intergenic distance
//extern int UNIT_DIST;
// segment extension limit
//extern int EXTENSION_DIST;
// alignment significance score
extern int CUTOFF_SCORE;
extern int IN_SYNTENY;
extern int N_PROXIMAL;
extern int e_mode;
// direction in the 2d dynamic matrix
enum { DIAG, UP, LEFT, DEL };
/***** Helper functions (Some from James Kent library) *****/
void progress(const char *format, ...)
/* Print progress message */
__attribute__((format(printf, 1, 2)));
void err(const char *format, ...)
/* Print error message but do not exit */
__attribute__((format(printf, 1, 2)));
void warn(const char *format, ...)
/* Print error message but do not exit */
__attribute__((format(printf, 1, 2)));
void errAbort(const char *format, ...)
/* Print error message to stderr and exit */
__attribute__((noreturn, format(printf, 1, 2)));
long clock1000();
/* A millisecond clock. */
void uglyTime(const char *label, ...)
/* Print label and how long it's been since last call. Call with
* a NULL label to initialize. */
__attribute__((format(printf, 1, 2)));
FILE *mustOpen(const char *fileName, const char *mode);
/* Open a file or die */
#endif