| 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 java.util.Locale; |
| 24 |
|
|
| 25 |
|
import jalview.datamodel.AlignmentAnnotation; |
| 26 |
|
import jalview.datamodel.AlignmentI; |
| 27 |
|
import jalview.datamodel.Annotation; |
| 28 |
|
import jalview.datamodel.SequenceI; |
| 29 |
|
import jalview.util.MessageManager; |
| 30 |
|
|
| |
|
| 92.7% |
Uncovered Elements: 9 (124) |
Complexity: 42 |
Complexity Density: 0.64 |
|
| 31 |
|
public class JnetAnnotationMaker |
| 32 |
|
{ |
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 33 |
3 |
public static void add_annotation(JPredFile prediction, AlignmentI al,... |
| 34 |
|
int firstSeq, boolean noMsa) throws Exception |
| 35 |
|
{ |
| 36 |
3 |
JnetAnnotationMaker.add_annotation(prediction, al, firstSeq, noMsa, |
| 37 |
|
(int[]) null); |
| 38 |
|
} |
| 39 |
|
|
| 40 |
|
|
| 41 |
|
|
| 42 |
|
|
| 43 |
|
@param |
| 44 |
|
|
| 45 |
|
@param |
| 46 |
|
|
| 47 |
|
@param |
| 48 |
|
|
| 49 |
|
|
| 50 |
|
@param |
| 51 |
|
|
| 52 |
|
@param |
| 53 |
|
|
| 54 |
|
|
| 55 |
|
|
| |
|
| 92.6% |
Uncovered Elements: 9 (121) |
Complexity: 41 |
Complexity Density: 0.63 |
|
| 56 |
6 |
public static void add_annotation(JPredFile prediction, AlignmentI al,... |
| 57 |
|
int firstSeq, boolean noMsa, int[] delMap) throws Exception |
| 58 |
|
{ |
| 59 |
6 |
int i = 0; |
| 60 |
6 |
SequenceI[] preds = prediction.getSeqsAsArray(); |
| 61 |
|
|
| 62 |
|
|
| 63 |
6 |
SequenceI seqRef = al.getSequenceAt(firstSeq); |
| 64 |
6 |
int width = preds[0].getLength(); |
| 65 |
6 |
int[] gapmap = al.getSequenceAt(firstSeq).gapMap(); |
| 66 |
6 |
if ((delMap != null && delMap.length > width) |
| 67 |
|
|| (delMap == null && gapmap.length != width)) |
| 68 |
|
{ |
| 69 |
0 |
throw (new Exception(MessageManager.formatMessage( |
| 70 |
|
"exception.number_of_residues_in_query_sequence_differ_from_prediction", |
| 71 |
|
new String[] |
| 72 |
0 |
{ (delMap == null ? "" |
| 73 |
|
: MessageManager.getString("label.mapped")), |
| 74 |
|
al.getSequenceAt(firstSeq).getName(), |
| 75 |
|
al.getSequenceAt(firstSeq).getSequenceAsString(), |
| 76 |
|
Integer.valueOf(width).toString() }))); |
| 77 |
|
} |
| 78 |
|
|
| 79 |
6 |
AlignmentAnnotation annot; |
| 80 |
6 |
Annotation[] annotations = null; |
| 81 |
|
|
| 82 |
6 |
int existingAnnotations = 0; |
| 83 |
6 |
if (al.getAlignmentAnnotation() != null) |
| 84 |
|
{ |
| 85 |
0 |
existingAnnotations = al.getAlignmentAnnotation().length; |
| 86 |
|
} |
| 87 |
|
|
| 88 |
6 |
Annotation[] sol = new Annotation[al.getWidth()]; |
| 89 |
6 |
boolean firstsol = true; |
| 90 |
|
|
| 91 |
1708 |
while (i < preds.length) |
| 92 |
|
{ |
| 93 |
1702 |
String id = preds[i].getName().toUpperCase(Locale.ROOT); |
| 94 |
|
|
| 95 |
1702 |
if (id.startsWith("LUPAS") || id.startsWith("JNET") |
| 96 |
|
|| id.startsWith("JPRED")) |
| 97 |
|
{ |
| 98 |
66 |
if (id.startsWith("JNETSOL")) |
| 99 |
|
{ |
| 100 |
18 |
float amnt = (id.endsWith("25") ? 3f |
| 101 |
12 |
: id.endsWith("5") ? 6f : 9f); |
| 102 |
570 |
for (int spos = 0; spos < width; spos++) |
| 103 |
|
{ |
| 104 |
552 |
int sposw = (delMap == null) ? gapmap[spos] |
| 105 |
|
: gapmap[delMap[spos]]; |
| 106 |
552 |
if (firstsol) |
| 107 |
|
{ |
| 108 |
184 |
sol[sposw] = new Annotation(0f); |
| 109 |
|
} |
| 110 |
552 |
if (preds[i].getCharAt(spos) == 'B' |
| 111 |
|
&& (sol[sposw].value == 0f || sol[sposw].value < amnt)) |
| 112 |
|
{ |
| 113 |
118 |
sol[sposw].value = amnt; |
| 114 |
|
} |
| 115 |
|
} |
| 116 |
18 |
firstsol = false; |
| 117 |
|
} |
| 118 |
|
else |
| 119 |
|
{ |
| 120 |
|
|
| 121 |
48 |
annotations = new Annotation[al.getWidth()]; |
| 122 |
|
|
| 123 |
|
|
| 124 |
|
|
| 125 |
|
|
| 126 |
48 |
if (id.equals("JNETPRED") || id.equals("JNETPSSM") |
| 127 |
|
|| id.equals("JNETFREQ") || id.equals("JNETHMM") |
| 128 |
|
|| id.equals("JNETALIGN") || id.equals("JPRED")) |
| 129 |
|
{ |
| 130 |
18 |
if (delMap == null) |
| 131 |
|
{ |
| 132 |
285 |
for (int j = 0; j < width; j++) |
| 133 |
|
{ |
| 134 |
276 |
annotations[gapmap[j]] = new Annotation("", "", |
| 135 |
|
preds[i].getCharAt(j), 0); |
| 136 |
|
} |
| 137 |
|
} |
| 138 |
|
else |
| 139 |
|
{ |
| 140 |
285 |
for (int j = 0; j < width; j++) |
| 141 |
|
{ |
| 142 |
276 |
annotations[gapmap[delMap[j]]] = new Annotation("", "", |
| 143 |
|
preds[i].getCharAt(j), 0); |
| 144 |
|
} |
| 145 |
|
} |
| 146 |
|
} |
| 147 |
30 |
else if (id.equals("JNETCONF")) |
| 148 |
|
{ |
| 149 |
6 |
if (delMap == null) |
| 150 |
|
{ |
| 151 |
95 |
for (int j = 0; j < width; j++) |
| 152 |
|
{ |
| 153 |
92 |
float value = Float.valueOf(preds[i].getCharAt(j) + "") |
| 154 |
|
.floatValue(); |
| 155 |
92 |
annotations[gapmap[j]] = new Annotation( |
| 156 |
|
preds[i].getCharAt(j) + "", "", |
| 157 |
|
preds[i].getCharAt(j), value); |
| 158 |
|
} |
| 159 |
|
} |
| 160 |
|
else |
| 161 |
|
{ |
| 162 |
95 |
for (int j = 0; j < width; j++) |
| 163 |
|
{ |
| 164 |
92 |
float value = Float.valueOf(preds[i].getCharAt(j) + "") |
| 165 |
|
.floatValue(); |
| 166 |
92 |
annotations[gapmap[delMap[j]]] = new Annotation( |
| 167 |
|
preds[i].getCharAt(j) + "", "", |
| 168 |
|
preds[i].getCharAt(j), value); |
| 169 |
|
} |
| 170 |
|
} |
| 171 |
|
} |
| 172 |
|
else |
| 173 |
|
{ |
| 174 |
24 |
if (delMap == null) |
| 175 |
|
{ |
| 176 |
380 |
for (int j = 0; j < width; j++) |
| 177 |
|
{ |
| 178 |
368 |
annotations[gapmap[j]] = new Annotation( |
| 179 |
|
preds[i].getCharAt(j) + "", "", ' ', 0); |
| 180 |
|
} |
| 181 |
|
} |
| 182 |
|
else |
| 183 |
|
{ |
| 184 |
380 |
for (int j = 0; j < width; j++) |
| 185 |
|
{ |
| 186 |
368 |
annotations[gapmap[delMap[j]]] = new Annotation( |
| 187 |
|
preds[i].getCharAt(j) + "", "", ' ', 0); |
| 188 |
|
} |
| 189 |
|
} |
| 190 |
|
} |
| 191 |
|
|
| 192 |
48 |
if (id.equals("JNETCONF")) |
| 193 |
|
{ |
| 194 |
6 |
annot = new AlignmentAnnotation(preds[i].getName(), |
| 195 |
|
"JPred Output", annotations, 0f, 10f, |
| 196 |
|
AlignmentAnnotation.BAR_GRAPH); |
| 197 |
|
} |
| 198 |
|
else |
| 199 |
|
{ |
| 200 |
42 |
annot = new AlignmentAnnotation(preds[i].getName(), |
| 201 |
|
"JPred Output", annotations); |
| 202 |
|
} |
| 203 |
|
|
| 204 |
48 |
if (seqRef != null) |
| 205 |
|
{ |
| 206 |
48 |
annot.createSequenceMapping(seqRef, 1, true); |
| 207 |
48 |
seqRef.addAlignmentAnnotation(annot); |
| 208 |
|
} |
| 209 |
|
|
| 210 |
48 |
al.addAnnotation(annot); |
| 211 |
48 |
al.setAnnotationIndex(annot, al.getAlignmentAnnotation().length |
| 212 |
|
- existingAnnotations - 1); |
| 213 |
|
} |
| 214 |
66 |
if (noMsa) |
| 215 |
|
{ |
| 216 |
44 |
al.deleteSequence(preds[i]); |
| 217 |
|
} |
| 218 |
|
} |
| 219 |
|
|
| 220 |
1702 |
i++; |
| 221 |
|
} |
| 222 |
6 |
if (!firstsol) |
| 223 |
|
{ |
| 224 |
|
|
| 225 |
6 |
annot = new AlignmentAnnotation("Jnet Burial", |
| 226 |
|
"<html>Prediction of Solvent Accessibility<br/>levels are<ul><li>0 - Exposed</li><li>3 - 25% or more S.A. accessible</li><li>6 - 5% or more S.A. accessible</li><li>9 - Buried (<5% exposed)</li></ul>", |
| 227 |
|
sol, 0f, 9f, AlignmentAnnotation.BAR_GRAPH); |
| 228 |
|
|
| 229 |
6 |
annot.validateRangeAndDisplay(); |
| 230 |
6 |
if (seqRef != null) |
| 231 |
|
{ |
| 232 |
6 |
annot.createSequenceMapping(seqRef, 1, true); |
| 233 |
6 |
seqRef.addAlignmentAnnotation(annot); |
| 234 |
|
} |
| 235 |
6 |
al.addAnnotation(annot); |
| 236 |
6 |
al.setAnnotationIndex(annot, |
| 237 |
|
al.getAlignmentAnnotation().length - existingAnnotations - 1); |
| 238 |
|
} |
| 239 |
|
|
| 240 |
|
|
| 241 |
|
|
| 242 |
|
|
| 243 |
|
|
| 244 |
|
|
| 245 |
|
|
| 246 |
|
|
| 247 |
|
|
| 248 |
|
|
| 249 |
|
|
| 250 |
|
|
| 251 |
|
|
| 252 |
|
} |
| 253 |
|
} |