| 1 |
|
package jalview.bin; |
| 2 |
|
|
| 3 |
|
import java.awt.EventQueue; |
| 4 |
|
|
| 5 |
|
import java.io.IOException; |
| 6 |
|
import java.net.URL; |
| 7 |
|
import java.util.ArrayList; |
| 8 |
|
import java.util.List; |
| 9 |
|
import java.util.StringTokenizer; |
| 10 |
|
import java.util.Vector; |
| 11 |
|
|
| 12 |
|
import javax.swing.SwingUtilities; |
| 13 |
|
|
| 14 |
|
import jalview.api.JalviewJSApi; |
| 15 |
|
import jalview.api.StructureSelectionManagerProvider; |
| 16 |
|
import jalview.datamodel.Alignment; |
| 17 |
|
import jalview.datamodel.AlignmentI; |
| 18 |
|
import jalview.datamodel.AlignmentOrder; |
| 19 |
|
import jalview.datamodel.ColumnSelection; |
| 20 |
|
import jalview.datamodel.HiddenColumns; |
| 21 |
|
import jalview.datamodel.PDBEntry; |
| 22 |
|
import jalview.datamodel.Sequence; |
| 23 |
|
import jalview.datamodel.SequenceGroup; |
| 24 |
|
import jalview.datamodel.SequenceI; |
| 25 |
|
import jalview.gui.AlignFrame; |
| 26 |
|
import jalview.gui.AlignViewport; |
| 27 |
|
import jalview.gui.CalculationChooser; |
| 28 |
|
import jalview.gui.Desktop; |
| 29 |
|
import jalview.gui.StructureViewer; |
| 30 |
|
import jalview.io.AnnotationFile; |
| 31 |
|
import jalview.io.AppletFormatAdapter; |
| 32 |
|
import jalview.io.DataSourceType; |
| 33 |
|
import jalview.io.FeaturesFile; |
| 34 |
|
import jalview.io.FileFormat; |
| 35 |
|
import jalview.io.FileFormatI; |
| 36 |
|
import jalview.io.FileFormats; |
| 37 |
|
import jalview.io.IdentifyFile; |
| 38 |
|
import jalview.io.JPredFile; |
| 39 |
|
import jalview.io.JnetAnnotationMaker; |
| 40 |
|
import jalview.io.NewickFile; |
| 41 |
|
import jalview.structure.SelectionListener; |
| 42 |
|
import jalview.structure.SelectionSource; |
| 43 |
|
import jalview.structure.StructureSelectionManager; |
| 44 |
|
import jalview.util.HttpUtils; |
| 45 |
|
import jalview.util.Platform; |
| 46 |
|
|
| 47 |
|
|
| 48 |
|
|
| 49 |
|
|
| 50 |
|
|
| 51 |
|
|
| 52 |
|
@author |
| 53 |
|
|
| 54 |
|
|
| |
|
| 0% |
Uncovered Elements: 806 (806) |
Complexity: 222 |
Complexity Density: 0.45 |
|
| 55 |
|
public class JalviewJSApp implements JalviewJSApi |
| 56 |
|
{ |
| 57 |
|
private ArgsParser aparser; |
| 58 |
|
|
| 59 |
|
private String[] ret = new String[1]; |
| 60 |
|
|
| 61 |
|
|
| 62 |
|
|
| 63 |
|
private String separator = "\u00AC"; |
| 64 |
|
|
| 65 |
|
|
| 66 |
|
|
| 67 |
|
|
| 68 |
|
|
| 69 |
|
|
| 70 |
|
|
| 71 |
|
|
| 72 |
|
private Jalview jalview; |
| 73 |
|
|
| |
|
| 0% |
Uncovered Elements: 56 (56) |
Complexity: 20 |
Complexity Density: 0.69 |
|
| 74 |
|
public class JsSelectionListener |
| 75 |
|
implements jalview.structure.SelectionListener |
| 76 |
|
{ |
| 77 |
|
|
| 78 |
|
AlignFrame _alf; |
| 79 |
|
|
| 80 |
|
String _listener; |
| 81 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 82 |
0 |
public JsSelectionListener(AlignFrame alf, String listener)... |
| 83 |
|
{ |
| 84 |
0 |
_alf = alf; |
| 85 |
0 |
_listener = listener; |
| 86 |
|
} |
| 87 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 88 |
0 |
public boolean isFor(AlignFrame alf, String listener)... |
| 89 |
|
{ |
| 90 |
0 |
return (_alf == null || _alf == alf) && _listener.equals(listener); |
| 91 |
|
} |
| 92 |
|
|
| |
|
| 0% |
Uncovered Elements: 50 (50) |
Complexity: 18 |
Complexity Density: 0.69 |
|
| 93 |
0 |
@Override... |
| 94 |
|
public void selection(SequenceGroup seqsel, ColumnSelection colsel, |
| 95 |
|
HiddenColumns hidden, SelectionSource source) |
| 96 |
|
{ |
| 97 |
|
|
| 98 |
|
|
| 99 |
0 |
String setid = ""; |
| 100 |
0 |
AlignFrame srcFrame = (_alf == null ? getCurrentAlignFrame() : _alf); |
| 101 |
0 |
if (source != null) |
| 102 |
|
{ |
| 103 |
0 |
if (source instanceof AlignViewport |
| 104 |
|
&& srcFrame.getViewport() != source) |
| 105 |
|
{ |
| 106 |
0 |
return; |
| 107 |
|
} |
| 108 |
|
} |
| 109 |
0 |
String[] seqs = new String[] {}; |
| 110 |
0 |
String[] cols = new String[] {}; |
| 111 |
0 |
int strt = 0, end = (srcFrame == null) ? -1 |
| 112 |
|
: srcFrame.alignPanel.av.getAlignment().getWidth(); |
| 113 |
0 |
if (seqsel != null && seqsel.getSize() > 0) |
| 114 |
|
{ |
| 115 |
0 |
seqs = new String[seqsel.getSize()]; |
| 116 |
0 |
for (int i = 0; i < seqs.length; i++) |
| 117 |
|
{ |
| 118 |
0 |
seqs[i] = seqsel.getSequenceAt(i).getName(); |
| 119 |
|
} |
| 120 |
0 |
if (strt < seqsel.getStartRes()) |
| 121 |
|
{ |
| 122 |
0 |
strt = seqsel.getStartRes(); |
| 123 |
|
} |
| 124 |
0 |
if (end == -1 || end > seqsel.getEndRes()) |
| 125 |
|
{ |
| 126 |
0 |
end = seqsel.getEndRes(); |
| 127 |
|
} |
| 128 |
|
} |
| 129 |
0 |
if (colsel != null && !colsel.isEmpty()) |
| 130 |
|
{ |
| 131 |
0 |
if (end == -1) |
| 132 |
|
{ |
| 133 |
0 |
end = colsel.getMax() + 1; |
| 134 |
|
} |
| 135 |
0 |
cols = new String[colsel.getSelected().size()]; |
| 136 |
0 |
for (int i = 0; i < cols.length; i++) |
| 137 |
|
{ |
| 138 |
0 |
cols[i] = "" + (1 + colsel.getSelected().get(i).intValue()); |
| 139 |
|
} |
| 140 |
|
} |
| 141 |
|
else |
| 142 |
|
{ |
| 143 |
0 |
if (seqsel != null && seqsel.getSize() > 0) |
| 144 |
|
{ |
| 145 |
|
|
| 146 |
0 |
cols = new String[1]; |
| 147 |
0 |
cols[0] = "" + (1 + strt) + "-" + (1 + end); |
| 148 |
|
} |
| 149 |
|
} |
| 150 |
0 |
doSendCallback(_listener, |
| 151 |
|
new Object[] |
| 152 |
|
{ Jalview.getInstance().j2sAppletID, srcFrame, source, setid, |
| 153 |
|
seqs, cols }); |
| 154 |
|
} |
| 155 |
|
|
| 156 |
|
} |
| 157 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 158 |
0 |
public JalviewJSApp(Jalview jalview, ArgsParser aparser)... |
| 159 |
|
{ |
| 160 |
0 |
Platform.setAppClass(this); |
| 161 |
0 |
this.jalview = jalview; |
| 162 |
0 |
this.aparser = aparser; |
| 163 |
|
} |
| 164 |
|
|
| |
|
| 0% |
Uncovered Elements: 37 (37) |
Complexity: 12 |
Complexity Density: 0.57 |
|
| 165 |
0 |
@Override... |
| 166 |
|
public boolean addPdbFile(String sequenceId, String pdbId, String pdbFile, |
| 167 |
|
AlignFrame alf) |
| 168 |
|
{ |
| 169 |
0 |
if (alf == null) |
| 170 |
|
{ |
| 171 |
0 |
alf = getCurrentAlignFrame(); |
| 172 |
|
} |
| 173 |
0 |
SequenceI seq = alf.getViewport().getAlignment().findName(sequenceId); |
| 174 |
0 |
if (seq != null) |
| 175 |
|
{ |
| 176 |
0 |
Vector<PDBEntry> pdbe = seq.getAllPDBEntries(); |
| 177 |
0 |
PDBEntry pdbentry = null; |
| 178 |
0 |
if (pdbe != null && pdbe.size() > 0) |
| 179 |
|
{ |
| 180 |
0 |
for (int pe = 0, peSize = pdbe.size(); pe < peSize; pe++) |
| 181 |
|
{ |
| 182 |
0 |
pdbentry = pdbe.elementAt(pe); |
| 183 |
0 |
if (!pdbentry.getId().equals(pdbId) |
| 184 |
|
|| pdbFile != null && !pdbentry.getFile().equals(pdbFile)) |
| 185 |
|
{ |
| 186 |
0 |
pdbentry = null; |
| 187 |
|
} |
| 188 |
|
} |
| 189 |
|
} |
| 190 |
0 |
if (pdbentry == null) |
| 191 |
|
{ |
| 192 |
0 |
pdbentry = new PDBEntry(pdbId, null, pdbFile); |
| 193 |
0 |
if (pdbFile != null) |
| 194 |
|
{ |
| 195 |
0 |
DataSourceType protocol = AppletFormatAdapter |
| 196 |
|
.resolveProtocol(pdbFile, FileFormat.PDB); |
| 197 |
0 |
if (protocol == null) |
| 198 |
0 |
return false; |
| 199 |
0 |
pdbentry.setProperty("protocol", protocol); |
| 200 |
|
} |
| 201 |
0 |
seq.addPDBId(pdbentry); |
| 202 |
0 |
alf.alignPanel.getStructureSelectionManager() |
| 203 |
|
.registerPDBEntry(pdbentry); |
| 204 |
|
} |
| 205 |
|
} |
| 206 |
0 |
return true; |
| 207 |
|
} |
| 208 |
|
|
| |
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.38 |
|
| 209 |
0 |
@Override... |
| 210 |
|
public String getAlignment(String format, boolean addSuffix, |
| 211 |
|
AlignFrame alf) |
| 212 |
|
{ |
| 213 |
0 |
try |
| 214 |
|
{ |
| 215 |
0 |
if (alf == null) |
| 216 |
|
{ |
| 217 |
0 |
alf = getCurrentAlignFrame(); |
| 218 |
|
} |
| 219 |
|
|
| 220 |
0 |
FileFormatI theFormat = FileFormats.getInstance().forName(format); |
| 221 |
0 |
String reply = new AppletFormatAdapter().formatSequences(theFormat, |
| 222 |
|
alf.getViewport().getAlignment(), addSuffix); |
| 223 |
0 |
return reply; |
| 224 |
|
} catch (IllegalArgumentException ex) |
| 225 |
|
{ |
| 226 |
0 |
ex.printStackTrace(); |
| 227 |
0 |
return "Error retrieving alignment, possibly invalid format specifier: " |
| 228 |
|
+ format; |
| 229 |
|
} |
| 230 |
|
} |
| 231 |
|
|
| |
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 3 |
Complexity Density: 0.43 |
|
| 232 |
0 |
@Override... |
| 233 |
|
public String[] getAlignmentOrder(AlignFrame alf) |
| 234 |
|
{ |
| 235 |
0 |
if (alf == null) |
| 236 |
|
{ |
| 237 |
0 |
alf = getCurrentAlignFrame(); |
| 238 |
|
} |
| 239 |
0 |
AlignmentI alorder = alf.getViewport().getAlignment(); |
| 240 |
0 |
String[] order = new String[alorder.getHeight()]; |
| 241 |
0 |
for (int i = 0; i < order.length; i++) |
| 242 |
|
{ |
| 243 |
0 |
order[i] = alorder.getSequenceAt(i).getName(); |
| 244 |
|
} |
| 245 |
0 |
return order; |
| 246 |
|
} |
| 247 |
|
|
| |
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 248 |
0 |
@Override... |
| 249 |
|
public String getAnnotation(AlignFrame alf) |
| 250 |
|
{ |
| 251 |
0 |
if (alf == null) |
| 252 |
|
{ |
| 253 |
0 |
alf = getCurrentAlignFrame(); |
| 254 |
|
} |
| 255 |
0 |
String annotation = new AnnotationFile() |
| 256 |
|
.printAnnotationsForView(alf.getViewport()); |
| 257 |
0 |
return annotation; |
| 258 |
|
} |
| 259 |
|
|
| 260 |
|
|
| 261 |
|
|
| 262 |
|
|
| 263 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 264 |
0 |
@Override... |
| 265 |
|
public URL getCodeBase() |
| 266 |
|
{ |
| 267 |
0 |
return Platform.getCodeBase(); |
| 268 |
|
} |
| 269 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 270 |
0 |
@Override... |
| 271 |
|
public AlignFrame getCurrentAlignFrame() |
| 272 |
|
{ |
| 273 |
|
|
| 274 |
|
|
| 275 |
|
|
| 276 |
|
|
| 277 |
0 |
return jalview.currentAlignFrame; |
| 278 |
|
} |
| 279 |
|
|
| 280 |
|
|
| 281 |
|
|
| 282 |
|
|
| 283 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 284 |
0 |
@Override... |
| 285 |
|
public URL getDocumentBase() |
| 286 |
|
{ |
| 287 |
0 |
return Platform.getDocumentBase(); |
| 288 |
|
} |
| 289 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 290 |
0 |
@Override... |
| 291 |
|
public String[] getFeatureGroups(AlignFrame alf) |
| 292 |
|
{ |
| 293 |
0 |
if (alf == null) |
| 294 |
|
{ |
| 295 |
0 |
alf = getCurrentAlignFrame(); |
| 296 |
|
} |
| 297 |
0 |
return alf.getFeatureGroups(); |
| 298 |
|
} |
| 299 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 300 |
0 |
@Override... |
| 301 |
|
public String[] getFeatureGroupsOfState(boolean visible, AlignFrame alf) |
| 302 |
|
{ |
| 303 |
0 |
if (alf == null) |
| 304 |
|
{ |
| 305 |
0 |
alf = getCurrentAlignFrame(); |
| 306 |
|
} |
| 307 |
0 |
return alf.getFeatureGroupsOfState(visible); |
| 308 |
|
} |
| 309 |
|
|
| 310 |
|
|
| 311 |
|
|
| 312 |
|
|
| 313 |
|
@param |
| 314 |
|
|
| 315 |
|
|
| 316 |
|
|
| 317 |
|
@param |
| 318 |
|
|
| 319 |
|
@return |
| 320 |
|
|
| |
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 5 |
Complexity Density: 0.33 |
|
| 321 |
0 |
@Override... |
| 322 |
|
public String getFeatures(String format, AlignFrame alf) |
| 323 |
|
{ |
| 324 |
0 |
if (alf == null) |
| 325 |
|
{ |
| 326 |
0 |
alf = getCurrentAlignFrame(); |
| 327 |
|
} |
| 328 |
0 |
String features; |
| 329 |
0 |
FeaturesFile formatter = new FeaturesFile(); |
| 330 |
0 |
format = format.toLowerCase(); |
| 331 |
0 |
if (format.indexOf(";") < 0) |
| 332 |
0 |
format += ";includenonpositional"; |
| 333 |
0 |
boolean nonpos = format.indexOf(";includenonpositional") >= 0; |
| 334 |
0 |
boolean compl = format.indexOf(";includecomplement") >= 0; |
| 335 |
0 |
if (format.startsWith("jalview")) |
| 336 |
|
{ |
| 337 |
0 |
features = formatter.printJalviewFormat( |
| 338 |
|
alf.getViewport().getAlignment().getSequencesArray(), |
| 339 |
|
alf.alignPanel.getFeatureRenderer(), nonpos, compl); |
| 340 |
|
} |
| 341 |
|
else |
| 342 |
|
{ |
| 343 |
0 |
features = formatter.printGffFormat( |
| 344 |
|
alf.getViewport().getAlignment().getSequencesArray(), |
| 345 |
|
alf.alignPanel.getFeatureRenderer(), nonpos, compl); |
| 346 |
|
} |
| 347 |
|
|
| 348 |
0 |
if (features == null) |
| 349 |
|
{ |
| 350 |
0 |
features = ""; |
| 351 |
|
} |
| 352 |
0 |
return features; |
| 353 |
|
|
| 354 |
|
} |
| 355 |
|
|
| 356 |
|
|
| 357 |
|
|
| 358 |
|
|
| 359 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 360 |
0 |
@Override... |
| 361 |
|
public String getParameter(String name) |
| 362 |
|
{ |
| 363 |
0 |
return (String) aparser.getAppletValue(name, null, true); |
| 364 |
|
} |
| 365 |
|
|
| 366 |
|
|
| 367 |
|
|
| 368 |
|
|
| 369 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 370 |
0 |
@Override... |
| 371 |
|
public Object getParameterAsObject(String name) |
| 372 |
|
{ |
| 373 |
0 |
return aparser.getAppletValue(name, null, false); |
| 374 |
|
} |
| 375 |
|
|
| 376 |
|
|
| 377 |
|
|
| 378 |
|
|
| 379 |
|
@param |
| 380 |
|
@return |
| 381 |
|
|
| |
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 3 |
Complexity Density: 0.33 |
|
| 382 |
0 |
public String getPastedSequence(JalviewJSApp jalviewApp)... |
| 383 |
|
{ |
| 384 |
0 |
StringBuffer data = new StringBuffer("PASTE"); |
| 385 |
0 |
int i = 1; |
| 386 |
0 |
String file = null; |
| 387 |
0 |
while ((file = getParameter("sequence" + i)) != null) |
| 388 |
|
{ |
| 389 |
0 |
data.append(file.toString() + "\n"); |
| 390 |
0 |
i++; |
| 391 |
|
} |
| 392 |
0 |
if (data.length() > 5) |
| 393 |
|
{ |
| 394 |
0 |
file = data.toString(); |
| 395 |
|
} |
| 396 |
0 |
return file; |
| 397 |
|
} |
| 398 |
|
|
| 399 |
|
|
| 400 |
|
|
| 401 |
|
|
| 402 |
|
@see |
| 403 |
|
|
| 404 |
|
|
| |
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
| 405 |
0 |
@Override... |
| 406 |
|
public SequenceI[] getSelectedSequences(AlignFrame alf) |
| 407 |
|
{ |
| 408 |
|
|
| 409 |
|
|
| 410 |
|
|
| 411 |
|
|
| 412 |
|
|
| 413 |
|
|
| 414 |
0 |
if (alf == null) |
| 415 |
|
{ |
| 416 |
0 |
alf = getCurrentAlignFrame(); |
| 417 |
|
} |
| 418 |
0 |
AlignViewport v = alf.getViewport(); |
| 419 |
0 |
if (v.getSelectionGroup() != null) |
| 420 |
|
{ |
| 421 |
0 |
return v.getSelectionGroup().getSequencesInOrder(v.getAlignment()); |
| 422 |
|
} |
| 423 |
0 |
return null; |
| 424 |
|
} |
| 425 |
|
|
| 426 |
|
|
| 427 |
|
|
| 428 |
|
|
| 429 |
|
|
| 430 |
|
|
| 431 |
|
|
| 432 |
|
|
| 433 |
|
|
| 434 |
|
|
| 435 |
|
|
| 436 |
|
|
| 437 |
|
|
| 438 |
|
|
| 439 |
|
|
| 440 |
|
|
| |
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 4 |
Complexity Density: 0.36 |
|
| 441 |
0 |
@Override... |
| 442 |
|
public String getSelectedSequencesAsAlignment(String format, |
| 443 |
|
boolean addSuffix, AlignFrame alf) |
| 444 |
|
{ |
| 445 |
|
|
| 446 |
0 |
if (alf == null) |
| 447 |
|
{ |
| 448 |
0 |
alf = getCurrentAlignFrame(); |
| 449 |
|
} |
| 450 |
0 |
try |
| 451 |
|
{ |
| 452 |
0 |
AlignViewport vp = alf.getViewport(); |
| 453 |
0 |
FileFormatI theFormat = FileFormats.getInstance().forName(format); |
| 454 |
0 |
if (vp.getSelectionGroup() != null) |
| 455 |
|
{ |
| 456 |
|
|
| 457 |
|
|
| 458 |
|
|
| 459 |
0 |
String reply = new AppletFormatAdapter().formatSequences(theFormat, |
| 460 |
|
new Alignment(vp.getSelectionAsNewSequence()), addSuffix); |
| 461 |
0 |
return reply; |
| 462 |
|
} |
| 463 |
|
} catch (IllegalArgumentException ex) |
| 464 |
|
{ |
| 465 |
0 |
ex.printStackTrace(); |
| 466 |
0 |
return "Error retrieving alignment, possibly invalid format specifier: " |
| 467 |
|
+ format; |
| 468 |
|
} |
| 469 |
0 |
return ""; |
| 470 |
|
} |
| 471 |
|
|
| |
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 7 |
Complexity Density: 0.5 |
|
| 472 |
0 |
@Override... |
| 473 |
|
public void highlight(String sequenceId, String position, |
| 474 |
|
String alignedPosition, AlignFrame alf) |
| 475 |
|
{ |
| 476 |
0 |
if (alf == null) |
| 477 |
|
{ |
| 478 |
0 |
alf = getCurrentAlignFrame(); |
| 479 |
|
} |
| 480 |
|
|
| 481 |
0 |
jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher( |
| 482 |
|
alf.getViewport().getAlignment().getSequencesArray()); |
| 483 |
0 |
final SequenceI sq = matcher.findIdMatch(sequenceId); |
| 484 |
0 |
if (sq != null) |
| 485 |
|
{ |
| 486 |
0 |
int apos = -1; |
| 487 |
0 |
try |
| 488 |
|
{ |
| 489 |
0 |
apos = Integer.valueOf(position).intValue(); |
| 490 |
0 |
apos--; |
| 491 |
|
} catch (NumberFormatException ex) |
| 492 |
|
{ |
| 493 |
0 |
return; |
| 494 |
|
} |
| 495 |
0 |
final int pos = apos; |
| 496 |
|
|
| 497 |
0 |
if (alignedPosition != null && (alignedPosition.trim().length() == 0 |
| 498 |
|
|| alignedPosition.toLowerCase().indexOf("false") > -1)) |
| 499 |
|
{ |
| 500 |
0 |
java.awt.EventQueue.invokeLater(new Runnable() |
| 501 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 502 |
0 |
@Override... |
| 503 |
|
public void run() |
| 504 |
|
{ |
| 505 |
0 |
StructureSelectionManager |
| 506 |
|
.getStructureSelectionManager(Desktop.getInstance()) |
| 507 |
|
.mouseOverVamsasSequence(sq, sq.findIndex(pos), null); |
| 508 |
|
} |
| 509 |
|
}); |
| 510 |
|
} |
| 511 |
|
else |
| 512 |
|
{ |
| 513 |
0 |
java.awt.EventQueue.invokeLater(new Runnable() |
| 514 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 515 |
0 |
@Override... |
| 516 |
|
public void run() |
| 517 |
|
{ |
| 518 |
0 |
StructureSelectionManager |
| 519 |
|
.getStructureSelectionManager(Desktop.getInstance()) |
| 520 |
|
.mouseOverVamsasSequence(sq, pos, null); |
| 521 |
|
} |
| 522 |
|
}); |
| 523 |
|
} |
| 524 |
|
} |
| 525 |
|
} |
| 526 |
|
|
| |
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 5 |
Complexity Density: 0.62 |
|
| 527 |
0 |
@Override... |
| 528 |
|
public AlignFrame loadAlignment(String text, String title, int width, |
| 529 |
|
int height) |
| 530 |
|
{ |
| 531 |
0 |
AlignmentI al = null; |
| 532 |
|
|
| 533 |
0 |
try |
| 534 |
|
{ |
| 535 |
0 |
FileFormatI format = new IdentifyFile().identify(text, |
| 536 |
|
DataSourceType.PASTE); |
| 537 |
0 |
al = new AppletFormatAdapter().readFile(text, DataSourceType.PASTE, |
| 538 |
|
format); |
| 539 |
0 |
if (al.getHeight() > 0) |
| 540 |
|
{ |
| 541 |
0 |
return new AlignFrame(al, |
| 542 |
0 |
width > 0 ? width : AlignFrame.DEFAULT_WIDTH, |
| 543 |
0 |
height > 0 ? height : AlignFrame.DEFAULT_HEIGHT, title); |
| 544 |
|
} |
| 545 |
|
} catch (IOException ex) |
| 546 |
|
{ |
| 547 |
0 |
ex.printStackTrace(); |
| 548 |
|
} |
| 549 |
0 |
return null; |
| 550 |
|
} |
| 551 |
|
|
| |
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
| 552 |
0 |
@Override... |
| 553 |
|
public void loadAnnotation(String annotation, AlignFrame alf) |
| 554 |
|
{ |
| 555 |
0 |
if (alf == null) |
| 556 |
|
{ |
| 557 |
0 |
alf = getCurrentAlignFrame(); |
| 558 |
|
} |
| 559 |
0 |
if (new AnnotationFile().annotateAlignmentView(alf.getViewport(), |
| 560 |
|
annotation, DataSourceType.PASTE)) |
| 561 |
|
{ |
| 562 |
0 |
alf.alignPanel.fontChanged(); |
| 563 |
0 |
alf.alignPanel.setScrollValues(0, 0); |
| 564 |
|
} |
| 565 |
|
else |
| 566 |
|
{ |
| 567 |
0 |
alf.parseFeaturesFile(annotation, DataSourceType.PASTE); |
| 568 |
|
} |
| 569 |
|
} |
| 570 |
|
|
| |
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 4 |
Complexity Density: 0.5 |
|
| 571 |
0 |
@Override... |
| 572 |
|
public boolean loadFeatures(String features, boolean autoenabledisplay, |
| 573 |
|
AlignFrame alf) |
| 574 |
|
{ |
| 575 |
0 |
if (alf == null) |
| 576 |
|
{ |
| 577 |
0 |
alf = getCurrentAlignFrame(); |
| 578 |
|
} |
| 579 |
0 |
boolean ret = alf.parseFeaturesFile(features, DataSourceType.PASTE); |
| 580 |
0 |
if (!ret) |
| 581 |
|
{ |
| 582 |
0 |
return false; |
| 583 |
|
} |
| 584 |
0 |
if (autoenabledisplay) |
| 585 |
|
{ |
| 586 |
0 |
alf.getViewport().setShowSequenceFeatures(true); |
| 587 |
|
|
| 588 |
|
|
| 589 |
|
} |
| 590 |
0 |
return true; |
| 591 |
|
} |
| 592 |
|
|
| |
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 3 |
Complexity Density: 0.75 |
|
| 593 |
0 |
@Override... |
| 594 |
|
public boolean loadScoreFile(String fileName, AlignFrame alf) |
| 595 |
|
{ |
| 596 |
0 |
try |
| 597 |
|
{ |
| 598 |
0 |
(alf == null ? getCurrentAlignFrame() : alf) |
| 599 |
|
.loadJalviewDataFile(fileName, null, null, null); |
| 600 |
0 |
return true; |
| 601 |
|
} catch (Throwable t) |
| 602 |
|
{ |
| 603 |
0 |
return false; |
| 604 |
|
} |
| 605 |
|
} |
| 606 |
|
|
| 607 |
|
|
| 608 |
|
|
| 609 |
|
|
| 610 |
|
|
| 611 |
|
|
| 612 |
|
@param |
| 613 |
|
@param |
| 614 |
|
|
| 615 |
|
@return |
| 616 |
|
|
| 617 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 618 |
0 |
@Override... |
| 619 |
|
public Object openPcaPanel(String modelName, AlignFrame alf) |
| 620 |
|
{ |
| 621 |
0 |
if (alf == null) |
| 622 |
|
{ |
| 623 |
0 |
alf = getCurrentAlignFrame(); |
| 624 |
|
} |
| 625 |
0 |
return CalculationChooser.openPcaPanel(alf, modelName, null); |
| 626 |
|
} |
| 627 |
|
|
| 628 |
|
|
| 629 |
|
|
| 630 |
|
|
| 631 |
|
|
| 632 |
|
|
| 633 |
|
@param |
| 634 |
|
@param |
| 635 |
|
@param |
| 636 |
|
|
| 637 |
|
@return |
| 638 |
|
|
| 639 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 640 |
0 |
@Override... |
| 641 |
|
public Object openTreePanel(String treeType, String modelName, |
| 642 |
|
AlignFrame alf) |
| 643 |
|
{ |
| 644 |
0 |
if (alf == null) |
| 645 |
|
{ |
| 646 |
0 |
alf = getCurrentAlignFrame(); |
| 647 |
|
} |
| 648 |
0 |
return CalculationChooser.openTreePanel(alf, treeType, modelName, null); |
| 649 |
|
} |
| 650 |
|
|
| |
|
| 0% |
Uncovered Elements: 42 (42) |
Complexity: 11 |
Complexity Density: 0.42 |
|
| 651 |
0 |
@Override... |
| 652 |
|
public boolean orderAlignment(String[] ids, String undoName, |
| 653 |
|
AlignFrame alf) |
| 654 |
|
{ |
| 655 |
0 |
if (alf == null) |
| 656 |
0 |
alf = getCurrentAlignFrame(); |
| 657 |
0 |
SequenceI[] sqs = null; |
| 658 |
0 |
if (ids != null && ids.length > 0) |
| 659 |
|
{ |
| 660 |
0 |
jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher( |
| 661 |
|
alf.getViewport().getAlignment().getSequencesArray()); |
| 662 |
0 |
int s = 0; |
| 663 |
0 |
sqs = new SequenceI[ids.length]; |
| 664 |
0 |
for (int i = 0; i < ids.length; i++) |
| 665 |
|
{ |
| 666 |
0 |
if (ids[i].trim().length() == 0) |
| 667 |
|
{ |
| 668 |
0 |
continue; |
| 669 |
|
} |
| 670 |
0 |
SequenceI sq = matcher.findIdMatch(ids[i]); |
| 671 |
0 |
if (sq != null) |
| 672 |
|
{ |
| 673 |
0 |
sqs[s++] = sq; |
| 674 |
|
} |
| 675 |
|
} |
| 676 |
0 |
if (s > 0) |
| 677 |
|
{ |
| 678 |
0 |
SequenceI[] sqq = new SequenceI[s]; |
| 679 |
0 |
System.arraycopy(sqs, 0, sqq, 0, s); |
| 680 |
0 |
sqs = sqq; |
| 681 |
|
} |
| 682 |
|
else |
| 683 |
|
{ |
| 684 |
0 |
sqs = null; |
| 685 |
|
} |
| 686 |
|
} |
| 687 |
0 |
if (sqs == null) |
| 688 |
|
{ |
| 689 |
0 |
return false; |
| 690 |
|
} |
| 691 |
0 |
; |
| 692 |
0 |
final AlignmentOrder aorder = new AlignmentOrder(sqs); |
| 693 |
|
|
| 694 |
0 |
if (undoName != null && undoName.trim().length() == 0) |
| 695 |
|
{ |
| 696 |
0 |
undoName = null; |
| 697 |
|
} |
| 698 |
0 |
final String _undoName = undoName; |
| 699 |
|
|
| 700 |
|
|
| 701 |
|
|
| 702 |
0 |
return alf.sortBy(aorder, _undoName); |
| 703 |
|
} |
| 704 |
|
|
| 705 |
|
|
| 706 |
|
|
| 707 |
|
|
| 708 |
|
|
| 709 |
|
@param |
| 710 |
|
@return |
| 711 |
|
|
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 712 |
0 |
@Override... |
| 713 |
|
public Object parseArguments(String[] args) |
| 714 |
|
{ |
| 715 |
|
|
| 716 |
0 |
try |
| 717 |
|
{ |
| 718 |
0 |
jalview.parseArguments(new ArgsParser(args), false); |
| 719 |
0 |
return null; |
| 720 |
|
} catch (Throwable t) |
| 721 |
|
{ |
| 722 |
0 |
return t; |
| 723 |
|
} |
| 724 |
|
} |
| 725 |
|
|
| 726 |
|
|
| 727 |
|
|
| 728 |
|
|
| 729 |
|
@param |
| 730 |
|
@param |
| 731 |
|
@return |
| 732 |
|
|
| |
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
| 733 |
0 |
@Override... |
| 734 |
|
public boolean parseFeaturesFile(String filename, AlignFrame alf) |
| 735 |
|
{ |
| 736 |
0 |
ret[0] = filename; |
| 737 |
0 |
DataSourceType protocol = resolveFileProtocol(ret); |
| 738 |
0 |
if (protocol == null) |
| 739 |
0 |
return false; |
| 740 |
0 |
return (alf == null ? getCurrentAlignFrame() : alf) |
| 741 |
|
.parseFeaturesFile(ret[0], protocol); |
| 742 |
|
} |
| 743 |
|
|
| |
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 4 |
Complexity Density: 0.67 |
|
| 744 |
0 |
@Override... |
| 745 |
|
public void removeSelectionListener(String listener, AlignFrame alf) |
| 746 |
|
{ |
| 747 |
|
|
| 748 |
0 |
List<SelectionListener> listeners = Desktop |
| 749 |
|
.getStructureSelectionManager().getListeners(); |
| 750 |
0 |
for (int i = listeners.size(); --i >= 0;) |
| 751 |
|
{ |
| 752 |
0 |
SelectionListener l = listeners.get(i); |
| 753 |
0 |
if (l instanceof JsSelectionListener |
| 754 |
|
&& ((JsSelectionListener) l).isFor(alf, listener)) |
| 755 |
|
{ |
| 756 |
0 |
listeners.remove(i); |
| 757 |
0 |
break; |
| 758 |
|
} |
| 759 |
|
} |
| 760 |
|
} |
| 761 |
|
|
| |
|
| 0% |
Uncovered Elements: 29 (29) |
Complexity: 7 |
Complexity Density: 0.37 |
|
| 762 |
0 |
private DataSourceType resolveFileProtocol(String[] retPath)... |
| 763 |
|
{ |
| 764 |
0 |
String path = retPath[0]; |
| 765 |
|
|
| 766 |
|
|
| 767 |
|
|
| 768 |
0 |
if (path.startsWith("PASTE")) |
| 769 |
|
{ |
| 770 |
0 |
retPath[0] = path.substring(5); |
| 771 |
0 |
return DataSourceType.PASTE; |
| 772 |
|
} |
| 773 |
|
|
| 774 |
|
|
| 775 |
|
|
| 776 |
|
|
| 777 |
0 |
if (path.indexOf("://") >= 0) |
| 778 |
|
{ |
| 779 |
0 |
return DataSourceType.URL; |
| 780 |
|
} |
| 781 |
|
|
| 782 |
|
|
| 783 |
|
|
| 784 |
|
|
| 785 |
0 |
URL documentBase = getDocumentBase(); |
| 786 |
0 |
String withDocBase = resolveUrlForLocalOrAbsolute(path, documentBase); |
| 787 |
0 |
if (HttpUtils.isValidUrl(withDocBase)) |
| 788 |
|
{ |
| 789 |
|
|
| 790 |
|
|
| 791 |
|
|
| 792 |
|
|
| 793 |
|
|
| 794 |
0 |
retPath[0] = withDocBase; |
| 795 |
0 |
return DataSourceType.URL; |
| 796 |
|
} |
| 797 |
|
|
| 798 |
|
|
| 799 |
|
|
| 800 |
|
|
| 801 |
0 |
URL codeBase = getCodeBase(); |
| 802 |
0 |
String withCodeBase = resolveUrlForLocalOrAbsolute(path, codeBase); |
| 803 |
0 |
if (!withCodeBase.equals(withDocBase) |
| 804 |
|
&& HttpUtils.isValidUrl(withCodeBase)) |
| 805 |
|
{ |
| 806 |
|
|
| 807 |
|
|
| 808 |
|
|
| 809 |
|
|
| 810 |
|
|
| 811 |
0 |
retPath[0] = withCodeBase; |
| 812 |
0 |
return DataSourceType.URL; |
| 813 |
|
} |
| 814 |
|
|
| 815 |
|
|
| 816 |
|
|
| 817 |
|
|
| 818 |
|
|
| 819 |
0 |
if (inArchive(getClass(), path)) |
| 820 |
|
{ |
| 821 |
0 |
return DataSourceType.CLASSLOADER; |
| 822 |
|
} |
| 823 |
0 |
return null; |
| 824 |
|
} |
| 825 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 826 |
0 |
@Override... |
| 827 |
|
public void scrollViewTo(int topRow, int leftHandColumn, AlignFrame alf) |
| 828 |
|
{ |
| 829 |
|
|
| 830 |
0 |
java.awt.EventQueue.invokeLater(new Runnable() |
| 831 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 3 |
Complexity Density: 0.75 |
|
| 832 |
0 |
@Override... |
| 833 |
|
public void run() |
| 834 |
|
{ |
| 835 |
0 |
try |
| 836 |
|
{ |
| 837 |
0 |
(alf == null ? getCurrentAlignFrame() : alf).scrollTo(topRow, |
| 838 |
|
leftHandColumn); |
| 839 |
|
} catch (Exception ex) |
| 840 |
|
{ |
| 841 |
0 |
System.err.println("Couldn't parse integer arguments (topRow='" |
| 842 |
|
+ topRow + "' and leftHandColumn='" + leftHandColumn |
| 843 |
|
+ "')"); |
| 844 |
0 |
ex.printStackTrace(); |
| 845 |
|
} |
| 846 |
|
} |
| 847 |
|
}); |
| 848 |
|
} |
| 849 |
|
|
| |
|
| 0% |
Uncovered Elements: 132 (132) |
Complexity: 33 |
Complexity Density: 0.38 |
|
| 850 |
0 |
@Override... |
| 851 |
|
public void select(String ids[], String cols[], AlignFrame alf) |
| 852 |
|
{ |
| 853 |
0 |
if (alf == null) |
| 854 |
0 |
alf = getCurrentAlignFrame(); |
| 855 |
0 |
final SequenceGroup sel = new SequenceGroup(); |
| 856 |
0 |
final ColumnSelection csel = new ColumnSelection(); |
| 857 |
0 |
AlignmentI al = alf.getViewport().getAlignment(); |
| 858 |
0 |
jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher( |
| 859 |
|
alf.getViewport().getAlignment().getSequencesArray()); |
| 860 |
0 |
int start = 0, end = al.getWidth(), alw = al.getWidth(); |
| 861 |
0 |
boolean seqsfound = true; |
| 862 |
0 |
if (ids != null && ids.length > 0) |
| 863 |
|
{ |
| 864 |
0 |
seqsfound = false; |
| 865 |
0 |
for (int i = 0; i < ids.length; i++) |
| 866 |
|
{ |
| 867 |
0 |
if (ids[i].trim().length() == 0) |
| 868 |
|
{ |
| 869 |
0 |
continue; |
| 870 |
|
} |
| 871 |
0 |
SequenceI sq = matcher.findIdMatch(ids[i]); |
| 872 |
0 |
if (sq != null) |
| 873 |
|
{ |
| 874 |
0 |
seqsfound = true; |
| 875 |
0 |
sel.addSequence(sq, false); |
| 876 |
|
} |
| 877 |
|
} |
| 878 |
|
} |
| 879 |
0 |
boolean inseqpos = false; |
| 880 |
0 |
if (cols != null && cols.length > 0) |
| 881 |
|
{ |
| 882 |
0 |
boolean seset = false; |
| 883 |
0 |
for (int i = 0; i < cols.length; i++) |
| 884 |
|
{ |
| 885 |
0 |
String cl = cols[i].trim(); |
| 886 |
0 |
if (cl.length() == 0) |
| 887 |
|
{ |
| 888 |
0 |
continue; |
| 889 |
|
} |
| 890 |
0 |
int p; |
| 891 |
0 |
if ((p = cl.indexOf("-")) > -1) |
| 892 |
|
{ |
| 893 |
0 |
int from = -1, to = -1; |
| 894 |
0 |
try |
| 895 |
|
{ |
| 896 |
0 |
from = Integer.valueOf(cl.substring(0, p)).intValue(); |
| 897 |
0 |
from--; |
| 898 |
|
} catch (NumberFormatException ex) |
| 899 |
|
{ |
| 900 |
0 |
System.err.println( |
| 901 |
|
"ERROR: Couldn't parse first integer in range element column selection string '" |
| 902 |
|
+ cl + "' - format is 'from-to'"); |
| 903 |
0 |
return; |
| 904 |
|
} |
| 905 |
0 |
try |
| 906 |
|
{ |
| 907 |
0 |
to = Integer.valueOf(cl.substring(p + 1)).intValue(); |
| 908 |
0 |
to--; |
| 909 |
|
} catch (NumberFormatException ex) |
| 910 |
|
{ |
| 911 |
0 |
System.err.println( |
| 912 |
|
"ERROR: Couldn't parse second integer in range element column selection string '" |
| 913 |
|
+ cl + "' - format is 'from-to'"); |
| 914 |
0 |
return; |
| 915 |
|
} |
| 916 |
0 |
if (from >= 0 && to >= 0) |
| 917 |
|
{ |
| 918 |
|
|
| 919 |
0 |
if (from < to) |
| 920 |
|
{ |
| 921 |
0 |
int t = to; |
| 922 |
0 |
to = from; |
| 923 |
0 |
to = t; |
| 924 |
|
} |
| 925 |
0 |
if (!seset) |
| 926 |
|
{ |
| 927 |
0 |
start = from; |
| 928 |
0 |
end = to; |
| 929 |
0 |
seset = true; |
| 930 |
|
} |
| 931 |
|
else |
| 932 |
|
{ |
| 933 |
|
|
| 934 |
0 |
if (start > from) |
| 935 |
|
{ |
| 936 |
0 |
start = from; |
| 937 |
|
} |
| 938 |
0 |
if (end < to) |
| 939 |
|
{ |
| 940 |
0 |
end = to; |
| 941 |
|
} |
| 942 |
|
} |
| 943 |
0 |
for (int r = from; r <= to; r++) |
| 944 |
|
{ |
| 945 |
0 |
if (r >= 0 && r < alw) |
| 946 |
|
{ |
| 947 |
0 |
csel.addElement(r); |
| 948 |
|
} |
| 949 |
|
} |
| 950 |
|
} |
| 951 |
|
else |
| 952 |
|
{ |
| 953 |
0 |
System.err.println("ERROR: Invalid Range '" + cl |
| 954 |
|
+ "' deparsed as [" + from + "," + to + "]"); |
| 955 |
|
} |
| 956 |
|
} |
| 957 |
|
else |
| 958 |
|
{ |
| 959 |
0 |
int r = -1; |
| 960 |
0 |
try |
| 961 |
|
{ |
| 962 |
0 |
r = Integer.valueOf(cl).intValue(); |
| 963 |
0 |
r--; |
| 964 |
|
} catch (NumberFormatException ex) |
| 965 |
|
{ |
| 966 |
0 |
if (cl.toLowerCase().equals("sequence")) |
| 967 |
|
{ |
| 968 |
|
|
| 969 |
0 |
inseqpos = true; |
| 970 |
|
} |
| 971 |
|
else |
| 972 |
|
{ |
| 973 |
0 |
System.err.println( |
| 974 |
|
"ERROR: Couldn't parse integer from point selection element of column selection string '" |
| 975 |
|
+ cl + "'"); |
| 976 |
0 |
return; |
| 977 |
|
} |
| 978 |
|
} |
| 979 |
0 |
if (r >= 0 && r <= alw) |
| 980 |
|
{ |
| 981 |
0 |
if (!seset) |
| 982 |
|
{ |
| 983 |
0 |
start = r; |
| 984 |
0 |
end = r; |
| 985 |
0 |
seset = true; |
| 986 |
|
} |
| 987 |
|
else |
| 988 |
|
{ |
| 989 |
|
|
| 990 |
0 |
if (start > r) |
| 991 |
|
{ |
| 992 |
0 |
start = r; |
| 993 |
|
} |
| 994 |
0 |
if (end < r) |
| 995 |
|
{ |
| 996 |
0 |
end = r; |
| 997 |
|
} |
| 998 |
|
} |
| 999 |
0 |
csel.addElement(r); |
| 1000 |
|
} |
| 1001 |
|
else |
| 1002 |
|
{ |
| 1003 |
0 |
System.err.println("ERROR: Invalid Point selection '" + cl |
| 1004 |
|
+ "' deparsed as [" + r + "]"); |
| 1005 |
|
} |
| 1006 |
|
} |
| 1007 |
|
} |
| 1008 |
|
} |
| 1009 |
0 |
if (seqsfound) |
| 1010 |
|
{ |
| 1011 |
|
|
| 1012 |
|
|
| 1013 |
0 |
if (inseqpos && sel.getSize() > 0) |
| 1014 |
|
{ |
| 1015 |
|
|
| 1016 |
0 |
SequenceI rs = sel.getSequenceAt(0); |
| 1017 |
0 |
start = rs.findIndex(start); |
| 1018 |
0 |
end = rs.findIndex(end); |
| 1019 |
0 |
List<Integer> cs = new ArrayList<>(csel.getSelected()); |
| 1020 |
0 |
csel.clear(); |
| 1021 |
0 |
for (Integer selectedCol : cs) |
| 1022 |
|
{ |
| 1023 |
0 |
csel.addElement(rs.findIndex(selectedCol)); |
| 1024 |
|
} |
| 1025 |
|
} |
| 1026 |
0 |
sel.setStartRes(start); |
| 1027 |
0 |
sel.setEndRes(end); |
| 1028 |
0 |
AlignFrame af = alf; |
| 1029 |
0 |
EventQueue.invokeLater(new Runnable() |
| 1030 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1031 |
0 |
@Override... |
| 1032 |
|
public void run() |
| 1033 |
|
{ |
| 1034 |
0 |
af.select(sel, csel, |
| 1035 |
|
af.getCurrentView().getAlignment().getHiddenColumns()); |
| 1036 |
|
} |
| 1037 |
|
}); |
| 1038 |
|
} |
| 1039 |
|
} |
| 1040 |
|
|
| 1041 |
|
|
| 1042 |
|
|
| 1043 |
|
|
| 1044 |
|
|
| 1045 |
|
|
| 1046 |
|
|
| 1047 |
|
|
| 1048 |
|
|
| 1049 |
|
|
| 1050 |
|
|
| 1051 |
|
|
| 1052 |
|
|
| 1053 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
| 1054 |
0 |
@Override... |
| 1055 |
|
public void setFeatureGroupState(final String[] groups, |
| 1056 |
|
boolean state, AlignFrame alf) |
| 1057 |
|
{ |
| 1058 |
|
|
| 1059 |
|
|
| 1060 |
|
|
| 1061 |
|
|
| 1062 |
|
|
| 1063 |
|
|
| 1064 |
|
|
| 1065 |
|
|
| 1066 |
|
|
| 1067 |
|
|
| 1068 |
|
|
| 1069 |
|
|
| 1070 |
|
|
| 1071 |
|
|
| 1072 |
|
|
| 1073 |
0 |
(alf == null ? getCurrentAlignFrame() : alf) |
| 1074 |
|
.setFeatureGroupState(groups, state); |
| 1075 |
|
} |
| 1076 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1077 |
0 |
@Override... |
| 1078 |
|
public void setSelectionListener(String listener, AlignFrame alf) |
| 1079 |
|
{ |
| 1080 |
0 |
Desktop.getStructureSelectionManager() |
| 1081 |
|
.addSelectionListener(new JsSelectionListener(alf, listener)); |
| 1082 |
|
} |
| 1083 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1084 |
0 |
@Override... |
| 1085 |
|
public void showOverview() |
| 1086 |
|
{ |
| 1087 |
0 |
getCurrentAlignFrame().overviewMenuItem_actionPerformed(null); |
| 1088 |
|
} |
| 1089 |
|
|
| 1090 |
|
|
| 1091 |
|
|
| 1092 |
|
|
| |
|
| 0% |
Uncovered Elements: 44 (44) |
Complexity: 10 |
Complexity Density: 0.38 |
|
| 1093 |
0 |
@Override... |
| 1094 |
|
public void showStructure(String pdbID, String fileType, AlignFrame alf) |
| 1095 |
|
{ |
| 1096 |
0 |
if (alf == null) |
| 1097 |
0 |
alf = getCurrentAlignFrame(); |
| 1098 |
0 |
PDBEntry pe = null; |
| 1099 |
0 |
SequenceI[] seqs = null; |
| 1100 |
0 |
if (pdbID == null) |
| 1101 |
|
{ |
| 1102 |
0 |
seqs = alf.getViewport().getSequenceSelection(); |
| 1103 |
0 |
if (seqs.length == 0) |
| 1104 |
0 |
seqs = alf.getViewport().getAlignment().getSequencesArray(); |
| 1105 |
0 |
for (int i = 0; i < seqs.length; i++) |
| 1106 |
|
{ |
| 1107 |
0 |
Vector<PDBEntry> list = seqs[i].getAllPDBEntries(); |
| 1108 |
0 |
if (list.size() > 0) |
| 1109 |
|
{ |
| 1110 |
0 |
pe = list.get(0); |
| 1111 |
0 |
break; |
| 1112 |
|
} |
| 1113 |
|
} |
| 1114 |
|
} |
| 1115 |
0 |
if (pe == null) |
| 1116 |
|
{ |
| 1117 |
0 |
if (pdbID == null) |
| 1118 |
0 |
return; |
| 1119 |
0 |
pe = new PDBEntry(pdbID, null, fileType); |
| 1120 |
0 |
List<SequenceI> list = alf.getViewport().getAlignment() |
| 1121 |
|
.getSequences(); |
| 1122 |
0 |
List<SequenceI> tmp = new ArrayList<SequenceI>(); |
| 1123 |
0 |
for (int i = 0; i < list.size(); i++) |
| 1124 |
|
{ |
| 1125 |
0 |
SequenceI seq = list.get(i); |
| 1126 |
0 |
if (seq.getPDBEntry(pdbID) != null) |
| 1127 |
|
{ |
| 1128 |
0 |
tmp.add(seq); |
| 1129 |
|
} |
| 1130 |
|
} |
| 1131 |
0 |
seqs = tmp.toArray(new SequenceI[tmp.size()]); |
| 1132 |
0 |
alf.alignPanel.selectSequences(tmp); |
| 1133 |
|
} |
| 1134 |
0 |
StructureViewer.launchStructureViewer(alf.alignPanel, pe, seqs); |
| 1135 |
|
} |
| 1136 |
|
|
| 1137 |
|
|
| 1138 |
|
|
| 1139 |
|
|
| 1140 |
|
|
| 1141 |
|
|
| 1142 |
|
|
| 1143 |
|
@param |
| 1144 |
|
|
| 1145 |
|
|
| 1146 |
|
@param |
| 1147 |
|
|
| 1148 |
|
@return |
| 1149 |
|
|
| |
|
| 0% |
Uncovered Elements: 21 (21) |
Complexity: 4 |
Complexity Density: 0.27 |
|
| 1150 |
0 |
private static String resolveUrlForLocalOrAbsolute(String targetPath,... |
| 1151 |
|
URL localref) |
| 1152 |
|
{ |
| 1153 |
0 |
String resolvedPath = ""; |
| 1154 |
0 |
if (targetPath.startsWith("/")) |
| 1155 |
|
{ |
| 1156 |
0 |
String codebase = localref.toString(); |
| 1157 |
0 |
String localfile = localref.getFile(); |
| 1158 |
0 |
resolvedPath = codebase.substring(0, |
| 1159 |
|
codebase.length() - localfile.length()) + targetPath; |
| 1160 |
0 |
return resolvedPath; |
| 1161 |
|
} |
| 1162 |
|
|
| 1163 |
|
|
| 1164 |
|
|
| 1165 |
|
|
| 1166 |
|
|
| 1167 |
|
|
| 1168 |
0 |
String urlPath = localref.toString(); |
| 1169 |
0 |
String directoryPath = urlPath; |
| 1170 |
0 |
int lastSeparator = directoryPath.lastIndexOf("/"); |
| 1171 |
0 |
if (lastSeparator > 0) |
| 1172 |
|
{ |
| 1173 |
0 |
directoryPath = directoryPath.substring(0, lastSeparator + 1); |
| 1174 |
|
} |
| 1175 |
|
|
| 1176 |
0 |
if (targetPath.startsWith("/")) |
| 1177 |
|
{ |
| 1178 |
|
|
| 1179 |
|
|
| 1180 |
|
|
| 1181 |
|
|
| 1182 |
|
|
| 1183 |
|
|
| 1184 |
|
|
| 1185 |
0 |
resolvedPath = directoryPath + targetPath.substring(1); |
| 1186 |
|
} |
| 1187 |
|
else |
| 1188 |
|
{ |
| 1189 |
0 |
resolvedPath = directoryPath + targetPath; |
| 1190 |
|
} |
| 1191 |
|
|
| 1192 |
|
|
| 1193 |
|
|
| 1194 |
|
|
| 1195 |
|
|
| 1196 |
0 |
return resolvedPath; |
| 1197 |
|
} |
| 1198 |
|
|
| 1199 |
|
|
| 1200 |
|
|
| 1201 |
|
|
| 1202 |
|
@param |
| 1203 |
|
@param |
| 1204 |
|
@return |
| 1205 |
|
|
| |
|
| 0% |
Uncovered Elements: 31 (31) |
Complexity: 9 |
Complexity Density: 0.47 |
|
| 1206 |
0 |
private static String[] separatorListToArray(String list,... |
| 1207 |
|
String separator) |
| 1208 |
|
{ |
| 1209 |
|
|
| 1210 |
0 |
int seplen = separator.length(); |
| 1211 |
0 |
if (list == null || list.equals("") || list.equals(separator)) |
| 1212 |
|
{ |
| 1213 |
0 |
return null; |
| 1214 |
|
} |
| 1215 |
0 |
Vector<String> jv = new Vector<>(); |
| 1216 |
0 |
int cp = 0, pos; |
| 1217 |
0 |
while ((pos = list.indexOf(separator, cp)) > cp) |
| 1218 |
|
{ |
| 1219 |
0 |
jv.addElement(list.substring(cp, pos)); |
| 1220 |
0 |
cp = pos + seplen; |
| 1221 |
|
} |
| 1222 |
0 |
if (cp < list.length()) |
| 1223 |
|
{ |
| 1224 |
0 |
String c = list.substring(cp); |
| 1225 |
0 |
if (!c.equals(separator)) |
| 1226 |
|
{ |
| 1227 |
0 |
jv.addElement(c); |
| 1228 |
|
} |
| 1229 |
|
} |
| 1230 |
0 |
if (jv.size() > 0) |
| 1231 |
|
{ |
| 1232 |
0 |
String[] v = new String[jv.size()]; |
| 1233 |
0 |
for (int i = 0; i < v.length; i++) |
| 1234 |
|
{ |
| 1235 |
0 |
v[i] = jv.elementAt(i); |
| 1236 |
|
} |
| 1237 |
0 |
jv.removeAllElements(); |
| 1238 |
0 |
return v; |
| 1239 |
|
} |
| 1240 |
0 |
return null; |
| 1241 |
|
} |
| 1242 |
|
|
| 1243 |
|
|
| 1244 |
|
|
| 1245 |
|
|
| 1246 |
|
@param |
| 1247 |
|
|
| 1248 |
|
@return |
| 1249 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 1250 |
0 |
private static boolean inArchive(Class<?> c, String f)... |
| 1251 |
|
{ |
| 1252 |
|
|
| 1253 |
|
|
| 1254 |
0 |
try |
| 1255 |
|
{ |
| 1256 |
0 |
boolean rtn = (c.getResourceAsStream("/" + f) != null); |
| 1257 |
0 |
return rtn; |
| 1258 |
|
} catch (Exception ex) |
| 1259 |
|
{ |
| 1260 |
0 |
System.out.println("Exception checking resources: " + f + " " + ex); |
| 1261 |
0 |
return false; |
| 1262 |
|
} |
| 1263 |
|
} |
| 1264 |
|
|
| 1265 |
|
|
| 1266 |
|
|
| 1267 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 1268 |
0 |
void callInitCallback()... |
| 1269 |
|
{ |
| 1270 |
0 |
Object initjscallback = getParameterAsObject("oninit"); |
| 1271 |
0 |
if (initjscallback != null) |
| 1272 |
|
{ |
| 1273 |
0 |
SwingUtilities.invokeLater(new Runnable() { |
| 1274 |
|
|
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 1275 |
0 |
@Override... |
| 1276 |
|
public void run() |
| 1277 |
|
{ |
| 1278 |
0 |
try |
| 1279 |
|
{ |
| 1280 |
0 |
doSendCallback(initjscallback, new Object[] {this}); |
| 1281 |
|
} catch (Exception e) |
| 1282 |
|
{ |
| 1283 |
0 |
System.err.println("Exception when executing _oninit callback '" |
| 1284 |
|
+ initjscallback + "'."); |
| 1285 |
0 |
e.printStackTrace(); |
| 1286 |
|
} |
| 1287 |
|
} |
| 1288 |
|
|
| 1289 |
|
}); |
| 1290 |
|
} |
| 1291 |
|
} |
| 1292 |
|
|
| 1293 |
|
|
| 1294 |
|
|
| 1295 |
|
|
| 1296 |
|
|
| 1297 |
|
|
| 1298 |
|
@param |
| 1299 |
|
|
| 1300 |
|
@param |
| 1301 |
|
@return |
| 1302 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 3 |
Complexity Density: 1 |
|
| 1303 |
0 |
String doSendCallback(Object callback, Object[] data)... |
| 1304 |
|
{ |
| 1305 |
0 |
Jalview me = jalview; |
| 1306 |
|
|
| 1307 |
0 |
if (me != null && callback != null) |
| 1308 |
|
{ |
| 1309 |
|
|
| 1310 |
|
|
| 1311 |
|
|
| 1312 |
|
|
| 1313 |
|
|
| 1314 |
|
|
| 1315 |
|
|
| 1316 |
|
|
| 1317 |
|
|
| 1318 |
|
|
| 1319 |
|
|
| 1320 |
|
|
| 1321 |
|
|
| 1322 |
|
|
| 1323 |
|
|
| 1324 |
|
} |
| 1325 |
0 |
return ""; |
| 1326 |
|
} |
| 1327 |
|
|
| 1328 |
|
|
| 1329 |
|
|
| 1330 |
|
|
| 1331 |
|
|
| 1332 |
|
|
| 1333 |
|
|
| 1334 |
|
|
| 1335 |
|
|
| 1336 |
|
|
| 1337 |
|
@param |
| 1338 |
|
|
| |
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 3 |
Complexity Density: 0.33 |
|
| 1339 |
0 |
void initFromParams(AlignFrame alf)... |
| 1340 |
|
{ |
| 1341 |
0 |
String sep = getParameter("separator"); |
| 1342 |
0 |
if (sep != null && sep.length() > 0) |
| 1343 |
|
{ |
| 1344 |
0 |
separator = sep; |
| 1345 |
|
} |
| 1346 |
0 |
initTree(alf); |
| 1347 |
0 |
initScoreFile(alf); |
| 1348 |
0 |
initFeatures(alf); |
| 1349 |
0 |
initAnnotations(alf); |
| 1350 |
0 |
initJnetFile(alf); |
| 1351 |
0 |
initPdbFiles(alf); |
| 1352 |
|
} |
| 1353 |
|
|
| 1354 |
|
|
| 1355 |
|
|
| 1356 |
|
|
| 1357 |
|
|
| 1358 |
|
|
| 1359 |
|
@param |
| 1360 |
|
@return |
| 1361 |
|
|
| |
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 3 |
Complexity Density: 0.27 |
|
| 1362 |
0 |
private boolean initAnnotations(AlignFrame alf)... |
| 1363 |
|
{ |
| 1364 |
|
|
| 1365 |
0 |
String param = getParameter("annotations"); |
| 1366 |
0 |
if (param == null) |
| 1367 |
0 |
return false; |
| 1368 |
0 |
ret[0] = param; |
| 1369 |
0 |
DataSourceType protocol = resolveFileProtocol(ret); |
| 1370 |
0 |
param = ret[0]; |
| 1371 |
0 |
if (!new AnnotationFile().annotateAlignmentView(alf.getViewport(), |
| 1372 |
|
param, protocol)) |
| 1373 |
|
{ |
| 1374 |
0 |
System.err.println("Annotations were not added from annotation file '" |
| 1375 |
|
+ param + "'"); |
| 1376 |
0 |
return false; |
| 1377 |
|
} |
| 1378 |
0 |
updateForAnnotations(); |
| 1379 |
0 |
return true; |
| 1380 |
|
} |
| 1381 |
|
|
| 1382 |
|
|
| 1383 |
|
|
| 1384 |
|
|
| 1385 |
|
|
| 1386 |
|
@param |
| 1387 |
|
|
| 1388 |
|
@param |
| 1389 |
|
@return |
| 1390 |
|
|
| |
|
| 0% |
Uncovered Elements: 25 (25) |
Complexity: 7 |
Complexity Density: 0.47 |
|
| 1391 |
0 |
private boolean initFeatures(AlignFrame alf)... |
| 1392 |
|
{ |
| 1393 |
|
|
| 1394 |
|
|
| 1395 |
|
|
| 1396 |
|
|
| 1397 |
|
|
| 1398 |
|
|
| 1399 |
|
|
| 1400 |
|
|
| 1401 |
0 |
String param = getParameter("hidefeaturegroups"); |
| 1402 |
0 |
if (param != null) |
| 1403 |
|
{ |
| 1404 |
0 |
setFeatureGroupState(separatorListToArray(param, separator), |
| 1405 |
|
false, alf); |
| 1406 |
|
|
| 1407 |
|
} |
| 1408 |
|
|
| 1409 |
0 |
param = getParameter("showfeaturegroups"); |
| 1410 |
0 |
if (param != null) |
| 1411 |
|
{ |
| 1412 |
0 |
setFeatureGroupState(separatorListToArray(param, separator), |
| 1413 |
|
true, alf); |
| 1414 |
|
|
| 1415 |
|
} |
| 1416 |
|
|
| 1417 |
0 |
param = getParameter("features"); |
| 1418 |
0 |
if (param == null) |
| 1419 |
|
{ |
| 1420 |
0 |
return false; |
| 1421 |
|
} |
| 1422 |
0 |
if (!parseFeaturesFile(param, alf)) |
| 1423 |
0 |
return false; |
| 1424 |
0 |
param = getParameter("showFeatureSettings"); |
| 1425 |
0 |
if (param != null && param.equalsIgnoreCase("true")) |
| 1426 |
|
{ |
| 1427 |
0 |
alf.showFeatureSettingsUI(); |
| 1428 |
|
} |
| 1429 |
0 |
return true; |
| 1430 |
|
} |
| 1431 |
|
|
| 1432 |
|
|
| 1433 |
|
|
| 1434 |
|
|
| 1435 |
|
|
| 1436 |
|
@param |
| 1437 |
|
@return |
| 1438 |
|
|
| |
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 4 |
Complexity Density: 0.29 |
|
| 1439 |
0 |
private boolean initJnetFile(AlignFrame alf)... |
| 1440 |
|
{ |
| 1441 |
|
|
| 1442 |
0 |
String param = getParameter("jnetfile"); |
| 1443 |
0 |
if (param == null) |
| 1444 |
|
{ |
| 1445 |
|
|
| 1446 |
0 |
param = getParameter("jpredfile"); |
| 1447 |
|
} |
| 1448 |
0 |
if (param != null) |
| 1449 |
|
{ |
| 1450 |
0 |
try |
| 1451 |
|
{ |
| 1452 |
0 |
ret[0] = param; |
| 1453 |
0 |
DataSourceType protocol = resolveFileProtocol(ret); |
| 1454 |
0 |
JPredFile predictions = new JPredFile(ret[0], protocol); |
| 1455 |
0 |
JnetAnnotationMaker.add_annotation(predictions, |
| 1456 |
|
alf.getViewport().getAlignment(), 0, false); |
| 1457 |
|
|
| 1458 |
0 |
alf.getViewport().getAlignment().setupJPredAlignment(); |
| 1459 |
0 |
updateForAnnotations(); |
| 1460 |
|
} catch (Exception ex) |
| 1461 |
|
{ |
| 1462 |
0 |
ex.printStackTrace(); |
| 1463 |
0 |
return false; |
| 1464 |
|
} |
| 1465 |
|
} |
| 1466 |
0 |
return true; |
| 1467 |
|
} |
| 1468 |
|
|
| 1469 |
|
|
| 1470 |
|
|
| 1471 |
|
|
| 1472 |
|
|
| 1473 |
|
@param |
| 1474 |
|
@return |
| 1475 |
|
|
| |
|
| 0% |
Uncovered Elements: 78 (78) |
Complexity: 19 |
Complexity Density: 0.43 |
|
| 1476 |
0 |
private boolean initPdbFiles(AlignFrame alf)... |
| 1477 |
|
{ |
| 1478 |
|
|
| 1479 |
|
|
| 1480 |
|
|
| 1481 |
|
|
| 1482 |
|
|
| 1483 |
|
|
| 1484 |
|
|
| 1485 |
|
|
| 1486 |
|
|
| 1487 |
|
|
| 1488 |
|
|
| 1489 |
|
|
| 1490 |
|
|
| 1491 |
|
|
| 1492 |
|
|
| 1493 |
|
|
| 1494 |
|
|
| 1495 |
|
|
| 1496 |
|
|
| 1497 |
|
|
| 1498 |
|
|
| 1499 |
|
|
| 1500 |
|
|
| 1501 |
0 |
boolean relaxed = "true" |
| 1502 |
|
.equalsIgnoreCase(getParameter("relaxedidmatch")); |
| 1503 |
0 |
jalview.analysis.SequenceIdMatcher matcher = relaxed |
| 1504 |
|
? new jalview.analysis.SequenceIdMatcher( |
| 1505 |
|
alf.getViewport().getAlignment().getSequencesArray()) |
| 1506 |
|
: null; |
| 1507 |
|
|
| 1508 |
0 |
String param = getParameter("PDBFILE"); |
| 1509 |
0 |
int plast = (param == null ? 9 : 1); |
| 1510 |
0 |
if (param == null && (param = getParameter("PDBFILE1")) == null) |
| 1511 |
|
{ |
| 1512 |
0 |
return false; |
| 1513 |
|
} |
| 1514 |
0 |
for (int p = 1; p <= plast; p++) |
| 1515 |
|
{ |
| 1516 |
0 |
if (p > 1) |
| 1517 |
|
{ |
| 1518 |
0 |
param = getParameter("PDBFILE" + p); |
| 1519 |
0 |
if (param == null) |
| 1520 |
0 |
break; |
| 1521 |
|
} |
| 1522 |
0 |
PDBEntry pdb = new PDBEntry(); |
| 1523 |
|
|
| 1524 |
0 |
String seqstring; |
| 1525 |
0 |
SequenceI[] seqs = null; |
| 1526 |
0 |
String[] chains = null; |
| 1527 |
|
|
| 1528 |
0 |
StringTokenizer st = new StringTokenizer(param, " "); |
| 1529 |
|
|
| 1530 |
0 |
if (st.countTokens() < 2) |
| 1531 |
|
{ |
| 1532 |
0 |
String sequence = getParameter("PDBSEQ"); |
| 1533 |
0 |
if (sequence != null) |
| 1534 |
|
{ |
| 1535 |
0 |
seqs = new SequenceI[] { matcher == null |
| 1536 |
|
? (Sequence) alf.getViewport().getAlignment() |
| 1537 |
|
.findName(sequence) |
| 1538 |
|
: matcher.findIdMatch(sequence) }; |
| 1539 |
|
} |
| 1540 |
|
|
| 1541 |
|
} |
| 1542 |
|
else |
| 1543 |
|
{ |
| 1544 |
0 |
param = st.nextToken(); |
| 1545 |
0 |
List<SequenceI> tmp = new ArrayList<>(); |
| 1546 |
0 |
List<String> tmp2 = new ArrayList<>(); |
| 1547 |
|
|
| 1548 |
0 |
while (st.hasMoreTokens()) |
| 1549 |
|
{ |
| 1550 |
0 |
seqstring = st.nextToken(); |
| 1551 |
0 |
StringTokenizer st2 = new StringTokenizer(seqstring, "="); |
| 1552 |
0 |
if (st2.countTokens() > 1) |
| 1553 |
|
{ |
| 1554 |
|
|
| 1555 |
0 |
tmp2.add(st2.nextToken()); |
| 1556 |
0 |
seqstring = st2.nextToken(); |
| 1557 |
|
} |
| 1558 |
0 |
tmp.add(matcher == null |
| 1559 |
|
? (Sequence) alf.getViewport().getAlignment() |
| 1560 |
|
.findName(seqstring) |
| 1561 |
|
: matcher.findIdMatch(seqstring)); |
| 1562 |
|
} |
| 1563 |
|
|
| 1564 |
0 |
seqs = tmp.toArray(new SequenceI[tmp.size()]); |
| 1565 |
0 |
if (tmp2.size() == tmp.size()) |
| 1566 |
|
{ |
| 1567 |
0 |
chains = tmp2.toArray(new String[tmp2.size()]); |
| 1568 |
|
} |
| 1569 |
|
} |
| 1570 |
0 |
pdb.setId(param); |
| 1571 |
0 |
ret[0] = param; |
| 1572 |
0 |
DataSourceType protocol = resolveFileProtocol(ret); |
| 1573 |
|
|
| 1574 |
0 |
pdb.setFile(ret[0]); |
| 1575 |
|
|
| 1576 |
0 |
if (seqs != null) |
| 1577 |
|
{ |
| 1578 |
0 |
for (int i = 0; i < seqs.length; i++) |
| 1579 |
|
{ |
| 1580 |
0 |
if (seqs[i] != null) |
| 1581 |
|
{ |
| 1582 |
0 |
((Sequence) seqs[i]).addPDBId(pdb); |
| 1583 |
0 |
StructureSelectionManager |
| 1584 |
|
.getStructureSelectionManager( |
| 1585 |
|
(StructureSelectionManagerProvider) this) |
| 1586 |
|
.registerPDBEntry(pdb); |
| 1587 |
|
} |
| 1588 |
|
} |
| 1589 |
|
|
| 1590 |
|
|
| 1591 |
|
|
| 1592 |
|
|
| 1593 |
|
|
| 1594 |
|
|
| 1595 |
|
{ |
| 1596 |
0 |
StructureViewer.launchStructureViewer( |
| 1597 |
0 |
(alf == null ? getCurrentAlignFrame() : alf).alignPanel, |
| 1598 |
|
pdb, seqs); |
| 1599 |
|
} |
| 1600 |
|
} |
| 1601 |
|
} |
| 1602 |
|
|
| 1603 |
|
|
| 1604 |
|
|
| 1605 |
|
|
| 1606 |
|
|
| 1607 |
|
|
| 1608 |
|
|
| 1609 |
|
|
| 1610 |
|
|
| 1611 |
|
|
| 1612 |
|
|
| 1613 |
|
|
| 1614 |
|
|
| 1615 |
|
|
| 1616 |
|
|
| 1617 |
|
|
| 1618 |
|
|
| 1619 |
|
|
| 1620 |
|
|
| 1621 |
0 |
return true; |
| 1622 |
|
} |
| 1623 |
|
|
| 1624 |
|
|
| 1625 |
|
|
| 1626 |
|
|
| 1627 |
|
|
| 1628 |
|
@param |
| 1629 |
|
|
| |
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 5 |
Complexity Density: 0.62 |
|
| 1630 |
0 |
private boolean initScoreFile(AlignFrame alf)... |
| 1631 |
|
{ |
| 1632 |
|
|
| 1633 |
0 |
String sScoreFile = getParameter("scoreFile"); |
| 1634 |
0 |
if (sScoreFile != null && !"".equals(sScoreFile)) |
| 1635 |
|
{ |
| 1636 |
0 |
try |
| 1637 |
|
{ |
| 1638 |
0 |
if (loadScoreFile(sScoreFile, alf)) |
| 1639 |
|
{ |
| 1640 |
0 |
return true; |
| 1641 |
|
} |
| 1642 |
0 |
System.err.println( |
| 1643 |
|
"Failed to parse T-COFFEE parameter as a valid score file ('" |
| 1644 |
|
+ sScoreFile + "')"); |
| 1645 |
|
} catch (Exception e) |
| 1646 |
|
{ |
| 1647 |
0 |
System.err.printf("Cannot read score file: '%s'. Cause: %s \n", |
| 1648 |
|
sScoreFile, e.getMessage()); |
| 1649 |
|
} |
| 1650 |
|
} |
| 1651 |
0 |
return false; |
| 1652 |
|
} |
| 1653 |
|
|
| 1654 |
|
|
| 1655 |
|
|
| 1656 |
|
|
| 1657 |
|
|
| 1658 |
|
@return |
| 1659 |
|
|
| |
|
| 0% |
Uncovered Elements: 21 (21) |
Complexity: 6 |
Complexity Density: 0.4 |
|
| 1660 |
0 |
private boolean initTree(AlignFrame alf)... |
| 1661 |
|
{ |
| 1662 |
0 |
String treeFile; |
| 1663 |
0 |
if ((treeFile = getParameter("tree")) == null |
| 1664 |
|
&& (treeFile = getParameter("treefile")) == null) |
| 1665 |
0 |
return false; |
| 1666 |
0 |
if (alf == null) |
| 1667 |
0 |
alf = getCurrentAlignFrame(); |
| 1668 |
0 |
try |
| 1669 |
|
{ |
| 1670 |
0 |
ret[0] = treeFile; |
| 1671 |
0 |
NewickFile nf = new NewickFile(treeFile, resolveFileProtocol(ret)); |
| 1672 |
0 |
nf.parse(); |
| 1673 |
0 |
if (nf.getTree() != null) |
| 1674 |
|
{ |
| 1675 |
0 |
treeFile = ret[0]; |
| 1676 |
0 |
alf.getViewport() |
| 1677 |
|
.setCurrentTree(alf.showNewickTree(nf, treeFile).getTree()); |
| 1678 |
0 |
return true; |
| 1679 |
|
} |
| 1680 |
|
} catch (Exception ex) |
| 1681 |
|
{ |
| 1682 |
0 |
ex.printStackTrace(); |
| 1683 |
|
} |
| 1684 |
0 |
return false; |
| 1685 |
|
} |
| 1686 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1687 |
0 |
private void updateForAnnotations()... |
| 1688 |
|
{ |
| 1689 |
0 |
getCurrentAlignFrame().updateForAnnotations(); |
| 1690 |
|
} |
| 1691 |
|
} |