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 |
|
import jalview.api.AlignExportSettingsI; |
24 |
|
import jalview.api.AlignmentViewPanel; |
25 |
|
import jalview.bin.Cache; |
26 |
|
import jalview.datamodel.Alignment; |
27 |
|
import jalview.datamodel.AlignmentAnnotation; |
28 |
|
import jalview.datamodel.AlignmentI; |
29 |
|
import jalview.datamodel.HiddenColumns; |
30 |
|
import jalview.datamodel.Sequence; |
31 |
|
import jalview.datamodel.SequenceGroup; |
32 |
|
import jalview.datamodel.SequenceI; |
33 |
|
import jalview.util.Comparison; |
34 |
|
|
35 |
|
import java.io.File; |
36 |
|
import java.io.IOException; |
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
@author |
42 |
|
@version |
43 |
|
|
|
|
| 27.8% |
Uncovered Elements: 70 (97) |
Complexity: 28 |
Complexity Density: 0.46 |
|
44 |
|
public class FormatAdapter extends AppletFormatAdapter |
45 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
46 |
1 |
public FormatAdapter(AlignmentViewPanel viewpanel)... |
47 |
|
{ |
48 |
1 |
super(viewpanel); |
49 |
1 |
init(); |
50 |
|
} |
51 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
52 |
257 |
public FormatAdapter()... |
53 |
|
{ |
54 |
257 |
super(); |
55 |
257 |
init(); |
56 |
|
} |
57 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
58 |
44 |
public FormatAdapter(AlignmentViewPanel alignPanel,... |
59 |
|
AlignExportSettingsI settings) |
60 |
|
{ |
61 |
44 |
super(alignPanel, settings); |
62 |
|
} |
63 |
|
|
|
|
| 55.6% |
Uncovered Elements: 4 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
64 |
258 |
private void init()... |
65 |
|
{ |
66 |
258 |
if (jalview.bin.Cache.getDefault("STRUCT_FROM_PDB", true)) |
67 |
|
{ |
68 |
258 |
annotFromStructure = jalview.bin.Cache.getDefault("ADD_TEMPFACT_ANN", |
69 |
|
true); |
70 |
258 |
localSecondaryStruct = jalview.bin.Cache.getDefault("ADD_SS_ANN", |
71 |
|
true); |
72 |
258 |
serviceSecondaryStruct = jalview.bin.Cache.getDefault("USE_RNAVIEW", |
73 |
|
true); |
74 |
|
} |
75 |
|
else |
76 |
|
{ |
77 |
|
|
78 |
0 |
annotFromStructure = false; |
79 |
0 |
localSecondaryStruct = false; |
80 |
0 |
serviceSecondaryStruct = false; |
81 |
|
} |
82 |
|
} |
83 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
84 |
0 |
public String formatSequences(FileFormatI format, SequenceI[] seqs,... |
85 |
|
String[] omitHiddenColumns, int[] exportRange) |
86 |
|
{ |
87 |
|
|
88 |
0 |
return formatSequences(format, |
89 |
|
replaceStrings(seqs, omitHiddenColumns, exportRange)); |
90 |
|
} |
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
|
95 |
|
|
96 |
|
@param |
97 |
|
@param |
98 |
|
@return |
99 |
|
|
|
|
| 0% |
Uncovered Elements: 32 (32) |
Complexity: 8 |
Complexity Density: 0.36 |
|
100 |
0 |
public SequenceI[] replaceStrings(SequenceI[] seqs,... |
101 |
|
String[] omitHiddenColumns, int[] startEnd) |
102 |
|
{ |
103 |
0 |
if (omitHiddenColumns != null) |
104 |
|
{ |
105 |
0 |
SequenceI[] tmp = new SequenceI[seqs.length]; |
106 |
|
|
107 |
0 |
int startRes; |
108 |
0 |
int endRes; |
109 |
0 |
int startIndex; |
110 |
0 |
int endIndex; |
111 |
0 |
for (int i = 0; i < seqs.length; i++) |
112 |
|
{ |
113 |
0 |
startRes = seqs[i].getStart(); |
114 |
0 |
endRes = seqs[i].getEnd(); |
115 |
0 |
if (startEnd != null) |
116 |
|
{ |
117 |
0 |
startIndex = startEnd[0]; |
118 |
0 |
endIndex = startEnd[1]; |
119 |
|
|
120 |
0 |
while (Comparison.isGap(seqs[i].getCharAt(startIndex)) |
121 |
|
&& startIndex < endIndex) |
122 |
|
{ |
123 |
0 |
startIndex++; |
124 |
|
} |
125 |
|
|
126 |
|
|
127 |
0 |
while (Comparison.isGap(seqs[i].getCharAt(endIndex)) |
128 |
|
&& endIndex > startIndex) |
129 |
|
{ |
130 |
0 |
endIndex--; |
131 |
|
} |
132 |
|
|
133 |
0 |
startRes = seqs[i].findPosition(startIndex); |
134 |
0 |
endRes = seqs[i].findPosition(endIndex); |
135 |
|
} |
136 |
|
|
137 |
0 |
tmp[i] = new Sequence(seqs[i].getName(), omitHiddenColumns[i], |
138 |
|
startRes, endRes); |
139 |
0 |
tmp[i].setDescription(seqs[i].getDescription()); |
140 |
|
} |
141 |
0 |
seqs = tmp; |
142 |
|
} |
143 |
0 |
return seqs; |
144 |
|
} |
145 |
|
|
146 |
|
|
147 |
|
|
148 |
|
|
149 |
|
|
150 |
|
|
151 |
|
@param |
152 |
|
@param |
153 |
|
|
154 |
|
|
155 |
|
@return |
156 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
157 |
0 |
public String formatSequences(FileFormatI format, SequenceI[] seqs)... |
158 |
|
{ |
159 |
0 |
boolean withSuffix = getCacheSuffixDefault(format); |
160 |
0 |
return format.getWriter(null).print(seqs, withSuffix); |
161 |
|
} |
162 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
163 |
45 |
public boolean getCacheSuffixDefault(FileFormatI format)... |
164 |
|
{ |
165 |
45 |
return Cache.getDefault(format.getName().toUpperCase() + "_JVSUFFIX", |
166 |
|
true); |
167 |
|
} |
168 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
169 |
44 |
public String formatSequences(FileFormatI format, AlignmentI alignment,... |
170 |
|
String[] omitHidden, int[] exportRange, HiddenColumns hidden) |
171 |
|
{ |
172 |
44 |
return formatSequences(format, alignment, omitHidden, exportRange, |
173 |
|
getCacheSuffixDefault(format), hidden, null); |
174 |
|
} |
175 |
|
|
176 |
|
|
177 |
|
|
178 |
|
|
179 |
|
|
180 |
|
@param |
181 |
|
@param |
182 |
|
@param |
183 |
|
|
184 |
|
@param |
185 |
|
|
186 |
|
@return |
187 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
188 |
0 |
public String formatSequences(FileFormatI format, AlignmentI alignment,... |
189 |
|
String[] omitHidden, int[] exportRange, boolean suffix, |
190 |
|
HiddenColumns hidden) |
191 |
|
{ |
192 |
0 |
return formatSequences(format, alignment, omitHidden, exportRange, |
193 |
|
suffix, hidden, null); |
194 |
|
} |
195 |
|
|
|
|
| 15% |
Uncovered Elements: 17 (20) |
Complexity: 5 |
Complexity Density: 0.42 |
|
196 |
44 |
public String formatSequences(FileFormatI format, AlignmentI alignment,... |
197 |
|
String[] omitHidden, int[] exportRange, boolean suffix, |
198 |
|
HiddenColumns hidden, SequenceGroup selgp) |
199 |
|
{ |
200 |
44 |
if (omitHidden != null) |
201 |
|
{ |
202 |
|
|
203 |
|
|
204 |
|
|
205 |
|
|
206 |
0 |
Alignment alv = new Alignment(replaceStrings( |
207 |
|
alignment.getSequencesArray(), omitHidden, exportRange)); |
208 |
0 |
AlignmentAnnotation[] ala = alignment.getAlignmentAnnotation(); |
209 |
0 |
if (ala != null) |
210 |
|
{ |
211 |
0 |
for (int i = 0; i < ala.length; i++) |
212 |
|
{ |
213 |
0 |
AlignmentAnnotation na = new AlignmentAnnotation(ala[i]); |
214 |
0 |
if (selgp != null) |
215 |
|
{ |
216 |
0 |
na.makeVisibleAnnotation(selgp.getStartRes(), selgp.getEndRes(), |
217 |
|
hidden); |
218 |
|
} |
219 |
|
else |
220 |
|
{ |
221 |
0 |
na.makeVisibleAnnotation(hidden); |
222 |
|
} |
223 |
0 |
alv.addAnnotation(na); |
224 |
|
} |
225 |
|
} |
226 |
0 |
return this.formatSequences(format, alv, suffix); |
227 |
|
} |
228 |
44 |
return this.formatSequences(format, alignment, suffix); |
229 |
|
} |
230 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
231 |
244 |
@Override... |
232 |
|
public AlignmentI readFile(String file, DataSourceType sourceType, |
233 |
|
FileFormatI fileFormat) throws IOException |
234 |
|
{ |
235 |
244 |
AlignmentI al = super.readFile(file, sourceType, fileFormat); |
236 |
244 |
return al; |
237 |
|
} |
238 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
239 |
0 |
public AlignmentI readFile(File file, DataSourceType sourceType,... |
240 |
|
FileFormatI fileFormat) throws IOException |
241 |
|
{ |
242 |
0 |
AlignmentI al = super.readFile(file, null, sourceType, fileFormat); |
243 |
0 |
return al; |
244 |
|
} |
245 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
246 |
0 |
@Override... |
247 |
|
public AlignmentI readFromFile(FileParse source, FileFormatI format) |
248 |
|
throws IOException |
249 |
|
{ |
250 |
0 |
AlignmentI al = super.readFromFile(source, format); |
251 |
0 |
return al; |
252 |
|
} |
253 |
|
|
254 |
|
|
255 |
|
|
256 |
|
|
257 |
|
|
258 |
|
@param |
259 |
|
@param |
260 |
|
|
261 |
|
@return |
262 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
263 |
1 |
public String formatSequences(FileFormatI format, AlignmentViewPanel ap,... |
264 |
|
boolean selectedOnly) |
265 |
|
{ |
266 |
1 |
return formatSequences(format, getCacheSuffixDefault(format), ap, |
267 |
|
selectedOnly); |
268 |
|
} |
269 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
270 |
0 |
public AlignmentI readFromFile(AlignmentFileReaderI source,... |
271 |
|
FileFormatI format) throws IOException |
272 |
|
{ |
273 |
0 |
FileParse fp = new FileParse(source.getInFile(), |
274 |
|
source.getDataSourceType()); |
275 |
0 |
return readFromFile(fp, format); |
276 |
|
} |
277 |
|
|
278 |
|
} |