forked from statgen/popscle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vntr.cpp
123 lines (108 loc) · 4.29 KB
/
vntr.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
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
/* The MIT License
Copyright (c) 2015 Adrian Tan <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "vntr.h"
/**
* Constructor.
*/
VNTR::VNTR(){};
/**
* Clear object.
*/
void VNTR::clear()
{
rid = -1;
repeat_tract.clear();
rbeg1 = 0;
rend1 = 0;
lflank.clear();
rflank.clear();
motif.clear();
ru.clear();
mlen = 0;
motif_score = 0;
motif_concordance = 0;
rl = 0;
no_exact_ru = 0;
total_no_ru = 0;
is_large_repeat_tract = false;
}
/**
* Checks for equality.
*/
bool VNTR::equals(VNTR& vntr)
{
return (rid==vntr.rid &&
rbeg1==vntr.rbeg1 &&
rend1==vntr.rend1 &&
motif==vntr.motif);
}
/**
* Get VNTR representation in string format.
*/
void VNTR::get_vntr_allele_string(std::string& var)
{
var.clear();
var.append(repeat_tract.c_str());
var.append(1, ':');
var.append("<VNTR>");
}
/**
* Print object.
*/
void VNTR::print()
{
std::cerr << "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n";
std::cerr << "VNTR Summary\n";
std::cerr << "rid : " << rid << "\n";
std::cerr << "motif : " << motif << "\n";
std::cerr << "ru : " << ru << "\n";
std::cerr << "\n";
std::cerr << "Exact\n";
std::cerr << "repeat_tract : " << repeat_tract << "\n";
std::cerr << "position : [" << rbeg1 << "," << rend1 << "]\n";
std::cerr << "reference repeat unit length : " << rl << "\n";
std::cerr << "longest allele length : " << ll << "\n";
std::cerr << "motif_concordance : " << motif_concordance << "\n";
std::cerr << "repeat units : " << rl << "\n";
std::cerr << "exact repeat units : " << no_exact_ru << "\n";
std::cerr << "total no. of repeat units : " << total_no_ru << "\n";
std::cerr << "\n";
std::cerr << "Fuzzy\n";
std::cerr << "repeat_tract : " << fuzzy_repeat_tract << "\n";
std::cerr << "position : [" << fuzzy_rbeg1 << "," << fuzzy_rend1 << "]\n";
std::cerr << "reference repeat unit length : " << fuzzy_rl << "\n";
std::cerr << "longest allele length : " << fuzzy_ll << "\n";
std::cerr << "motif_concordance : " << fuzzy_motif_concordance << "\n";
std::cerr << "repeat units : " << fuzzy_rl << "\n";
std::cerr << "exact repeat units : " << fuzzy_no_exact_ru << "\n";
std::cerr << "total no. of repeat units : " << fuzzy_total_no_ru << "\n";
std::cerr << "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n";
/*
std::string fuzzy_repeat_tract; //repeat tract
int32_t fuzzy_rbeg1; //beginning of repeat tract
int32_t fuzzy_rend1; //end of repeat tract
float fuzzy_rl; //number of repeat units on repeat tract
float fuzzy_ll; //number of repeat units on longest allele
float fuzzy_motif_concordance; //motif concordance from hmm
int32_t fuzzy_no_exact_ru; //number exact repeat units from hmm
int32_t fuzzy_total_no_ru; //total no of repeat units from hmm
std::string fuzzy_lflank; //left flank
std::string fuzzy_rflank; //right flank
*/
};