1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.io; |
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
import jalview.datamodel.SequenceI; |
39 |
|
import jalview.util.Format; |
40 |
|
|
41 |
|
import java.io.IOException; |
42 |
|
|
|
|
| 92.2% |
Uncovered Elements: 7 (90) |
Complexity: 20 |
Complexity Density: 0.33 |
|
43 |
|
public class PileUpfile extends MSFfile |
44 |
|
{ |
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
49 |
2 |
public PileUpfile()... |
50 |
|
{ |
51 |
|
} |
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
@param |
57 |
|
|
58 |
|
@param |
59 |
|
|
60 |
|
|
61 |
|
@throws |
62 |
|
|
63 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
64 |
0 |
public PileUpfile(String inFile, DataSourceType sourceType)... |
65 |
|
throws IOException |
66 |
|
{ |
67 |
0 |
super(inFile, sourceType); |
68 |
|
} |
69 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
70 |
1 |
public PileUpfile(FileParse source) throws IOException... |
71 |
|
{ |
72 |
1 |
super(source); |
73 |
|
} |
74 |
|
|
|
|
| 94% |
Uncovered Elements: 5 (84) |
Complexity: 17 |
Complexity Density: 0.29 |
|
75 |
2 |
@Override... |
76 |
|
public String print(SequenceI[] s, boolean jvsuffix) |
77 |
|
{ |
78 |
2 |
StringBuffer out = new StringBuffer("PileUp"); |
79 |
2 |
out.append(newline); |
80 |
2 |
out.append(newline); |
81 |
|
|
82 |
2 |
int max = 0; |
83 |
2 |
int maxid = 0; |
84 |
|
|
85 |
2 |
int i = 0; |
86 |
2 |
int bigChecksum = 0; |
87 |
2 |
int[] checksums = new int[s.length]; |
88 |
32 |
while (i < s.length) |
89 |
|
{ |
90 |
30 |
checksums[i] = checkSum(s[i].getSequenceAsString()); |
91 |
30 |
bigChecksum += checksums[i]; |
92 |
30 |
i++; |
93 |
|
} |
94 |
|
|
95 |
2 |
out.append(" MSF: " + s[0].getLength() + " Type: P Check: " |
96 |
|
+ bigChecksum % 10000 + " .."); |
97 |
2 |
out.append(newline); |
98 |
2 |
out.append(newline); |
99 |
2 |
out.append(newline); |
100 |
|
|
101 |
2 |
i = 0; |
102 |
32 |
while ((i < s.length) && (s[i] != null)) |
103 |
|
{ |
104 |
30 |
String seq = s[i].getSequenceAsString(); |
105 |
30 |
out.append(" Name: " + printId(s[i], jvsuffix) + " oo Len: " |
106 |
|
+ seq.length() + " Check: " + checksums[i] |
107 |
|
+ " Weight: 1.00"); |
108 |
30 |
out.append(newline); |
109 |
|
|
110 |
30 |
if (seq.length() > max) |
111 |
|
{ |
112 |
2 |
max = seq.length(); |
113 |
|
} |
114 |
|
|
115 |
30 |
if (s[i].getName().length() > maxid) |
116 |
|
{ |
117 |
6 |
maxid = s[i].getName().length(); |
118 |
|
} |
119 |
|
|
120 |
30 |
i++; |
121 |
|
} |
122 |
|
|
123 |
2 |
if (maxid < 10) |
124 |
|
{ |
125 |
0 |
maxid = 10; |
126 |
|
} |
127 |
|
|
128 |
2 |
maxid++; |
129 |
2 |
out.append(newline); |
130 |
2 |
out.append(newline); |
131 |
2 |
out.append("//"); |
132 |
2 |
out.append(newline); |
133 |
2 |
out.append(newline); |
134 |
|
|
135 |
2 |
int len = 50; |
136 |
|
|
137 |
2 |
int nochunks = (max / len) + (max % len > 0 ? 1 : 0); |
138 |
|
|
139 |
10 |
for (i = 0; i < nochunks; i++) |
140 |
|
{ |
141 |
8 |
int j = 0; |
142 |
|
|
143 |
128 |
while ((j < s.length) && (s[j] != null)) |
144 |
|
{ |
145 |
120 |
String name = printId(s[j], jvsuffix); |
146 |
|
|
147 |
120 |
out.append(new Format("%-" + maxid + "s").form(name + " ")); |
148 |
|
|
149 |
720 |
for (int k = 0; k < 5; k++) |
150 |
|
{ |
151 |
600 |
int start = (i * 50) + (k * 10); |
152 |
600 |
int end = start + 10; |
153 |
|
|
154 |
600 |
int length = s[j].getLength(); |
155 |
600 |
if ((end < length) && (start < length)) |
156 |
|
{ |
157 |
450 |
out.append(s[j].getSequence(start, end)); |
158 |
|
|
159 |
450 |
if (k < 4) |
160 |
|
{ |
161 |
360 |
out.append(" "); |
162 |
|
} |
163 |
|
else |
164 |
|
{ |
165 |
90 |
out.append(newline); |
166 |
|
} |
167 |
|
} |
168 |
|
else |
169 |
|
{ |
170 |
150 |
if (start < length) |
171 |
|
{ |
172 |
30 |
out.append(s[j].getSequenceAsString().substring(start)); |
173 |
30 |
out.append(newline); |
174 |
|
} |
175 |
|
else |
176 |
|
{ |
177 |
120 |
if (k == 0) |
178 |
|
{ |
179 |
0 |
out.append(newline); |
180 |
|
} |
181 |
|
} |
182 |
|
} |
183 |
|
} |
184 |
|
|
185 |
120 |
j++; |
186 |
|
} |
187 |
|
|
188 |
8 |
out.append(newline); |
189 |
|
} |
190 |
|
|
191 |
2 |
return out.toString(); |
192 |
|
} |
193 |
|
} |