-
Notifications
You must be signed in to change notification settings - Fork 6
/
fragment.py
73 lines (67 loc) · 2.32 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
__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, id_contig, n_accu_frags):
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 = id_contig
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
obj.n_accu_frags = n_accu_frags
return obj