-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfragment.py
executable file
·100 lines (92 loc) · 2.47 KB
/
fragment.py
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
__author__ = "hervemn"
class fragment:
def __init__(self):
"standard init fragment"
@classmethod
def initiate(
cls,
np_id_abs,
id_init,
init_contig,
curr_id,
start_pos,
end_pos,
length_kb,
gc_content,
):
obj = cls()
obj.id_init = id_init
obj.init_contig = init_contig
obj.init_name = str(id_init) + "-" + init_contig
obj.start_pos = start_pos
obj.end_pos = end_pos
obj.length_kb = length_kb
obj.gc_content = gc_content
obj.np_id_abs = np_id_abs
obj.curr_id = curr_id
obj.curr_name = ""
obj.pos_kb = 0
obj.contig_id = 0
obj.orientation = "w"
return obj
def update_name(self, contig_id):
self.curr_name = (
str(self.curr_id) + "-" + str(contig_id) + "-" + str(self.pos_kb)
)
self.contig_id = contig_id
@classmethod
def copy(cls, frag):
obj = cls()
obj.id_init = frag.id_init
obj.init_contig = frag.init_contig
obj.init_name = frag.init_name
obj.start_pos = frag.start_pos
obj.end_pos = frag.end_pos
obj.length_kb = frag.length_kb
obj.gc_content = frag.gc_content
obj.np_id_abs = frag.np_id_abs
obj.cur_id = 0
obj.curr_name = ""
obj.pos_kb = 0
obj.orientation = "w"
return obj
class basic_fragment:
def __init__(self):
"standard init fragment"
@classmethod
def initiate(
cls,
np_id_abs,
id_init,
init_contig,
curr_id,
start_pos,
end_pos,
length_kb,
gc_content,
init_frag_start,
init_frag_end,
sub_frag_start,
sub_frag_end,
super_index,
):
obj = cls()
obj.id_init = id_init
obj.init_contig = init_contig
obj.init_name = str(id_init) + "-" + init_contig
obj.start_pos = start_pos
obj.end_pos = end_pos
obj.length_kb = length_kb
obj.gc_content = gc_content
obj.np_id_abs = np_id_abs
obj.curr_id = curr_id
obj.curr_name = ""
obj.pos_kb = 0
obj.contig_id = 0
obj.orientation = "w"
obj.init_frag_start = init_frag_start
obj.init_frag_end = init_frag_end
obj.sub_frag_start = sub_frag_start
obj.sub_frag_end = sub_frag_end
obj.super_index = super_index
return obj