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.datamodel.AlignmentAnnotation; |
24 |
|
import jalview.datamodel.AlignmentI; |
25 |
|
import jalview.datamodel.SequenceI; |
26 |
|
|
27 |
|
import java.io.IOException; |
28 |
|
|
|
|
| 18.9% |
Uncovered Elements: 43 (53) |
Complexity: 14 |
Complexity Density: 0.45 |
|
29 |
|
public class AMSAFile extends jalview.io.FastaFile |
30 |
|
{ |
31 |
|
|
32 |
|
AlignmentI al; |
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
37 |
1 |
public AMSAFile(AlignmentI al)... |
38 |
|
{ |
39 |
1 |
this.al = al; |
40 |
|
} |
41 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
42 |
0 |
public AMSAFile(String inFile, DataSourceType sourceType)... |
43 |
|
throws IOException |
44 |
|
{ |
45 |
0 |
super(inFile, sourceType); |
46 |
|
} |
47 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
48 |
1 |
public AMSAFile(FileParse source) throws IOException... |
49 |
|
{ |
50 |
1 |
super(source); |
51 |
|
} |
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
@return |
57 |
|
|
|
|
| 10.9% |
Uncovered Elements: 41 (46) |
Complexity: 11 |
Complexity Density: 0.39 |
|
58 |
1 |
@Override... |
59 |
|
public String print(SequenceI[] sqs, boolean jvsuffix) |
60 |
|
{ |
61 |
1 |
super.print(sqs, jvsuffix); |
62 |
|
|
63 |
1 |
AlignmentAnnotation aa; |
64 |
1 |
if (al.getAlignmentAnnotation() != null) |
65 |
|
{ |
66 |
|
|
67 |
0 |
for (int i = 0; i < al.getAlignmentAnnotation().length; i++) |
68 |
|
{ |
69 |
0 |
aa = al.getAlignmentAnnotation()[i]; |
70 |
|
|
71 |
0 |
if (aa.autoCalculated || !aa.visible) |
72 |
|
{ |
73 |
0 |
continue; |
74 |
|
} |
75 |
|
|
76 |
0 |
out.append(">#_" + aa.label); |
77 |
0 |
if (aa.description != null) |
78 |
|
{ |
79 |
0 |
out.append(" " + aa.description); |
80 |
|
} |
81 |
|
|
82 |
0 |
out.append(newline); |
83 |
|
|
84 |
0 |
int nochunks = Math.min(aa.annotations.length, al.getWidth()) / len |
85 |
|
+ 1; |
86 |
|
|
87 |
0 |
for (int j = 0; j < nochunks; j++) |
88 |
|
{ |
89 |
0 |
int start = j * len; |
90 |
0 |
int end = start + len; |
91 |
0 |
if (end > aa.annotations.length) |
92 |
|
{ |
93 |
0 |
end = aa.annotations.length; |
94 |
|
} |
95 |
|
|
96 |
0 |
String ch; |
97 |
0 |
for (int k = start; k < end; k++) |
98 |
|
{ |
99 |
0 |
if (aa.annotations[k] == null) |
100 |
|
{ |
101 |
0 |
ch = " "; |
102 |
|
} |
103 |
|
else |
104 |
|
{ |
105 |
0 |
ch = aa.annotations[k].displayCharacter; |
106 |
|
} |
107 |
0 |
if (ch.length() > 1) |
108 |
|
{ |
109 |
0 |
this.warningMessage = "Truncated column annotation to first letter."; |
110 |
0 |
ch = ch.substring(0, 1); |
111 |
|
} |
112 |
0 |
out.append(ch); |
113 |
|
|
114 |
|
} |
115 |
0 |
out.append(newline); |
116 |
|
} |
117 |
|
} |
118 |
|
} |
119 |
1 |
return out.toString(); |
120 |
|
} |
121 |
|
} |