-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAlignment.py
68 lines (57 loc) · 2.02 KB
/
Alignment.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
class Alignment(object):
"""
ROLE: Object containing the parameters and results alignment
"""
def __init__(
self,
parameters,
alignmentSeq1,
alignmentQuali,
alignmentSeq2,
scoreAlignment,
nbMatch,
nbGap,
nbMissmatch,
nbMissmatchIntra,
nbMissmatchExtra
):
"""
ROLE: Constructor
PARAMETERS: parameters, Parameters
alignmentSeq1, string
alignmentQuali, string
alignmentSeq2, string
scoreAlignment, float
nbMatch, int
nbGap, int
nbMissmatch, int
nbMissmatchIntra, int
nbMissmatchExtra, int
"""
self.parameters = parameters
self.alignmentSeq1 = alignmentSeq1
self.alignmentQuali = alignmentQuali
self.alignmentSeq2 = alignmentSeq2
self.scoreAlignment = scoreAlignment
self.nbMatch = nbMatch
self.nbGap = nbGap
self.nbMissmatch = nbMissmatch
self.nbMissmatchIntra = nbMissmatchIntra
self.nbMissmatchExtra = nbMissmatchExtra
self.format_alignment()
def format_alignment(self):
"""
ROLE: Insert every nucleotide one by one into the data_items variable that will be used to display the result of the alignement
OUTPUT: data_items, list (used to display the result of the alignment in RecycleResultsPopup)
"""
self.data_items = []
nbMissingCells = 60 - (len(self.alignmentQuali)%60)
for i in range(nbMissingCells):
self.alignmentSeq1 += " "
self.alignmentQuali += " "
self.alignmentSeq2 += " "
for i in range(0, len(self.alignmentQuali), 60):
[self.data_items.append(nuc) for nuc in self.alignmentSeq1[i:i+60]]
[self.data_items.append(nuc) for nuc in self.alignmentQuali[i:i+60]]
[self.data_items.append(nuc) for nuc in self.alignmentSeq2[i:i+60]]
[self.data_items.append(' ') for blank in range(60)]