| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
package jalview.gui; |
| 22 |
|
|
| 23 |
|
import java.awt.BorderLayout; |
| 24 |
|
import java.awt.Color; |
| 25 |
|
import java.awt.Component; |
| 26 |
|
import java.awt.Graphics; |
| 27 |
|
import java.awt.Rectangle; |
| 28 |
|
import java.awt.Toolkit; |
| 29 |
|
import java.awt.datatransfer.Clipboard; |
| 30 |
|
import java.awt.datatransfer.DataFlavor; |
| 31 |
|
import java.awt.datatransfer.StringSelection; |
| 32 |
|
import java.awt.datatransfer.Transferable; |
| 33 |
|
import java.awt.dnd.DnDConstants; |
| 34 |
|
import java.awt.dnd.DropTargetDragEvent; |
| 35 |
|
import java.awt.dnd.DropTargetDropEvent; |
| 36 |
|
import java.awt.dnd.DropTargetEvent; |
| 37 |
|
import java.awt.dnd.DropTargetListener; |
| 38 |
|
import java.awt.event.ActionEvent; |
| 39 |
|
import java.awt.event.ActionListener; |
| 40 |
|
import java.awt.event.FocusAdapter; |
| 41 |
|
import java.awt.event.FocusEvent; |
| 42 |
|
import java.awt.event.ItemEvent; |
| 43 |
|
import java.awt.event.ItemListener; |
| 44 |
|
import java.awt.event.KeyAdapter; |
| 45 |
|
import java.awt.event.KeyEvent; |
| 46 |
|
import java.awt.event.KeyListener; |
| 47 |
|
import java.awt.event.MouseAdapter; |
| 48 |
|
import java.awt.event.MouseEvent; |
| 49 |
|
import java.awt.print.PageFormat; |
| 50 |
|
import java.awt.print.PrinterJob; |
| 51 |
|
import java.beans.PropertyChangeEvent; |
| 52 |
|
import java.io.File; |
| 53 |
|
import java.io.FileWriter; |
| 54 |
|
import java.io.IOException; |
| 55 |
|
import java.io.OutputStreamWriter; |
| 56 |
|
import java.io.PrintWriter; |
| 57 |
|
import java.net.URL; |
| 58 |
|
import java.util.ArrayList; |
| 59 |
|
import java.util.Arrays; |
| 60 |
|
import java.util.Deque; |
| 61 |
|
import java.util.Enumeration; |
| 62 |
|
import java.util.HashMap; |
| 63 |
|
import java.util.Hashtable; |
| 64 |
|
import java.util.List; |
| 65 |
|
import java.util.Locale; |
| 66 |
|
import java.util.Map; |
| 67 |
|
import java.util.Vector; |
| 68 |
|
|
| 69 |
|
import javax.swing.ButtonGroup; |
| 70 |
|
import javax.swing.JCheckBoxMenuItem; |
| 71 |
|
import javax.swing.JComponent; |
| 72 |
|
import javax.swing.JEditorPane; |
| 73 |
|
import javax.swing.JInternalFrame; |
| 74 |
|
import javax.swing.JLabel; |
| 75 |
|
import javax.swing.JLayeredPane; |
| 76 |
|
import javax.swing.JMenu; |
| 77 |
|
import javax.swing.JMenuItem; |
| 78 |
|
import javax.swing.JPanel; |
| 79 |
|
import javax.swing.JProgressBar; |
| 80 |
|
import javax.swing.JRootPane; |
| 81 |
|
import javax.swing.JScrollPane; |
| 82 |
|
import javax.swing.SwingUtilities; |
| 83 |
|
|
| 84 |
|
import ext.vamsas.ServiceHandle; |
| 85 |
|
import jalview.analysis.AlignmentAnnotationUtils; |
| 86 |
|
import jalview.analysis.AlignmentSorter; |
| 87 |
|
import jalview.analysis.AlignmentUtils; |
| 88 |
|
import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder; |
| 89 |
|
import jalview.analysis.CrossRef; |
| 90 |
|
import jalview.analysis.Dna; |
| 91 |
|
import jalview.analysis.GeneticCodeI; |
| 92 |
|
import jalview.analysis.ParseProperties; |
| 93 |
|
import jalview.analysis.SequenceIdMatcher; |
| 94 |
|
import jalview.api.AlignExportSettingsI; |
| 95 |
|
import jalview.api.AlignViewControllerGuiI; |
| 96 |
|
import jalview.api.AlignViewControllerI; |
| 97 |
|
import jalview.api.AlignViewportI; |
| 98 |
|
import jalview.api.AlignmentViewPanel; |
| 99 |
|
import jalview.api.FeatureSettingsControllerI; |
| 100 |
|
import jalview.api.FeatureSettingsModelI; |
| 101 |
|
import jalview.api.SplitContainerI; |
| 102 |
|
import jalview.api.ViewStyleI; |
| 103 |
|
import jalview.api.analysis.SimilarityParamsI; |
| 104 |
|
import jalview.bin.Cache; |
| 105 |
|
import jalview.bin.Console; |
| 106 |
|
import jalview.bin.Jalview; |
| 107 |
|
import jalview.bin.groovy.JalviewObjectI; |
| 108 |
|
import jalview.commands.CommandI; |
| 109 |
|
import jalview.commands.EditCommand; |
| 110 |
|
import jalview.commands.EditCommand.Action; |
| 111 |
|
import jalview.commands.OrderCommand; |
| 112 |
|
import jalview.commands.RemoveGapColCommand; |
| 113 |
|
import jalview.commands.RemoveGapsCommand; |
| 114 |
|
import jalview.commands.SlideSequencesCommand; |
| 115 |
|
import jalview.commands.TrimRegionCommand; |
| 116 |
|
import jalview.datamodel.AlignExportSettingsAdapter; |
| 117 |
|
import jalview.datamodel.AlignedCodonFrame; |
| 118 |
|
import jalview.datamodel.Alignment; |
| 119 |
|
import jalview.datamodel.AlignmentAnnotation; |
| 120 |
|
import jalview.datamodel.AlignmentExportData; |
| 121 |
|
import jalview.datamodel.AlignmentI; |
| 122 |
|
import jalview.datamodel.AlignmentOrder; |
| 123 |
|
import jalview.datamodel.AlignmentView; |
| 124 |
|
import jalview.datamodel.ColumnSelection; |
| 125 |
|
import jalview.datamodel.ContactMatrixI; |
| 126 |
|
import jalview.datamodel.HiddenColumns; |
| 127 |
|
import jalview.datamodel.PDBEntry; |
| 128 |
|
import jalview.datamodel.SeqCigar; |
| 129 |
|
import jalview.datamodel.Sequence; |
| 130 |
|
import jalview.datamodel.SequenceGroup; |
| 131 |
|
import jalview.datamodel.SequenceI; |
| 132 |
|
import jalview.datamodel.annotations.AlphaFoldAnnotationRowBuilder; |
| 133 |
|
import jalview.gui.ColourMenuHelper.ColourChangeListener; |
| 134 |
|
import jalview.gui.ViewSelectionMenu.ViewSetProvider; |
| 135 |
|
import jalview.io.AlignmentProperties; |
| 136 |
|
import jalview.io.AnnotationFile; |
| 137 |
|
import jalview.io.BackupFiles; |
| 138 |
|
import jalview.io.BioJsHTMLOutput; |
| 139 |
|
import jalview.io.DataSourceType; |
| 140 |
|
import jalview.io.FileFormat; |
| 141 |
|
import jalview.io.FileFormatI; |
| 142 |
|
import jalview.io.FileFormats; |
| 143 |
|
import jalview.io.FileLoader; |
| 144 |
|
import jalview.io.FileParse; |
| 145 |
|
import jalview.io.FormatAdapter; |
| 146 |
|
import jalview.io.HtmlSvgOutput; |
| 147 |
|
import jalview.io.IdentifyFile; |
| 148 |
|
import jalview.io.JPredFile; |
| 149 |
|
import jalview.io.JalviewFileChooser; |
| 150 |
|
import jalview.io.JalviewFileView; |
| 151 |
|
import jalview.io.JnetAnnotationMaker; |
| 152 |
|
import jalview.io.NewickFile; |
| 153 |
|
import jalview.io.ScoreMatrixFile; |
| 154 |
|
import jalview.io.TCoffeeScoreFile; |
| 155 |
|
import jalview.io.exceptions.ImageOutputException; |
| 156 |
|
import jalview.io.vcf.VCFLoader; |
| 157 |
|
import jalview.jbgui.GAlignFrame; |
| 158 |
|
import jalview.project.Jalview2XML; |
| 159 |
|
import jalview.schemes.ColourSchemeI; |
| 160 |
|
import jalview.schemes.ColourSchemes; |
| 161 |
|
import jalview.schemes.ResidueColourScheme; |
| 162 |
|
import jalview.schemes.TCoffeeColourScheme; |
| 163 |
|
import jalview.util.Constants; |
| 164 |
|
import jalview.util.HttpUtils; |
| 165 |
|
import jalview.util.ImageMaker.TYPE; |
| 166 |
|
import jalview.util.MessageManager; |
| 167 |
|
import jalview.util.Platform; |
| 168 |
|
import jalview.util.imagemaker.BitmapImageSizing; |
| 169 |
|
import jalview.viewmodel.AlignmentViewport; |
| 170 |
|
import jalview.viewmodel.ViewportRanges; |
| 171 |
|
import jalview.ws.DBRefFetcher; |
| 172 |
|
import jalview.ws.DBRefFetcher.FetchFinishedListenerI; |
| 173 |
|
import jalview.ws.jws1.Discoverer; |
| 174 |
|
import jalview.ws.jws2.Jws2Discoverer; |
| 175 |
|
import jalview.ws.jws2.jabaws2.Jws2Instance; |
| 176 |
|
import jalview.ws.seqfetcher.DbSourceProxy; |
| 177 |
|
|
| 178 |
|
|
| 179 |
|
|
| 180 |
|
|
| 181 |
|
@author |
| 182 |
|
@version |
| 183 |
|
|
| 184 |
|
@SuppressWarnings("serial") |
| |
|
| 33.4% |
Uncovered Elements: 1,969 (2,955) |
Complexity: 768 |
Complexity Density: 0.39 |
|
| 185 |
|
public class AlignFrame extends GAlignFrame implements DropTargetListener, |
| 186 |
|
IProgressIndicator, AlignViewControllerGuiI, ColourChangeListener |
| 187 |
|
{ |
| 188 |
|
|
| 189 |
|
public static final int DEFAULT_WIDTH = 700; |
| 190 |
|
|
| 191 |
|
public static final int DEFAULT_HEIGHT = 500; |
| 192 |
|
|
| 193 |
|
|
| 194 |
|
|
| 195 |
|
|
| 196 |
|
public AlignmentPanel alignPanel; |
| 197 |
|
|
| 198 |
|
AlignViewport viewport; |
| 199 |
|
|
| 200 |
|
public AlignViewControllerI avc; |
| 201 |
|
|
| 202 |
|
List<AlignmentPanel> alignPanels = new ArrayList<>(); |
| 203 |
|
|
| 204 |
|
|
| 205 |
|
|
| 206 |
|
|
| 207 |
|
FileFormatI currentFileFormat = null; |
| 208 |
|
|
| 209 |
|
|
| 210 |
|
|
| 211 |
|
|
| 212 |
|
String fileName = null; |
| 213 |
|
|
| 214 |
|
File fileObject; |
| 215 |
|
|
| 216 |
|
|
| 217 |
|
|
| 218 |
|
|
| 219 |
|
@param |
| 220 |
|
@param |
| 221 |
|
@param |
| 222 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 223 |
376 |
public AlignFrame(AlignmentI al, int width, int height)... |
| 224 |
|
{ |
| 225 |
376 |
this(al, null, width, height); |
| 226 |
|
} |
| 227 |
|
|
| 228 |
|
|
| 229 |
|
|
| 230 |
|
|
| 231 |
|
|
| 232 |
|
@param |
| 233 |
|
@param |
| 234 |
|
@param |
| 235 |
|
@param |
| 236 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 237 |
0 |
public AlignFrame(AlignmentI al, int width, int height,... |
| 238 |
|
String sequenceSetId) |
| 239 |
|
{ |
| 240 |
0 |
this(al, null, width, height, sequenceSetId); |
| 241 |
|
} |
| 242 |
|
|
| 243 |
|
|
| 244 |
|
|
| 245 |
|
|
| 246 |
|
|
| 247 |
|
@param |
| 248 |
|
@param |
| 249 |
|
@param |
| 250 |
|
@param |
| 251 |
|
@param |
| 252 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 253 |
89 |
public AlignFrame(AlignmentI al, int width, int height,... |
| 254 |
|
String sequenceSetId, String viewId) |
| 255 |
|
{ |
| 256 |
89 |
this(al, null, width, height, sequenceSetId, viewId); |
| 257 |
|
} |
| 258 |
|
|
| 259 |
|
|
| 260 |
|
|
| 261 |
|
|
| 262 |
|
@param |
| 263 |
|
|
| 264 |
|
@param |
| 265 |
|
|
| 266 |
|
@param |
| 267 |
|
|
| 268 |
|
@param |
| 269 |
|
|
| 270 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 271 |
376 |
public AlignFrame(AlignmentI al, HiddenColumns hiddenColumns, int width,... |
| 272 |
|
int height) |
| 273 |
|
{ |
| 274 |
376 |
this(al, hiddenColumns, width, height, null); |
| 275 |
|
} |
| 276 |
|
|
| 277 |
|
|
| 278 |
|
|
| 279 |
|
|
| 280 |
|
|
| 281 |
|
@param |
| 282 |
|
@param |
| 283 |
|
@param |
| 284 |
|
@param |
| 285 |
|
@param |
| 286 |
|
|
| 287 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 288 |
376 |
public AlignFrame(AlignmentI al, HiddenColumns hiddenColumns, int width,... |
| 289 |
|
int height, String sequenceSetId) |
| 290 |
|
{ |
| 291 |
376 |
this(al, hiddenColumns, width, height, sequenceSetId, null); |
| 292 |
|
} |
| 293 |
|
|
| 294 |
|
|
| 295 |
|
|
| 296 |
|
|
| 297 |
|
|
| 298 |
|
@param |
| 299 |
|
@param |
| 300 |
|
@param |
| 301 |
|
@param |
| 302 |
|
@param |
| 303 |
|
|
| 304 |
|
@param |
| 305 |
|
|
| 306 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
| 307 |
465 |
public AlignFrame(AlignmentI al, HiddenColumns hiddenColumns, int width,... |
| 308 |
|
int height, String sequenceSetId, String viewId) |
| 309 |
|
{ |
| 310 |
465 |
setSize(width, height); |
| 311 |
|
|
| 312 |
465 |
if (al.getDataset() == null) |
| 313 |
|
{ |
| 314 |
361 |
al.setDataset(null); |
| 315 |
|
} |
| 316 |
|
|
| 317 |
465 |
viewport = new AlignViewport(al, hiddenColumns, sequenceSetId, viewId); |
| 318 |
|
|
| 319 |
465 |
alignPanel = new AlignmentPanel(this, viewport); |
| 320 |
|
|
| 321 |
465 |
addAlignmentPanel(alignPanel, true); |
| 322 |
465 |
init(); |
| 323 |
|
} |
| 324 |
|
|
| |
|
| 84.6% |
Uncovered Elements: 2 (13) |
Complexity: 4 |
Complexity Density: 0.44 |
|
| 325 |
5 |
public AlignFrame(AlignmentI al, SequenceI[] hiddenSeqs,... |
| 326 |
|
HiddenColumns hiddenColumns, int width, int height) |
| 327 |
|
{ |
| 328 |
5 |
setSize(width, height); |
| 329 |
|
|
| 330 |
5 |
if (al.getDataset() == null) |
| 331 |
|
{ |
| 332 |
5 |
al.setDataset(null); |
| 333 |
|
} |
| 334 |
|
|
| 335 |
5 |
viewport = new AlignViewport(al, hiddenColumns); |
| 336 |
|
|
| 337 |
5 |
if (hiddenSeqs != null && hiddenSeqs.length > 0) |
| 338 |
|
{ |
| 339 |
5 |
viewport.hideSequence(hiddenSeqs); |
| 340 |
|
} |
| 341 |
5 |
alignPanel = new AlignmentPanel(this, viewport); |
| 342 |
5 |
addAlignmentPanel(alignPanel, true); |
| 343 |
5 |
init(); |
| 344 |
|
} |
| 345 |
|
|
| 346 |
|
|
| 347 |
|
|
| 348 |
|
|
| 349 |
|
@param |
| 350 |
|
|
| 351 |
|
@param |
| 352 |
|
|
| 353 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 354 |
5 |
public AlignFrame(AlignmentPanel ap)... |
| 355 |
|
{ |
| 356 |
5 |
viewport = ap.av; |
| 357 |
5 |
alignPanel = ap; |
| 358 |
5 |
addAlignmentPanel(ap, false); |
| 359 |
5 |
init(); |
| 360 |
|
} |
| 361 |
|
|
| 362 |
|
|
| 363 |
|
|
| 364 |
|
|
| 365 |
|
|
| |
|
| 88.5% |
Uncovered Elements: 6 (52) |
Complexity: 11 |
Complexity Density: 0.32 |
|
| 366 |
475 |
void init()... |
| 367 |
|
{ |
| 368 |
475 |
setFrameIcon(null); |
| 369 |
|
|
| 370 |
|
|
| 371 |
|
|
| 372 |
475 |
if (!Jalview.isHeadlessMode()) |
| 373 |
|
{ |
| 374 |
412 |
progressBar = new ProgressBar(this.statusPanel, this.statusBar); |
| 375 |
|
} |
| 376 |
|
|
| 377 |
|
|
| 378 |
475 |
avc = new jalview.controller.AlignViewController(this, viewport, |
| 379 |
|
alignPanel); |
| 380 |
475 |
if (viewport.getAlignmentConservationAnnotation() == null) |
| 381 |
|
{ |
| 382 |
|
|
| 383 |
82 |
conservationMenuItem.setEnabled(false); |
| 384 |
82 |
modifyConservation.setEnabled(false); |
| 385 |
|
|
| 386 |
|
|
| 387 |
|
|
| 388 |
|
} |
| 389 |
|
|
| 390 |
475 |
String sortby = Cache.getDefault("SORT_ALIGNMENT", "No sort"); |
| 391 |
|
|
| 392 |
475 |
if (sortby.equals("Id")) |
| 393 |
|
{ |
| 394 |
0 |
sortIDMenuItem_actionPerformed(null); |
| 395 |
|
} |
| 396 |
475 |
else if (sortby.equals("Pairwise Identity")) |
| 397 |
|
{ |
| 398 |
0 |
sortPairwiseMenuItem_actionPerformed(null); |
| 399 |
|
} |
| 400 |
|
|
| 401 |
475 |
this.alignPanel.av |
| 402 |
|
.setShowAutocalculatedAbove(isShowAutoCalculatedAbove()); |
| 403 |
|
|
| 404 |
475 |
setMenusFromViewport(viewport); |
| 405 |
475 |
buildSortByAnnotationScoresMenu(); |
| 406 |
475 |
calculateTree.addActionListener(new ActionListener() |
| 407 |
|
{ |
| 408 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 409 |
0 |
@Override... |
| 410 |
|
public void actionPerformed(ActionEvent e) |
| 411 |
|
{ |
| 412 |
0 |
openTreePcaDialog(); |
| 413 |
|
} |
| 414 |
|
}); |
| 415 |
475 |
buildColourMenu(); |
| 416 |
|
|
| 417 |
475 |
if (Desktop.desktop != null) |
| 418 |
|
{ |
| 419 |
420 |
this.setDropTarget(new java.awt.dnd.DropTarget(this, this)); |
| 420 |
420 |
if (!Platform.isJS()) |
| 421 |
|
{ |
| 422 |
420 |
addServiceListeners(); |
| 423 |
|
} |
| 424 |
420 |
setGUINucleotide(); |
| 425 |
|
} |
| 426 |
|
|
| 427 |
475 |
if (viewport.getWrapAlignment()) |
| 428 |
|
{ |
| 429 |
7 |
wrapMenuItem_actionPerformed(null); |
| 430 |
|
} |
| 431 |
|
|
| 432 |
475 |
if (Cache.getDefault("SHOW_OVERVIEW", false)) |
| 433 |
|
{ |
| 434 |
28 |
this.overviewMenuItem_actionPerformed(null); |
| 435 |
|
} |
| 436 |
|
|
| 437 |
475 |
addKeyListener(); |
| 438 |
|
|
| 439 |
475 |
final List<AlignmentViewPanel> selviews = new ArrayList<>(); |
| 440 |
475 |
final List<AlignmentPanel> origview = new ArrayList<>(); |
| 441 |
475 |
final String menuLabel = MessageManager |
| 442 |
|
.getString("label.copy_format_from"); |
| 443 |
475 |
ViewSelectionMenu vsel = new ViewSelectionMenu(menuLabel, |
| 444 |
|
new ViewSetProvider() |
| 445 |
|
{ |
| 446 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
| 447 |
0 |
@Override... |
| 448 |
|
public AlignmentPanel[] getAllAlignmentPanels() |
| 449 |
|
{ |
| 450 |
0 |
origview.clear(); |
| 451 |
0 |
origview.add(alignPanel); |
| 452 |
|
|
| 453 |
0 |
List<AlignmentPanel> aps = new ArrayList<>( |
| 454 |
|
Arrays.asList(Desktop.getAlignmentPanels(null))); |
| 455 |
0 |
aps.remove(AlignFrame.this.alignPanel); |
| 456 |
0 |
return aps.toArray(new AlignmentPanel[aps.size()]); |
| 457 |
|
} |
| 458 |
|
}, selviews, new ItemListener() |
| 459 |
|
{ |
| 460 |
|
|
| |
|
| 0% |
Uncovered Elements: 21 (21) |
Complexity: 5 |
Complexity Density: 0.33 |
|
| 461 |
0 |
@Override... |
| 462 |
|
public void itemStateChanged(ItemEvent e) |
| 463 |
|
{ |
| 464 |
0 |
if (origview.size() > 0) |
| 465 |
|
{ |
| 466 |
0 |
final AlignmentPanel ap = origview.get(0); |
| 467 |
|
|
| 468 |
|
|
| 469 |
|
|
| 470 |
|
|
| 471 |
|
|
| 472 |
0 |
ViewStyleI vs = selviews.get(0).getAlignViewport() |
| 473 |
|
.getViewStyle(); |
| 474 |
0 |
boolean fromSplitFrame = selviews.get(0) |
| 475 |
|
.getAlignViewport().getCodingComplement() != null; |
| 476 |
0 |
if (!fromSplitFrame) |
| 477 |
|
{ |
| 478 |
0 |
vs.setScaleProteinAsCdna(ap.getAlignViewport() |
| 479 |
|
.getViewStyle().isScaleProteinAsCdna()); |
| 480 |
|
} |
| 481 |
0 |
ap.getAlignViewport().setViewStyle(vs); |
| 482 |
|
|
| 483 |
|
|
| 484 |
|
|
| 485 |
|
|
| 486 |
|
|
| 487 |
|
|
| 488 |
0 |
AlignViewportI complement = ap.getAlignViewport() |
| 489 |
|
.getCodingComplement(); |
| 490 |
0 |
if (complement != null && vs.isScaleProteinAsCdna()) |
| 491 |
|
{ |
| 492 |
0 |
AlignFrame af = Desktop.getAlignFrameFor(complement); |
| 493 |
0 |
((SplitFrame) af.getSplitViewContainer()) |
| 494 |
|
.adjustLayout(); |
| 495 |
0 |
af.setMenusForViewport(); |
| 496 |
|
} |
| 497 |
|
|
| 498 |
0 |
ap.updateLayout(); |
| 499 |
0 |
ap.setSelected(true); |
| 500 |
0 |
ap.alignFrame.setMenusForViewport(); |
| 501 |
|
|
| 502 |
|
} |
| 503 |
|
} |
| 504 |
|
}); |
| 505 |
475 |
if (Cache.getDefault("VERSION", "DEVELOPMENT").toLowerCase(Locale.ROOT) |
| 506 |
|
.indexOf("devel") > -1 |
| 507 |
|
|| Cache.getDefault("VERSION", "DEVELOPMENT") |
| 508 |
|
.toLowerCase(Locale.ROOT).indexOf("test") > -1) |
| 509 |
|
{ |
| 510 |
475 |
formatMenu.add(vsel); |
| 511 |
|
} |
| 512 |
475 |
addFocusListener(new FocusAdapter() |
| 513 |
|
{ |
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 514 |
385 |
@Override... |
| 515 |
|
public void focusGained(FocusEvent e) |
| 516 |
|
{ |
| 517 |
385 |
Jalview.getInstance().setCurrentAlignFrame(AlignFrame.this); |
| 518 |
|
} |
| 519 |
|
}); |
| 520 |
|
|
| 521 |
|
} |
| 522 |
|
|
| 523 |
|
|
| 524 |
|
|
| 525 |
|
|
| 526 |
|
|
| 527 |
|
@param |
| 528 |
|
|
| 529 |
|
@param |
| 530 |
|
|
| 531 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 532 |
343 |
public void setFileName(String file, FileFormatI format)... |
| 533 |
|
{ |
| 534 |
343 |
fileName = file; |
| 535 |
343 |
setFileFormat(format); |
| 536 |
343 |
reload.setEnabled(true); |
| 537 |
|
} |
| 538 |
|
|
| 539 |
|
|
| 540 |
|
|
| 541 |
|
|
| 542 |
|
|
| 543 |
|
@param |
| 544 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 545 |
254 |
public void setFileObject(File file)... |
| 546 |
|
{ |
| 547 |
254 |
this.fileObject = file; |
| 548 |
|
} |
| 549 |
|
|
| 550 |
|
|
| 551 |
|
|
| 552 |
|
|
| 553 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 554 |
475 |
void addKeyListener()... |
| 555 |
|
{ |
| 556 |
475 |
addKeyListener(new KeyAdapter() |
| 557 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 128 (128) |
Complexity: 50 |
Complexity Density: 0.53 |
|
| 558 |
0 |
@Override... |
| 559 |
|
public void keyPressed(KeyEvent evt) |
| 560 |
|
{ |
| 561 |
0 |
if (viewport.cursorMode |
| 562 |
|
&& ((evt.getKeyCode() >= KeyEvent.VK_0 |
| 563 |
|
&& evt.getKeyCode() <= KeyEvent.VK_9) |
| 564 |
|
|| (evt.getKeyCode() >= KeyEvent.VK_NUMPAD0 |
| 565 |
|
&& evt.getKeyCode() <= KeyEvent.VK_NUMPAD9)) |
| 566 |
|
&& Character.isDigit(evt.getKeyChar())) |
| 567 |
|
{ |
| 568 |
0 |
alignPanel.getSeqPanel().numberPressed(evt.getKeyChar()); |
| 569 |
|
} |
| 570 |
|
|
| 571 |
0 |
switch (evt.getKeyCode()) |
| 572 |
|
{ |
| 573 |
|
|
| 574 |
0 |
case 27: |
| 575 |
0 |
deselectAllSequenceMenuItem_actionPerformed(null); |
| 576 |
|
|
| 577 |
0 |
break; |
| 578 |
|
|
| 579 |
0 |
case KeyEvent.VK_DOWN: |
| 580 |
0 |
if (evt.isAltDown() || !viewport.cursorMode) |
| 581 |
|
{ |
| 582 |
0 |
moveSelectedSequences(false); |
| 583 |
|
} |
| 584 |
0 |
if (viewport.cursorMode) |
| 585 |
|
{ |
| 586 |
0 |
alignPanel.getSeqPanel().moveCursor(0, 1, evt.isShiftDown()); |
| 587 |
|
} |
| 588 |
0 |
break; |
| 589 |
|
|
| 590 |
0 |
case KeyEvent.VK_UP: |
| 591 |
0 |
if (evt.isAltDown() || !viewport.cursorMode) |
| 592 |
|
{ |
| 593 |
0 |
moveSelectedSequences(true); |
| 594 |
|
} |
| 595 |
0 |
if (viewport.cursorMode) |
| 596 |
|
{ |
| 597 |
0 |
alignPanel.getSeqPanel().moveCursor(0, -1, evt.isShiftDown()); |
| 598 |
|
} |
| 599 |
|
|
| 600 |
0 |
break; |
| 601 |
|
|
| 602 |
0 |
case KeyEvent.VK_LEFT: |
| 603 |
0 |
if (evt.isAltDown() || !viewport.cursorMode) |
| 604 |
|
{ |
| 605 |
0 |
slideSequences(false, |
| 606 |
|
alignPanel.getSeqPanel().getKeyboardNo1()); |
| 607 |
|
} |
| 608 |
|
else |
| 609 |
|
{ |
| 610 |
0 |
alignPanel.getSeqPanel().moveCursor(-1, 0, evt.isShiftDown()); |
| 611 |
|
} |
| 612 |
|
|
| 613 |
0 |
break; |
| 614 |
|
|
| 615 |
0 |
case KeyEvent.VK_RIGHT: |
| 616 |
0 |
if (evt.isAltDown() || !viewport.cursorMode) |
| 617 |
|
{ |
| 618 |
0 |
slideSequences(true, alignPanel.getSeqPanel().getKeyboardNo1()); |
| 619 |
|
} |
| 620 |
|
else |
| 621 |
|
{ |
| 622 |
0 |
alignPanel.getSeqPanel().moveCursor(1, 0, evt.isShiftDown()); |
| 623 |
|
} |
| 624 |
0 |
break; |
| 625 |
|
|
| 626 |
0 |
case KeyEvent.VK_SPACE: |
| 627 |
0 |
if (viewport.cursorMode) |
| 628 |
|
{ |
| 629 |
0 |
alignPanel.getSeqPanel().insertGapAtCursor(evt.isControlDown() |
| 630 |
|
|| evt.isShiftDown() || evt.isAltDown()); |
| 631 |
|
} |
| 632 |
0 |
break; |
| 633 |
|
|
| 634 |
|
|
| 635 |
|
|
| 636 |
|
|
| 637 |
|
|
| 638 |
|
|
| 639 |
|
|
| 640 |
|
|
| 641 |
|
|
| 642 |
|
|
| 643 |
|
|
| 644 |
|
|
| 645 |
0 |
case KeyEvent.VK_DELETE: |
| 646 |
0 |
case KeyEvent.VK_BACK_SPACE: |
| 647 |
0 |
if (!viewport.cursorMode) |
| 648 |
|
{ |
| 649 |
0 |
cut_actionPerformed(); |
| 650 |
|
} |
| 651 |
|
else |
| 652 |
|
{ |
| 653 |
0 |
alignPanel.getSeqPanel().deleteGapAtCursor(evt.isControlDown() |
| 654 |
|
|| evt.isShiftDown() || evt.isAltDown()); |
| 655 |
|
} |
| 656 |
|
|
| 657 |
0 |
break; |
| 658 |
|
|
| 659 |
0 |
case KeyEvent.VK_S: |
| 660 |
0 |
if (viewport.cursorMode) |
| 661 |
|
{ |
| 662 |
0 |
alignPanel.getSeqPanel().setCursorRow(); |
| 663 |
|
} |
| 664 |
0 |
break; |
| 665 |
0 |
case KeyEvent.VK_C: |
| 666 |
0 |
if (viewport.cursorMode && !evt.isControlDown()) |
| 667 |
|
{ |
| 668 |
0 |
alignPanel.getSeqPanel().setCursorColumn(); |
| 669 |
|
} |
| 670 |
0 |
break; |
| 671 |
0 |
case KeyEvent.VK_P: |
| 672 |
0 |
if (viewport.cursorMode) |
| 673 |
|
{ |
| 674 |
0 |
alignPanel.getSeqPanel().setCursorPosition(); |
| 675 |
|
} |
| 676 |
0 |
break; |
| 677 |
|
|
| 678 |
0 |
case KeyEvent.VK_ENTER: |
| 679 |
0 |
case KeyEvent.VK_COMMA: |
| 680 |
0 |
if (viewport.cursorMode) |
| 681 |
|
{ |
| 682 |
0 |
alignPanel.getSeqPanel().setCursorRowAndColumn(); |
| 683 |
|
} |
| 684 |
0 |
break; |
| 685 |
|
|
| 686 |
0 |
case KeyEvent.VK_Q: |
| 687 |
0 |
if (viewport.cursorMode) |
| 688 |
|
{ |
| 689 |
0 |
alignPanel.getSeqPanel().setSelectionAreaAtCursor(true); |
| 690 |
|
} |
| 691 |
0 |
break; |
| 692 |
0 |
case KeyEvent.VK_M: |
| 693 |
0 |
if (viewport.cursorMode) |
| 694 |
|
{ |
| 695 |
0 |
alignPanel.getSeqPanel().setSelectionAreaAtCursor(false); |
| 696 |
|
} |
| 697 |
0 |
break; |
| 698 |
|
|
| 699 |
0 |
case KeyEvent.VK_F2: |
| 700 |
0 |
viewport.cursorMode = !viewport.cursorMode; |
| 701 |
0 |
setStatus(MessageManager |
| 702 |
|
.formatMessage("label.keyboard_editing_mode", new String[] |
| 703 |
0 |
{ (viewport.cursorMode ? "on" : "off") })); |
| 704 |
0 |
if (viewport.cursorMode) |
| 705 |
|
{ |
| 706 |
0 |
ViewportRanges ranges = viewport.getRanges(); |
| 707 |
0 |
alignPanel.getSeqPanel().seqCanvas.cursorX = ranges |
| 708 |
|
.getStartRes(); |
| 709 |
0 |
alignPanel.getSeqPanel().seqCanvas.cursorY = ranges |
| 710 |
|
.getStartSeq(); |
| 711 |
|
} |
| 712 |
0 |
alignPanel.getSeqPanel().seqCanvas.repaint(); |
| 713 |
0 |
break; |
| 714 |
|
|
| 715 |
0 |
case KeyEvent.VK_F1: |
| 716 |
0 |
try |
| 717 |
|
{ |
| 718 |
0 |
Help.showHelpWindow(); |
| 719 |
|
} catch (Exception ex) |
| 720 |
|
{ |
| 721 |
0 |
ex.printStackTrace(); |
| 722 |
|
} |
| 723 |
0 |
break; |
| 724 |
0 |
case KeyEvent.VK_H: |
| 725 |
|
{ |
| 726 |
0 |
boolean toggleSeqs = !evt.isControlDown(); |
| 727 |
0 |
boolean toggleCols = !evt.isShiftDown(); |
| 728 |
0 |
toggleHiddenRegions(toggleSeqs, toggleCols); |
| 729 |
0 |
break; |
| 730 |
|
} |
| 731 |
0 |
case KeyEvent.VK_B: |
| 732 |
|
{ |
| 733 |
0 |
boolean toggleSel = evt.isControlDown() || evt.isMetaDown(); |
| 734 |
0 |
boolean modifyExisting = true; |
| 735 |
|
|
| 736 |
0 |
boolean invertHighlighted = evt.isAltDown(); |
| 737 |
0 |
avc.markHighlightedColumns(invertHighlighted, modifyExisting, |
| 738 |
|
toggleSel); |
| 739 |
0 |
break; |
| 740 |
|
} |
| 741 |
0 |
case KeyEvent.VK_PAGE_UP: |
| 742 |
0 |
viewport.getRanges().pageUp(); |
| 743 |
0 |
break; |
| 744 |
0 |
case KeyEvent.VK_PAGE_DOWN: |
| 745 |
0 |
viewport.getRanges().pageDown(); |
| 746 |
0 |
break; |
| 747 |
|
} |
| 748 |
|
} |
| 749 |
|
|
| |
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 7 |
Complexity Density: 0.78 |
|
| 750 |
0 |
@Override... |
| 751 |
|
public void keyReleased(KeyEvent evt) |
| 752 |
|
{ |
| 753 |
0 |
switch (evt.getKeyCode()) |
| 754 |
|
{ |
| 755 |
0 |
case KeyEvent.VK_LEFT: |
| 756 |
0 |
if (evt.isAltDown() || !viewport.cursorMode) |
| 757 |
|
{ |
| 758 |
0 |
viewport.firePropertyChange("alignment", null, |
| 759 |
|
viewport.getAlignment().getSequences()); |
| 760 |
|
} |
| 761 |
0 |
break; |
| 762 |
|
|
| 763 |
0 |
case KeyEvent.VK_RIGHT: |
| 764 |
0 |
if (evt.isAltDown() || !viewport.cursorMode) |
| 765 |
|
{ |
| 766 |
0 |
viewport.firePropertyChange("alignment", null, |
| 767 |
|
viewport.getAlignment().getSequences()); |
| 768 |
|
} |
| 769 |
0 |
break; |
| 770 |
|
} |
| 771 |
|
} |
| 772 |
|
}); |
| 773 |
|
} |
| 774 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (29) |
Complexity: 6 |
Complexity Density: 0.29 |
|
| 775 |
524 |
public void addAlignmentPanel(final AlignmentPanel ap, boolean newPanel)... |
| 776 |
|
{ |
| 777 |
524 |
ap.alignFrame = this; |
| 778 |
524 |
avc = new jalview.controller.AlignViewController(this, viewport, |
| 779 |
|
alignPanel); |
| 780 |
|
|
| 781 |
524 |
alignPanels.add(ap); |
| 782 |
|
|
| 783 |
524 |
PaintRefresher.Register(ap, ap.av.getSequenceSetId()); |
| 784 |
|
|
| 785 |
524 |
int aSize = alignPanels.size(); |
| 786 |
|
|
| 787 |
524 |
tabbedPane.setVisible(aSize > 1 || ap.av.getViewName() != null); |
| 788 |
|
|
| 789 |
524 |
if (aSize == 1 && ap.av.getViewName() == null) |
| 790 |
|
{ |
| 791 |
470 |
this.getContentPane().add(ap, BorderLayout.CENTER); |
| 792 |
|
} |
| 793 |
|
else |
| 794 |
|
{ |
| 795 |
54 |
if (aSize == 2) |
| 796 |
|
{ |
| 797 |
23 |
setInitialTabVisible(); |
| 798 |
|
} |
| 799 |
|
|
| 800 |
54 |
expandViews.setEnabled(true); |
| 801 |
54 |
gatherViews.setEnabled(true); |
| 802 |
54 |
tabbedPane.addTab(ap.av.getViewName(), ap); |
| 803 |
|
|
| 804 |
54 |
ap.setVisible(false); |
| 805 |
|
} |
| 806 |
|
|
| 807 |
524 |
if (newPanel) |
| 808 |
|
{ |
| 809 |
480 |
if (ap.av.isPadGaps()) |
| 810 |
|
{ |
| 811 |
189 |
ap.av.getAlignment().padGaps(); |
| 812 |
|
} |
| 813 |
480 |
ap.av.updateConservation(ap); |
| 814 |
480 |
ap.av.updateConsensus(ap); |
| 815 |
480 |
ap.av.updateSecondaryStructureConsensus(ap); |
| 816 |
480 |
ap.av.updateStrucConsensus(ap); |
| 817 |
|
} |
| 818 |
|
} |
| 819 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
| 820 |
82 |
public void setInitialTabVisible()... |
| 821 |
|
{ |
| 822 |
82 |
expandViews.setEnabled(true); |
| 823 |
82 |
gatherViews.setEnabled(true); |
| 824 |
82 |
tabbedPane.setVisible(true); |
| 825 |
82 |
AlignmentPanel first = alignPanels.get(0); |
| 826 |
82 |
tabbedPane.addTab(first.av.getViewName(), first); |
| 827 |
82 |
this.getContentPane().add(tabbedPane, BorderLayout.CENTER); |
| 828 |
|
} |
| 829 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 830 |
3923 |
public AlignViewport getViewport()... |
| 831 |
|
{ |
| 832 |
3923 |
return viewport; |
| 833 |
|
} |
| 834 |
|
|
| 835 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 836 |
420 |
private void addServiceListeners()... |
| 837 |
|
{ |
| 838 |
420 |
final java.beans.PropertyChangeListener thisListener; |
| 839 |
420 |
Desktop.instance.addJalviewPropertyChangeListener("services", |
| 840 |
|
thisListener = new java.beans.PropertyChangeListener() |
| 841 |
|
{ |
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 842 |
2617 |
@Override... |
| 843 |
|
public void propertyChange(PropertyChangeEvent evt) |
| 844 |
|
{ |
| 845 |
|
|
| 846 |
|
|
| 847 |
|
|
| 848 |
|
{ |
| 849 |
2617 |
SwingUtilities.invokeLater(new Runnable() |
| 850 |
|
{ |
| 851 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 852 |
2617 |
@Override... |
| 853 |
|
public void run() |
| 854 |
|
{ |
| 855 |
2617 |
jalview.bin.Console.errPrintln( |
| 856 |
|
"Rebuild WS Menu for service change"); |
| 857 |
2617 |
BuildWebServiceMenu(); |
| 858 |
|
} |
| 859 |
|
|
| 860 |
|
}); |
| 861 |
|
} |
| 862 |
|
} |
| 863 |
|
}); |
| 864 |
420 |
addInternalFrameListener(new javax.swing.event.InternalFrameAdapter() |
| 865 |
|
{ |
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 866 |
277 |
@Override... |
| 867 |
|
public void internalFrameClosed( |
| 868 |
|
javax.swing.event.InternalFrameEvent evt) |
| 869 |
|
{ |
| 870 |
|
|
| 871 |
277 |
Desktop.instance.removeJalviewPropertyChangeListener("services", |
| 872 |
|
thisListener); |
| 873 |
277 |
closeMenuItem_actionPerformed(true); |
| 874 |
|
} |
| 875 |
|
}); |
| 876 |
|
|
| 877 |
420 |
new Thread(new Runnable() |
| 878 |
|
{ |
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 879 |
420 |
@Override... |
| 880 |
|
public void run() |
| 881 |
|
{ |
| 882 |
420 |
BuildWebServiceMenu(); |
| 883 |
|
} |
| 884 |
|
}).start(); |
| 885 |
|
} |
| 886 |
|
|
| 887 |
|
|
| 888 |
|
|
| 889 |
|
|
| 890 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 2 |
Complexity Density: 0.17 |
|
| 891 |
420 |
public void setGUINucleotide()... |
| 892 |
|
{ |
| 893 |
420 |
AlignmentI al = getViewport().getAlignment(); |
| 894 |
420 |
boolean nucleotide = al.isNucleotide(); |
| 895 |
|
|
| 896 |
420 |
loadVcf.setVisible(nucleotide); |
| 897 |
420 |
showTranslation.setVisible(nucleotide); |
| 898 |
420 |
showReverse.setVisible(nucleotide); |
| 899 |
420 |
showReverseComplement.setVisible(nucleotide); |
| 900 |
420 |
conservationMenuItem.setEnabled(!nucleotide); |
| 901 |
420 |
modifyConservation |
| 902 |
|
.setEnabled(!nucleotide && conservationMenuItem.isSelected()); |
| 903 |
420 |
byConsensusSecondaryStructureMenuItem.setEnabled(!nucleotide); |
| 904 |
420 |
modifyConsensusSecondaryStructureThreshold.setEnabled(!nucleotide |
| 905 |
|
&& byConsensusSecondaryStructureMenuItem.isSelected()); |
| 906 |
420 |
showGroupConservation.setEnabled(!nucleotide); |
| 907 |
|
|
| 908 |
420 |
showComplementMenuItem |
| 909 |
420 |
.setText(nucleotide ? MessageManager.getString("label.protein") |
| 910 |
|
: MessageManager.getString("label.nucleotide")); |
| 911 |
|
} |
| 912 |
|
|
| 913 |
|
|
| 914 |
|
|
| 915 |
|
|
| 916 |
|
|
| 917 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 918 |
34 |
@Override... |
| 919 |
|
public void setMenusForViewport() |
| 920 |
|
{ |
| 921 |
34 |
setMenusFromViewport(viewport); |
| 922 |
|
} |
| 923 |
|
|
| 924 |
|
|
| 925 |
|
|
| 926 |
|
|
| 927 |
|
|
| 928 |
|
@param |
| 929 |
|
|
| 930 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (43) |
Complexity: 1 |
Complexity Density: 0.02 |
|
| 931 |
703 |
public void setMenusFromViewport(AlignViewport av)... |
| 932 |
|
{ |
| 933 |
703 |
padGapsMenuitem.setSelected(av.isPadGaps()); |
| 934 |
703 |
colourTextMenuItem.setSelected(av.isShowColourText()); |
| 935 |
703 |
abovePIDThreshold.setSelected(av.getAbovePIDThreshold()); |
| 936 |
703 |
modifyPID.setEnabled(abovePIDThreshold.isSelected()); |
| 937 |
703 |
conservationMenuItem.setSelected(av.getConservationSelected()); |
| 938 |
703 |
modifyConservation.setEnabled(conservationMenuItem.isSelected()); |
| 939 |
703 |
byConsensusSecondaryStructureMenuItem |
| 940 |
|
.setSelected(av.getByConsensusSecondaryStructureSelected()); |
| 941 |
703 |
modifyConsensusSecondaryStructureThreshold |
| 942 |
|
.setEnabled(byConsensusSecondaryStructureMenuItem.isSelected()); |
| 943 |
703 |
seqLimits.setSelected(av.getShowJVSuffix()); |
| 944 |
703 |
idRightAlign.setSelected(av.isRightAlignIds()); |
| 945 |
703 |
centreColumnLabelsMenuItem.setState(av.isCentreColumnLabels()); |
| 946 |
703 |
renderGapsMenuItem.setSelected(av.isRenderGaps()); |
| 947 |
703 |
wrapMenuItem.setSelected(av.getWrapAlignment()); |
| 948 |
703 |
scaleAbove.setVisible(av.getWrapAlignment()); |
| 949 |
703 |
scaleLeft.setVisible(av.getWrapAlignment()); |
| 950 |
703 |
scaleRight.setVisible(av.getWrapAlignment()); |
| 951 |
703 |
annotationPanelMenuItem.setState(av.isShowAnnotation()); |
| 952 |
|
|
| 953 |
|
|
| 954 |
|
|
| 955 |
703 |
showAllSeqAnnotations.setEnabled(annotationPanelMenuItem.getState()); |
| 956 |
703 |
hideAllSeqAnnotations.setEnabled(annotationPanelMenuItem.getState()); |
| 957 |
703 |
showAllAlAnnotations.setEnabled(annotationPanelMenuItem.getState()); |
| 958 |
703 |
hideAllAlAnnotations.setEnabled(annotationPanelMenuItem.getState()); |
| 959 |
703 |
viewBoxesMenuItem.setSelected(av.getShowBoxes()); |
| 960 |
703 |
viewTextMenuItem.setSelected(av.getShowText()); |
| 961 |
703 |
showNonconservedMenuItem.setSelected(av.getShowUnconserved()); |
| 962 |
703 |
showGroupConsensus.setSelected(av.isShowGroupConsensus()); |
| 963 |
703 |
showGroupSSConsensus.setSelected(av.isShowGroupSSConsensus()); |
| 964 |
703 |
showStrucProvider.setSelected(av.isShowStructureProvider()); |
| 965 |
703 |
showGroupConservation.setSelected(av.isShowGroupConservation()); |
| 966 |
703 |
showConsensusHistogram.setSelected(av.isShowConsensusHistogram()); |
| 967 |
703 |
showSequenceLogo.setSelected(av.isShowSequenceLogo()); |
| 968 |
703 |
normaliseSequenceLogo.setSelected(av.isNormaliseSequenceLogo()); |
| 969 |
|
|
| 970 |
703 |
ColourMenuHelper.setColourSelected(colourMenu, |
| 971 |
|
av.getGlobalColourScheme()); |
| 972 |
|
|
| 973 |
703 |
showSeqFeatures.setSelected(av.isShowSequenceFeatures()); |
| 974 |
703 |
hiddenMarkers.setState(av.getShowHiddenMarkers()); |
| 975 |
703 |
applyToAllGroups.setState(av.getColourAppliesToAllGroups()); |
| 976 |
703 |
showNpFeatsMenuitem.setSelected(av.isShowNPFeats()); |
| 977 |
703 |
showDbRefsMenuitem.setSelected(av.isShowDBRefs()); |
| 978 |
703 |
autoCalculate.setSelected(av.autoCalculateConsensus); |
| 979 |
703 |
sortByTree.setSelected(av.sortByTree); |
| 980 |
703 |
listenToViewSelections.setSelected(av.followSelection); |
| 981 |
|
|
| 982 |
703 |
showProducts.setEnabled(canShowProducts()); |
| 983 |
703 |
setGroovyEnabled(Desktop.getGroovyConsole() != null); |
| 984 |
|
|
| 985 |
703 |
updateEditMenuBar(); |
| 986 |
|
} |
| 987 |
|
|
| 988 |
|
|
| 989 |
|
|
| 990 |
|
|
| 991 |
|
@param |
| 992 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 993 |
703 |
public void setGroovyEnabled(boolean b)... |
| 994 |
|
{ |
| 995 |
703 |
runGroovy.setEnabled(b); |
| 996 |
|
} |
| 997 |
|
|
| 998 |
|
private IProgressIndicator progressBar; |
| 999 |
|
|
| 1000 |
|
|
| 1001 |
|
|
| 1002 |
|
|
| 1003 |
|
@see |
| 1004 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 3 |
Complexity Density: 1.5 |
|
| 1005 |
941 |
@Override... |
| 1006 |
|
public void setProgressBar(String message, long id) |
| 1007 |
|
{ |
| 1008 |
941 |
if (!Platform.isHeadless() && progressBar != null) |
| 1009 |
579 |
progressBar.setProgressBar(message, id); |
| 1010 |
|
} |
| 1011 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 1012 |
0 |
@Override... |
| 1013 |
|
public JProgressBar getProgressBar(long id) |
| 1014 |
|
{ |
| 1015 |
0 |
if (progressBar != null) |
| 1016 |
0 |
return progressBar.getProgressBar(id); |
| 1017 |
0 |
return null; |
| 1018 |
|
} |
| 1019 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1020 |
0 |
@Override... |
| 1021 |
|
public String getMessage(long id) |
| 1022 |
|
{ |
| 1023 |
0 |
return progressBar.getMessage(id); |
| 1024 |
|
} |
| 1025 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1026 |
0 |
@Override... |
| 1027 |
|
public void setProgressBarMessage(long id, String message) |
| 1028 |
|
{ |
| 1029 |
0 |
progressBar.setProgressBarMessage(id, message); |
| 1030 |
|
} |
| 1031 |
|
|
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
| 1032 |
0 |
@Override... |
| 1033 |
|
public void registerHandler(final long id, |
| 1034 |
|
final IProgressIndicatorHandler handler) |
| 1035 |
|
{ |
| 1036 |
0 |
if (progressBar != null) |
| 1037 |
0 |
progressBar.registerHandler(id, handler); |
| 1038 |
|
} |
| 1039 |
|
|
| 1040 |
|
|
| 1041 |
|
|
| 1042 |
|
@return |
| 1043 |
|
|
| |
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
| 1044 |
38 |
@Override... |
| 1045 |
|
public boolean operationInProgress() |
| 1046 |
|
{ |
| 1047 |
38 |
return progressBar == null ? false : progressBar.operationInProgress(); |
| 1048 |
|
} |
| 1049 |
|
|
| 1050 |
|
|
| 1051 |
|
|
| 1052 |
|
|
| 1053 |
|
|
| 1054 |
|
|
| |
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 3 |
Complexity Density: 3 |
|
| 1055 |
413 |
@Override... |
| 1056 |
|
public void setStatus(String text) |
| 1057 |
|
{ |
| 1058 |
413 |
statusBar.setText(text == null || text.isEmpty() ? " " : text); |
| 1059 |
|
} |
| 1060 |
|
|
| 1061 |
|
|
| 1062 |
|
|
| 1063 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1064 |
0 |
public String getVersion()... |
| 1065 |
|
{ |
| 1066 |
0 |
return Cache.getProperty("VERSION"); |
| 1067 |
|
} |
| 1068 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1069 |
53 |
public FeatureRenderer getFeatureRenderer()... |
| 1070 |
|
{ |
| 1071 |
53 |
return alignPanel.getSeqPanel().seqCanvas.getFeatureRenderer(); |
| 1072 |
|
} |
| 1073 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1074 |
0 |
@Override... |
| 1075 |
|
public void fetchSequence_actionPerformed() |
| 1076 |
|
{ |
| 1077 |
0 |
new SequenceFetcher(this); |
| 1078 |
|
} |
| 1079 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1080 |
0 |
@Override... |
| 1081 |
|
public void addFromFile_actionPerformed(ActionEvent e) |
| 1082 |
|
{ |
| 1083 |
0 |
Desktop.instance.inputLocalFileMenuItem_actionPerformed(viewport); |
| 1084 |
|
} |
| 1085 |
|
|
| |
|
| 0% |
Uncovered Elements: 44 (44) |
Complexity: 14 |
Complexity Density: 0.5 |
|
| 1086 |
0 |
@Override... |
| 1087 |
|
public void reload_actionPerformed(ActionEvent e) |
| 1088 |
|
{ |
| 1089 |
0 |
if (fileName != null) |
| 1090 |
|
{ |
| 1091 |
|
|
| 1092 |
|
|
| 1093 |
|
|
| 1094 |
|
|
| 1095 |
0 |
if (FileFormat.Jalview.equals(currentFileFormat)) |
| 1096 |
|
{ |
| 1097 |
0 |
JInternalFrame[] frames = Desktop.desktop.getAllFrames(); |
| 1098 |
0 |
for (int i = 0; i < frames.length; i++) |
| 1099 |
|
{ |
| 1100 |
0 |
if (frames[i] instanceof AlignFrame && frames[i] != this |
| 1101 |
|
&& ((AlignFrame) frames[i]).fileName != null |
| 1102 |
|
&& ((AlignFrame) frames[i]).fileName.equals(fileName)) |
| 1103 |
|
{ |
| 1104 |
0 |
try |
| 1105 |
|
{ |
| 1106 |
0 |
frames[i].setSelected(true); |
| 1107 |
0 |
Desktop.instance.closeAssociatedWindows(); |
| 1108 |
|
} catch (java.beans.PropertyVetoException ex) |
| 1109 |
|
{ |
| 1110 |
|
} |
| 1111 |
|
} |
| 1112 |
|
|
| 1113 |
|
} |
| 1114 |
0 |
Desktop.instance.closeAssociatedWindows(); |
| 1115 |
|
|
| 1116 |
0 |
FileLoader loader = new FileLoader(); |
| 1117 |
0 |
DataSourceType protocol = HttpUtils.startsWithHttpOrHttps(fileName) |
| 1118 |
|
? DataSourceType.URL |
| 1119 |
|
: DataSourceType.FILE; |
| 1120 |
0 |
loader.LoadFile(viewport, fileName, protocol, currentFileFormat); |
| 1121 |
|
} |
| 1122 |
|
else |
| 1123 |
|
{ |
| 1124 |
0 |
Rectangle bounds = this.getBounds(); |
| 1125 |
|
|
| 1126 |
0 |
FileLoader loader = new FileLoader(); |
| 1127 |
|
|
| 1128 |
0 |
AlignFrame newframe = null; |
| 1129 |
|
|
| 1130 |
0 |
if (fileObject == null) |
| 1131 |
|
{ |
| 1132 |
|
|
| 1133 |
0 |
DataSourceType protocol = HttpUtils.startsWithHttpOrHttps( |
| 1134 |
|
fileName) ? DataSourceType.URL : DataSourceType.FILE; |
| 1135 |
0 |
newframe = loader.LoadFileWaitTillLoaded(fileName, protocol, |
| 1136 |
|
currentFileFormat); |
| 1137 |
|
} |
| 1138 |
|
else |
| 1139 |
|
{ |
| 1140 |
0 |
newframe = loader.LoadFileWaitTillLoaded(fileObject, |
| 1141 |
|
DataSourceType.FILE, currentFileFormat); |
| 1142 |
|
} |
| 1143 |
|
|
| 1144 |
0 |
newframe.setBounds(bounds); |
| 1145 |
0 |
if (featureSettings != null && featureSettings.isShowing()) |
| 1146 |
|
{ |
| 1147 |
0 |
final Rectangle fspos = featureSettings.frame.getBounds(); |
| 1148 |
|
|
| 1149 |
|
|
| 1150 |
0 |
newframe.featureSettings_actionPerformed(null); |
| 1151 |
0 |
final FeatureSettings nfs = newframe.featureSettings; |
| 1152 |
0 |
SwingUtilities.invokeLater(new Runnable() |
| 1153 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1154 |
0 |
@Override... |
| 1155 |
|
public void run() |
| 1156 |
|
{ |
| 1157 |
0 |
nfs.frame.setBounds(fspos); |
| 1158 |
|
} |
| 1159 |
|
}); |
| 1160 |
0 |
this.featureSettings.close(); |
| 1161 |
0 |
this.featureSettings = null; |
| 1162 |
|
} |
| 1163 |
0 |
this.closeMenuItem_actionPerformed(true); |
| 1164 |
|
} |
| 1165 |
|
} |
| 1166 |
|
} |
| 1167 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1168 |
0 |
@Override... |
| 1169 |
|
public void addFromText_actionPerformed(ActionEvent e) |
| 1170 |
|
{ |
| 1171 |
0 |
Desktop.instance |
| 1172 |
|
.inputTextboxMenuItem_actionPerformed(viewport.getAlignPanel()); |
| 1173 |
|
} |
| 1174 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1175 |
0 |
@Override... |
| 1176 |
|
public void addFromURL_actionPerformed(ActionEvent e) |
| 1177 |
|
{ |
| 1178 |
0 |
Desktop.instance.inputURLMenuItem_actionPerformed(viewport); |
| 1179 |
|
} |
| 1180 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 4 |
Complexity Density: 1.33 |
|
| 1181 |
0 |
@Override... |
| 1182 |
|
public void save_actionPerformed(ActionEvent e) |
| 1183 |
|
{ |
| 1184 |
0 |
if (fileName == null || (currentFileFormat == null) |
| 1185 |
|
|| HttpUtils.startsWithHttpOrHttps(fileName)) |
| 1186 |
|
{ |
| 1187 |
0 |
saveAs_actionPerformed(); |
| 1188 |
|
} |
| 1189 |
|
else |
| 1190 |
|
{ |
| 1191 |
0 |
saveAlignment(fileName, currentFileFormat); |
| 1192 |
|
} |
| 1193 |
|
} |
| 1194 |
|
|
| 1195 |
|
|
| 1196 |
|
|
| 1197 |
|
|
| 1198 |
|
|
| |
|
| 0% |
Uncovered Elements: 26 (26) |
Complexity: 5 |
Complexity Density: 0.28 |
|
| 1199 |
0 |
@Override... |
| 1200 |
|
public void saveAs_actionPerformed() |
| 1201 |
|
{ |
| 1202 |
0 |
JalviewFileChooser chooser = JalviewFileChooser.forWrite( |
| 1203 |
|
Cache.getProperty("LAST_DIRECTORY"), |
| 1204 |
0 |
currentFileFormat == null ? null : currentFileFormat.getName(), |
| 1205 |
|
true); |
| 1206 |
|
|
| 1207 |
0 |
chooser.setFileView(new JalviewFileView()); |
| 1208 |
0 |
chooser.setDialogTitle( |
| 1209 |
|
MessageManager.getString("label.save_alignment_to_file")); |
| 1210 |
0 |
chooser.setToolTipText(MessageManager.getString("action.save")); |
| 1211 |
|
|
| 1212 |
0 |
int value = chooser.showSaveDialog(this); |
| 1213 |
|
|
| 1214 |
0 |
if (value != JalviewFileChooser.APPROVE_OPTION) |
| 1215 |
|
{ |
| 1216 |
0 |
return; |
| 1217 |
|
} |
| 1218 |
0 |
currentFileFormat = chooser.getSelectedFormat(); |
| 1219 |
0 |
while (currentFileFormat == null) |
| 1220 |
|
{ |
| 1221 |
|
|
| 1222 |
0 |
JvOptionPane.showInternalMessageDialog(Desktop.desktop, |
| 1223 |
|
MessageManager |
| 1224 |
|
.getString("label.select_file_format_before_saving"), |
| 1225 |
|
MessageManager.getString("label.file_format_not_specified"), |
| 1226 |
|
JvOptionPane.WARNING_MESSAGE); |
| 1227 |
0 |
value = chooser.showSaveDialog(this); |
| 1228 |
0 |
if (value != JalviewFileChooser.APPROVE_OPTION) |
| 1229 |
|
{ |
| 1230 |
0 |
return; |
| 1231 |
|
} |
| 1232 |
0 |
currentFileFormat = chooser.getSelectedFormat(); |
| 1233 |
|
} |
| 1234 |
|
|
| 1235 |
0 |
fileName = chooser.getSelectedFile().getPath(); |
| 1236 |
|
|
| 1237 |
0 |
Cache.setProperty("DEFAULT_FILE_FORMAT", currentFileFormat.getName()); |
| 1238 |
0 |
Cache.setProperty("LAST_DIRECTORY", fileName); |
| 1239 |
0 |
saveAlignment(fileName, currentFileFormat); |
| 1240 |
|
} |
| 1241 |
|
|
| 1242 |
|
boolean lastSaveSuccessful = false; |
| 1243 |
|
|
| 1244 |
|
FileFormatI lastFormatSaved; |
| 1245 |
|
|
| 1246 |
|
String lastFilenameSaved; |
| 1247 |
|
|
| 1248 |
|
|
| 1249 |
|
|
| 1250 |
|
private static FileFormatI globalLastFormatSaved = null; |
| 1251 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1252 |
28 |
public static void setLastAlignmentSavedFormat(FileFormatI f)... |
| 1253 |
|
{ |
| 1254 |
28 |
globalLastFormatSaved = f; |
| 1255 |
|
} |
| 1256 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1257 |
6 |
public static FileFormatI getLastAlignmentSavedFormat()... |
| 1258 |
|
{ |
| 1259 |
6 |
return globalLastFormatSaved; |
| 1260 |
|
} |
| 1261 |
|
|
| 1262 |
|
|
| 1263 |
|
|
| 1264 |
|
|
| 1265 |
|
@return |
| 1266 |
|
|
| |
|
| 40% |
Uncovered Elements: 6 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
| 1267 |
88 |
public boolean isSaveAlignmentSuccessful()... |
| 1268 |
|
{ |
| 1269 |
|
|
| 1270 |
88 |
if (!lastSaveSuccessful) |
| 1271 |
|
{ |
| 1272 |
0 |
if (!Platform.isHeadless()) |
| 1273 |
|
{ |
| 1274 |
0 |
JvOptionPane.showInternalMessageDialog(this, MessageManager |
| 1275 |
|
.formatMessage("label.couldnt_save_file", new Object[] |
| 1276 |
|
{ lastFilenameSaved }), |
| 1277 |
|
MessageManager.getString("label.error_saving_file"), |
| 1278 |
|
JvOptionPane.WARNING_MESSAGE); |
| 1279 |
|
} |
| 1280 |
|
else |
| 1281 |
|
{ |
| 1282 |
0 |
Console.error(MessageManager |
| 1283 |
|
.formatMessage("label.couldnt_save_file", new Object[] |
| 1284 |
|
{ lastFilenameSaved })); |
| 1285 |
|
} |
| 1286 |
|
} |
| 1287 |
|
else |
| 1288 |
|
{ |
| 1289 |
|
|
| 1290 |
88 |
setStatus(MessageManager.formatMessage( |
| 1291 |
|
"label.successfully_saved_to_file_in_format", new Object[] |
| 1292 |
|
{ lastFilenameSaved, lastFormatSaved })); |
| 1293 |
|
|
| 1294 |
|
} |
| 1295 |
88 |
return lastSaveSuccessful; |
| 1296 |
|
} |
| 1297 |
|
|
| 1298 |
|
|
| 1299 |
|
|
| 1300 |
|
|
| 1301 |
|
|
| 1302 |
|
|
| 1303 |
|
|
| 1304 |
|
|
| 1305 |
|
@param |
| 1306 |
|
@param |
| 1307 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1308 |
54 |
public void saveAlignment(String file, FileFormatI format)... |
| 1309 |
|
{ |
| 1310 |
54 |
saveAlignment(file, format, false, false); |
| 1311 |
|
} |
| 1312 |
|
|
| |
|
| 79.8% |
Uncovered Elements: 21 (104) |
Complexity: 21 |
Complexity Density: 0.3 |
|
| 1313 |
128 |
public void saveAlignment(String file, FileFormatI format, boolean stdout,... |
| 1314 |
|
boolean forceBackup) |
| 1315 |
|
{ |
| 1316 |
128 |
lastSaveSuccessful = true; |
| 1317 |
128 |
if (!stdout) |
| 1318 |
|
{ |
| 1319 |
116 |
lastFilenameSaved = file; |
| 1320 |
|
} |
| 1321 |
128 |
lastFormatSaved = format; |
| 1322 |
128 |
globalLastFormatSaved = format; |
| 1323 |
|
|
| 1324 |
128 |
if (FileFormat.Jalview.equals(format)) |
| 1325 |
|
{ |
| 1326 |
8 |
String shortName = title; |
| 1327 |
8 |
if (shortName.indexOf(File.separatorChar) > -1) |
| 1328 |
|
{ |
| 1329 |
5 |
shortName = shortName |
| 1330 |
|
.substring(shortName.lastIndexOf(File.separatorChar) + 1); |
| 1331 |
|
} |
| 1332 |
|
|
| 1333 |
8 |
lastSaveSuccessful = new Jalview2XML().saveAlignment(this, file, |
| 1334 |
|
shortName); |
| 1335 |
|
|
| 1336 |
8 |
Console.debug("lastSaveSuccessful=" + lastSaveSuccessful); |
| 1337 |
8 |
if (lastSaveSuccessful) |
| 1338 |
|
{ |
| 1339 |
8 |
this.getViewport().setSavedUpToDate(true); |
| 1340 |
|
} |
| 1341 |
|
|
| 1342 |
8 |
statusBar.setText(MessageManager.formatMessage( |
| 1343 |
|
"label.successfully_saved_to_file_in_format", new Object[] |
| 1344 |
|
{ file, format })); |
| 1345 |
|
|
| 1346 |
8 |
return; |
| 1347 |
|
} |
| 1348 |
|
|
| 1349 |
120 |
AlignExportSettingsI options = new AlignExportSettingsAdapter(false); |
| 1350 |
120 |
Runnable cancelAction = () -> { |
| 1351 |
0 |
lastSaveSuccessful = false; |
| 1352 |
|
}; |
| 1353 |
120 |
Runnable outputAction = () -> { |
| 1354 |
|
|
| 1355 |
120 |
AlignmentExportData exportData = viewport.getAlignExportData(options); |
| 1356 |
120 |
String output = new FormatAdapter(alignPanel, options) |
| 1357 |
|
.formatSequences(format, exportData.getAlignment(), |
| 1358 |
|
exportData.getOmitHidden(), |
| 1359 |
|
exportData.getStartEndPostions(), |
| 1360 |
|
viewport.getAlignment().getHiddenColumns()); |
| 1361 |
120 |
if (output == null) |
| 1362 |
|
{ |
| 1363 |
0 |
lastSaveSuccessful = false; |
| 1364 |
|
} |
| 1365 |
|
else |
| 1366 |
|
{ |
| 1367 |
|
|
| 1368 |
120 |
boolean doBackup = forceBackup |
| 1369 |
|
|| (BackupFiles.getEnabled() && !stdout); |
| 1370 |
120 |
BackupFiles backupfiles = null; |
| 1371 |
120 |
if (doBackup) |
| 1372 |
|
{ |
| 1373 |
92 |
Console.trace("ALIGNFRAME making backupfiles object for " + file); |
| 1374 |
92 |
backupfiles = new BackupFiles(file); |
| 1375 |
|
} |
| 1376 |
120 |
try |
| 1377 |
|
{ |
| 1378 |
120 |
String tempFilePath = doBackup ? backupfiles.getTempFilePath() |
| 1379 |
|
: file; |
| 1380 |
120 |
Console.trace("ALIGNFRAME setting PrintWriter"); |
| 1381 |
120 |
PrintWriter out = stdout |
| 1382 |
|
? new PrintWriter(new OutputStreamWriter(System.out)) |
| 1383 |
|
: new PrintWriter(new FileWriter(tempFilePath)); |
| 1384 |
|
|
| 1385 |
120 |
if (backupfiles != null) |
| 1386 |
|
{ |
| 1387 |
92 |
Console.trace("ALIGNFRAME about to write to temp file " |
| 1388 |
|
+ backupfiles.getTempFilePath()); |
| 1389 |
|
} |
| 1390 |
|
|
| 1391 |
120 |
out.print(output); |
| 1392 |
120 |
out.flush(); |
| 1393 |
120 |
if (!stdout) |
| 1394 |
|
{ |
| 1395 |
108 |
Console.trace("ALIGNFRAME about to close file"); |
| 1396 |
108 |
out.close(); |
| 1397 |
108 |
Console.trace("ALIGNFRAME closed file"); |
| 1398 |
|
} |
| 1399 |
120 |
AlignFrame.this.setTitle(stdout ? "STDOUT" : file); |
| 1400 |
120 |
if (stdout) |
| 1401 |
|
{ |
| 1402 |
12 |
statusBar.setText(MessageManager.formatMessage( |
| 1403 |
|
"label.successfully_printed_to_stdout_in_format", |
| 1404 |
|
new Object[] |
| 1405 |
|
{ format.getName() })); |
| 1406 |
|
} |
| 1407 |
|
else |
| 1408 |
|
{ |
| 1409 |
108 |
statusBar.setText(MessageManager.formatMessage( |
| 1410 |
|
"label.successfully_saved_to_file_in_format", |
| 1411 |
|
new Object[] |
| 1412 |
|
{ fileName, format.getName() })); |
| 1413 |
|
} |
| 1414 |
120 |
lastSaveSuccessful = true; |
| 1415 |
|
} catch (IOException e) |
| 1416 |
|
{ |
| 1417 |
0 |
lastSaveSuccessful = false; |
| 1418 |
0 |
Console.error( |
| 1419 |
|
"ALIGNFRAME Something happened writing the temp file"); |
| 1420 |
0 |
Console.error(e.getMessage()); |
| 1421 |
0 |
Console.debug(Cache.getStackTraceString(e)); |
| 1422 |
|
} catch (Exception ex) |
| 1423 |
|
{ |
| 1424 |
0 |
lastSaveSuccessful = false; |
| 1425 |
0 |
Console.error( |
| 1426 |
|
"ALIGNFRAME Something unexpected happened writing the temp file"); |
| 1427 |
0 |
Console.error(ex.getMessage()); |
| 1428 |
0 |
Console.debug(Cache.getStackTraceString(ex)); |
| 1429 |
|
} |
| 1430 |
|
|
| 1431 |
120 |
if (doBackup) |
| 1432 |
|
{ |
| 1433 |
92 |
backupfiles.setWriteSuccess(lastSaveSuccessful); |
| 1434 |
92 |
Console.debug("ALIGNFRAME writing temp file was " |
| 1435 |
92 |
+ (lastSaveSuccessful ? "" : "NOT ") + "successful"); |
| 1436 |
|
|
| 1437 |
92 |
Console.trace("ALIGNFRAME about to rollBackupsAndRenameTempFile"); |
| 1438 |
92 |
lastSaveSuccessful = backupfiles.rollBackupsAndRenameTempFile(); |
| 1439 |
92 |
Console.debug("ALIGNFRAME performed rollBackupsAndRenameTempFile " |
| 1440 |
92 |
+ (lastSaveSuccessful ? "" : "un") + "successfully"); |
| 1441 |
|
} |
| 1442 |
|
|
| 1443 |
120 |
Console.debug("lastSaveSuccessful=" + lastSaveSuccessful); |
| 1444 |
120 |
if (lastSaveSuccessful) |
| 1445 |
|
{ |
| 1446 |
120 |
AlignFrame.this.getViewport().setSavedUpToDate(true); |
| 1447 |
|
} |
| 1448 |
|
} |
| 1449 |
|
}; |
| 1450 |
|
|
| 1451 |
|
|
| 1452 |
|
|
| 1453 |
|
|
| 1454 |
120 |
if (AlignExportOptions.isNeeded(viewport, format)) |
| 1455 |
|
{ |
| 1456 |
0 |
AlignExportOptions choices = new AlignExportOptions( |
| 1457 |
|
alignPanel.getAlignViewport(), format, options); |
| 1458 |
0 |
choices.setResponseAction(0, outputAction); |
| 1459 |
0 |
choices.setResponseAction(1, cancelAction); |
| 1460 |
0 |
choices.showDialog(); |
| 1461 |
|
} |
| 1462 |
|
else |
| 1463 |
|
{ |
| 1464 |
120 |
try |
| 1465 |
|
{ |
| 1466 |
120 |
outputAction.run(); |
| 1467 |
|
} catch (Exception e) |
| 1468 |
|
{ |
| 1469 |
|
|
| 1470 |
0 |
e.printStackTrace(); |
| 1471 |
|
} |
| 1472 |
|
} |
| 1473 |
|
} |
| 1474 |
|
|
| 1475 |
|
|
| 1476 |
|
|
| 1477 |
|
|
| 1478 |
|
|
| 1479 |
|
|
| 1480 |
|
@param |
| 1481 |
|
|
| |
|
| 0% |
Uncovered Elements: 21 (21) |
Complexity: 4 |
Complexity Density: 0.21 |
|
| 1482 |
0 |
@Override... |
| 1483 |
|
protected void outputText_actionPerformed(String fileFormatName) |
| 1484 |
|
{ |
| 1485 |
0 |
FileFormatI fileFormat = FileFormats.getInstance() |
| 1486 |
|
.forName(fileFormatName); |
| 1487 |
0 |
AlignExportSettingsI options = new AlignExportSettingsAdapter(false); |
| 1488 |
0 |
Runnable outputAction = () -> { |
| 1489 |
|
|
| 1490 |
0 |
AlignmentExportData exportData = viewport.getAlignExportData(options); |
| 1491 |
0 |
CutAndPasteTransfer cap = new CutAndPasteTransfer(); |
| 1492 |
0 |
cap.setForInput(null); |
| 1493 |
0 |
try |
| 1494 |
|
{ |
| 1495 |
0 |
FileFormatI format = fileFormat; |
| 1496 |
0 |
cap.setText(new FormatAdapter(alignPanel, options).formatSequences( |
| 1497 |
|
format, exportData.getAlignment(), |
| 1498 |
|
exportData.getOmitHidden(), |
| 1499 |
|
exportData.getStartEndPostions(), |
| 1500 |
|
viewport.getAlignment().getHiddenColumns())); |
| 1501 |
0 |
Desktop.addInternalFrame(cap, MessageManager.formatMessage( |
| 1502 |
|
"label.alignment_output_command", new Object[] |
| 1503 |
|
{ fileFormat.getName() }), 600, 500); |
| 1504 |
|
} catch (OutOfMemoryError oom) |
| 1505 |
|
{ |
| 1506 |
0 |
new OOMWarning("Outputting alignment as " + fileFormat.getName(), |
| 1507 |
|
oom); |
| 1508 |
0 |
cap.dispose(); |
| 1509 |
|
} |
| 1510 |
|
}; |
| 1511 |
|
|
| 1512 |
|
|
| 1513 |
|
|
| 1514 |
|
|
| 1515 |
0 |
if (AlignExportOptions.isNeeded(viewport, fileFormat)) |
| 1516 |
|
{ |
| 1517 |
0 |
AlignExportOptions choices = new AlignExportOptions( |
| 1518 |
|
alignPanel.getAlignViewport(), fileFormat, options); |
| 1519 |
0 |
choices.setResponseAction(0, outputAction); |
| 1520 |
0 |
choices.showDialog(); |
| 1521 |
|
} |
| 1522 |
|
else |
| 1523 |
|
{ |
| 1524 |
0 |
try |
| 1525 |
|
{ |
| 1526 |
0 |
outputAction.run(); |
| 1527 |
|
} catch (Exception e) |
| 1528 |
|
{ |
| 1529 |
0 |
e.printStackTrace(); |
| 1530 |
|
} |
| 1531 |
|
} |
| 1532 |
|
} |
| 1533 |
|
|
| 1534 |
|
|
| 1535 |
|
|
| 1536 |
|
|
| 1537 |
|
@param |
| 1538 |
|
|
| 1539 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 1540 |
0 |
@Override... |
| 1541 |
|
protected void htmlMenuItem_actionPerformed(ActionEvent e) |
| 1542 |
|
{ |
| 1543 |
0 |
HtmlSvgOutput htmlSVG = new HtmlSvgOutput(alignPanel); |
| 1544 |
0 |
try |
| 1545 |
|
{ |
| 1546 |
0 |
htmlSVG.exportHTML(null); |
| 1547 |
|
} catch (ImageOutputException x) |
| 1548 |
|
{ |
| 1549 |
|
|
| 1550 |
|
} |
| 1551 |
|
} |
| 1552 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 1553 |
0 |
@Override... |
| 1554 |
|
public void bioJSMenuItem_actionPerformed(ActionEvent e) |
| 1555 |
|
{ |
| 1556 |
0 |
BioJsHTMLOutput bjs = new BioJsHTMLOutput(alignPanel); |
| 1557 |
0 |
try |
| 1558 |
|
{ |
| 1559 |
0 |
bjs.exportHTML(null); |
| 1560 |
|
} catch (ImageOutputException x) |
| 1561 |
|
{ |
| 1562 |
|
|
| 1563 |
|
} |
| 1564 |
|
} |
| 1565 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 2 |
Complexity Density: 1 |
|
| 1566 |
0 |
public void createImageMap(File file, String image)... |
| 1567 |
|
{ |
| 1568 |
0 |
try |
| 1569 |
|
{ |
| 1570 |
0 |
alignPanel.makePNGImageMap(file, image); |
| 1571 |
|
} catch (ImageOutputException x) |
| 1572 |
|
{ |
| 1573 |
|
|
| 1574 |
|
} |
| 1575 |
|
} |
| 1576 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 2 |
Complexity Density: 1 |
|
| 1577 |
0 |
@Override... |
| 1578 |
|
public void createPNG_actionPerformed(ActionEvent e) |
| 1579 |
|
{ |
| 1580 |
0 |
try |
| 1581 |
|
{ |
| 1582 |
0 |
createPNG(null); |
| 1583 |
|
} catch (ImageOutputException ioex) |
| 1584 |
|
{ |
| 1585 |
|
|
| 1586 |
|
} |
| 1587 |
|
} |
| 1588 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 2 |
Complexity Density: 1 |
|
| 1589 |
0 |
@Override... |
| 1590 |
|
public void createEPS_actionPerformed(ActionEvent e) |
| 1591 |
|
{ |
| 1592 |
0 |
try |
| 1593 |
|
{ |
| 1594 |
0 |
createEPS(null); |
| 1595 |
|
} catch (ImageOutputException ioex) |
| 1596 |
|
{ |
| 1597 |
|
|
| 1598 |
|
} |
| 1599 |
|
|
| 1600 |
|
} |
| 1601 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 2 |
Complexity Density: 1 |
|
| 1602 |
0 |
@Override... |
| 1603 |
|
public void createSVG_actionPerformed(ActionEvent e) |
| 1604 |
|
{ |
| 1605 |
0 |
try |
| 1606 |
|
{ |
| 1607 |
0 |
createSVG(null); |
| 1608 |
|
} catch (ImageOutputException ioex) |
| 1609 |
|
{ |
| 1610 |
|
|
| 1611 |
|
} |
| 1612 |
|
|
| 1613 |
|
} |
| 1614 |
|
|
| 1615 |
|
|
| 1616 |
|
|
| 1617 |
|
|
| 1618 |
|
|
| 1619 |
|
@param |
| 1620 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1621 |
1 |
public void createPNG(File f) throws ImageOutputException... |
| 1622 |
|
{ |
| 1623 |
1 |
createPNG(f, null, BitmapImageSizing.defaultBitmapImageSizing()); |
| 1624 |
|
} |
| 1625 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1626 |
24 |
public void createPNG(File f, String renderer, BitmapImageSizing userBis)... |
| 1627 |
|
throws ImageOutputException |
| 1628 |
|
{ |
| 1629 |
24 |
alignPanel.makeAlignmentImage(TYPE.PNG, f, renderer, userBis); |
| 1630 |
|
} |
| 1631 |
|
|
| 1632 |
|
|
| 1633 |
|
|
| 1634 |
|
|
| 1635 |
|
|
| 1636 |
|
@param |
| 1637 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1638 |
5 |
public void createEPS(File f) throws ImageOutputException... |
| 1639 |
|
{ |
| 1640 |
5 |
createEPS(f, null); |
| 1641 |
|
} |
| 1642 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1643 |
10 |
public void createEPS(File f, String renderer) throws ImageOutputException... |
| 1644 |
|
{ |
| 1645 |
10 |
alignPanel.makeAlignmentImage(TYPE.EPS, f, renderer); |
| 1646 |
|
} |
| 1647 |
|
|
| 1648 |
|
|
| 1649 |
|
|
| 1650 |
|
|
| 1651 |
|
|
| 1652 |
|
@param |
| 1653 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1654 |
1 |
public void createSVG(File f) throws ImageOutputException... |
| 1655 |
|
{ |
| 1656 |
1 |
createSVG(f, null); |
| 1657 |
|
} |
| 1658 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1659 |
2 |
public void createSVG(File f, String renderer) throws ImageOutputException... |
| 1660 |
|
{ |
| 1661 |
2 |
alignPanel.makeAlignmentImage(TYPE.SVG, f, renderer); |
| 1662 |
|
} |
| 1663 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 1664 |
0 |
@Override... |
| 1665 |
|
public void pageSetup_actionPerformed(ActionEvent e) |
| 1666 |
|
{ |
| 1667 |
0 |
PrinterJob printJob = PrinterJob.getPrinterJob(); |
| 1668 |
0 |
PrintThread.pf = printJob.pageDialog(printJob.defaultPage()); |
| 1669 |
|
} |
| 1670 |
|
|
| 1671 |
|
|
| 1672 |
|
|
| 1673 |
|
|
| 1674 |
|
@param |
| 1675 |
|
|
| 1676 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 1677 |
0 |
@Override... |
| 1678 |
|
public void printMenuItem_actionPerformed(ActionEvent e) |
| 1679 |
|
{ |
| 1680 |
|
|
| 1681 |
0 |
PrintThread thread = new PrintThread(alignPanel); |
| 1682 |
0 |
thread.start(); |
| 1683 |
|
} |
| 1684 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1685 |
0 |
@Override... |
| 1686 |
|
public void exportFeatures_actionPerformed(ActionEvent e) |
| 1687 |
|
{ |
| 1688 |
0 |
new AnnotationExporter(alignPanel).exportFeatures(); |
| 1689 |
|
} |
| 1690 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 1691 |
0 |
@Override... |
| 1692 |
|
public void exportAnnotations_actionPerformed(ActionEvent e) |
| 1693 |
|
{ |
| 1694 |
0 |
new AnnotationExporter(alignPanel).exportAnnotations(); |
| 1695 |
|
} |
| 1696 |
|
|
| |
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 1 |
Complexity Density: 0.1 |
|
| 1697 |
0 |
@Override... |
| 1698 |
|
public void associatedData_actionPerformed(ActionEvent e) |
| 1699 |
|
{ |
| 1700 |
0 |
final JalviewFileChooser chooser = new JalviewFileChooser( |
| 1701 |
|
Cache.getProperty("LAST_DIRECTORY")); |
| 1702 |
0 |
chooser.setFileView(new JalviewFileView()); |
| 1703 |
0 |
String tooltip = MessageManager |
| 1704 |
|
.getString("label.load_jalview_annotations"); |
| 1705 |
0 |
chooser.setDialogTitle(tooltip); |
| 1706 |
0 |
chooser.setToolTipText(tooltip); |
| 1707 |
0 |
chooser.setResponseHandler(0, () -> { |
| 1708 |
0 |
String choice = chooser.getSelectedFile().getPath(); |
| 1709 |
0 |
Cache.setProperty("LAST_DIRECTORY", choice); |
| 1710 |
0 |
loadJalviewDataFile(chooser.getSelectedFile(), null, null, null); |
| 1711 |
|
}); |
| 1712 |
|
|
| 1713 |
0 |
chooser.showOpenDialog(this); |
| 1714 |
|
} |
| 1715 |
|
|
| 1716 |
|
|
| 1717 |
|
|
| 1718 |
|
|
| 1719 |
|
|
| 1720 |
|
@param |
| 1721 |
|
|
| |
|
| 87.1% |
Uncovered Elements: 4 (31) |
Complexity: 11 |
Complexity Density: 0.65 |
|
| 1722 |
403 |
@Override... |
| 1723 |
|
public void closeMenuItem_actionPerformed(boolean closeAllTabs) |
| 1724 |
|
{ |
| 1725 |
403 |
if (alignPanels != null && alignPanels.size() < 2) |
| 1726 |
|
{ |
| 1727 |
383 |
closeAllTabs = true; |
| 1728 |
|
} |
| 1729 |
|
|
| 1730 |
403 |
Desktop.closeModal(this); |
| 1731 |
|
|
| 1732 |
403 |
try |
| 1733 |
|
{ |
| 1734 |
403 |
if (alignPanels != null) |
| 1735 |
|
{ |
| 1736 |
403 |
if (closeAllTabs) |
| 1737 |
|
{ |
| 1738 |
402 |
if (this.isClosed()) |
| 1739 |
|
{ |
| 1740 |
|
|
| 1741 |
|
|
| 1742 |
545 |
for (int i = 0; i < alignPanels.size(); i++) |
| 1743 |
|
{ |
| 1744 |
269 |
AlignmentPanel ap = alignPanels.get(i); |
| 1745 |
269 |
ap.closePanel(); |
| 1746 |
|
} |
| 1747 |
|
} |
| 1748 |
|
} |
| 1749 |
|
else |
| 1750 |
|
{ |
| 1751 |
1 |
closeView(alignPanel); |
| 1752 |
|
} |
| 1753 |
|
} |
| 1754 |
402 |
if (closeAllTabs) |
| 1755 |
|
{ |
| 1756 |
401 |
if (featureSettings != null && featureSettings.isOpen()) |
| 1757 |
|
{ |
| 1758 |
0 |
featureSettings.close(); |
| 1759 |
0 |
featureSettings = null; |
| 1760 |
|
} |
| 1761 |
|
|
| 1762 |
|
|
| 1763 |
|
|
| 1764 |
|
|
| 1765 |
|
|
| 1766 |
401 |
this.setClosed(true); |
| 1767 |
|
} |
| 1768 |
|
} catch (Exception ex) |
| 1769 |
|
{ |
| 1770 |
1 |
ex.printStackTrace(); |
| 1771 |
|
} |
| 1772 |
|
} |
| 1773 |
|
|
| 1774 |
|
|
| 1775 |
|
|
| 1776 |
|
|
| 1777 |
|
@param |
| 1778 |
|
|
| |
|
| 91.7% |
Uncovered Elements: 1 (12) |
Complexity: 3 |
Complexity Density: 0.3 |
|
| 1779 |
1 |
public void closeView(AlignmentPanel panelToClose)... |
| 1780 |
|
{ |
| 1781 |
1 |
int index = tabbedPane.getSelectedIndex(); |
| 1782 |
1 |
int closedindex = tabbedPane.indexOfComponent(panelToClose); |
| 1783 |
1 |
alignPanels.remove(panelToClose); |
| 1784 |
1 |
panelToClose.closePanel(); |
| 1785 |
1 |
panelToClose = null; |
| 1786 |
|
|
| 1787 |
1 |
tabbedPane.removeTabAt(closedindex); |
| 1788 |
1 |
tabbedPane.validate(); |
| 1789 |
|
|
| 1790 |
1 |
if (index > closedindex || index == tabbedPane.getTabCount()) |
| 1791 |
|
{ |
| 1792 |
|
|
| 1793 |
1 |
index--; |
| 1794 |
|
} |
| 1795 |
|
|
| 1796 |
1 |
this.tabSelectionChanged(index); |
| 1797 |
|
} |
| 1798 |
|
|
| 1799 |
|
|
| 1800 |
|
|
| 1801 |
|
|
| |
|
| 75% |
Uncovered Elements: 4 (16) |
Complexity: 3 |
Complexity Density: 0.25 |
|
| 1802 |
1596 |
void updateEditMenuBar()... |
| 1803 |
|
{ |
| 1804 |
|
|
| 1805 |
1596 |
if (viewport.getHistoryList().size() > 0) |
| 1806 |
|
{ |
| 1807 |
2 |
undoMenuItem.setEnabled(true); |
| 1808 |
2 |
CommandI command = viewport.getHistoryList().peek(); |
| 1809 |
2 |
undoMenuItem.setText(MessageManager |
| 1810 |
|
.formatMessage("label.undo_command", new Object[] |
| 1811 |
|
{ command.getDescription() })); |
| 1812 |
|
} |
| 1813 |
|
else |
| 1814 |
|
{ |
| 1815 |
1594 |
undoMenuItem.setEnabled(false); |
| 1816 |
1594 |
undoMenuItem.setText(MessageManager.getString("action.undo")); |
| 1817 |
|
} |
| 1818 |
|
|
| 1819 |
1596 |
if (viewport.getRedoList().size() > 0) |
| 1820 |
|
{ |
| 1821 |
0 |
redoMenuItem.setEnabled(true); |
| 1822 |
|
|
| 1823 |
0 |
CommandI command = viewport.getRedoList().peek(); |
| 1824 |
0 |
redoMenuItem.setText(MessageManager |
| 1825 |
|
.formatMessage("label.redo_command", new Object[] |
| 1826 |
|
{ command.getDescription() })); |
| 1827 |
|
} |
| 1828 |
|
else |
| 1829 |
|
{ |
| 1830 |
1596 |
redoMenuItem.setEnabled(false); |
| 1831 |
1596 |
redoMenuItem.setText(MessageManager.getString("action.redo")); |
| 1832 |
|
} |
| 1833 |
|
} |
| 1834 |
|
|
| |
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 1835 |
1 |
@Override... |
| 1836 |
|
public void addHistoryItem(CommandI command) |
| 1837 |
|
{ |
| 1838 |
1 |
if (command.getSize() > 0) |
| 1839 |
|
{ |
| 1840 |
1 |
viewport.addToHistoryList(command); |
| 1841 |
1 |
viewport.clearRedoList(); |
| 1842 |
1 |
updateEditMenuBar(); |
| 1843 |
1 |
viewport.updateHiddenColumns(); |
| 1844 |
|
|
| 1845 |
|
|
| 1846 |
|
|
| 1847 |
|
|
| 1848 |
|
} |
| 1849 |
|
} |
| 1850 |
|
|
| 1851 |
|
|
| 1852 |
|
|
| 1853 |
|
@return |
| 1854 |
|
|
| |
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 3 |
Complexity Density: 0.33 |
|
| 1855 |
0 |
public AlignmentI[] getViewAlignments()... |
| 1856 |
|
{ |
| 1857 |
0 |
if (alignPanels != null) |
| 1858 |
|
{ |
| 1859 |
0 |
AlignmentI[] als = new AlignmentI[alignPanels.size()]; |
| 1860 |
0 |
int i = 0; |
| 1861 |
0 |
for (AlignmentPanel ap : alignPanels) |
| 1862 |
|
{ |
| 1863 |
0 |
als[i++] = ap.av.getAlignment(); |
| 1864 |
|
} |
| 1865 |
0 |
return als; |
| 1866 |
|
} |
| 1867 |
0 |
if (viewport != null) |
| 1868 |
|
{ |
| 1869 |
0 |
return new AlignmentI[] { viewport.getAlignment() }; |
| 1870 |
|
} |
| 1871 |
0 |
return null; |
| 1872 |
|
} |
| 1873 |
|
|
| 1874 |
|
|
| 1875 |
|
|
| 1876 |
|
|
| 1877 |
|
@param |
| 1878 |
|
|
| 1879 |
|
|
| |
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 4 |
Complexity Density: 0.33 |
|
| 1880 |
0 |
@Override... |
| 1881 |
|
protected void undoMenuItem_actionPerformed(ActionEvent e) |
| 1882 |
|
{ |
| 1883 |
0 |
if (viewport.getHistoryList().isEmpty()) |
| 1884 |
|
{ |
| 1885 |
0 |
return; |
| 1886 |
|
} |
| 1887 |
0 |
CommandI command = viewport.getHistoryList().pop(); |
| 1888 |
0 |
viewport.addToRedoList(command); |
| 1889 |
0 |
command.undoCommand(getViewAlignments()); |
| 1890 |
|
|
| 1891 |
0 |
AlignmentViewport originalSource = getOriginatingSource(command); |
| 1892 |
0 |
updateEditMenuBar(); |
| 1893 |
|
|
| 1894 |
0 |
if (originalSource != null) |
| 1895 |
|
{ |
| 1896 |
0 |
if (originalSource != viewport) |
| 1897 |
|
{ |
| 1898 |
0 |
Console.warn( |
| 1899 |
|
"Implementation worry: mismatch of viewport origin for undo"); |
| 1900 |
|
} |
| 1901 |
0 |
originalSource.updateHiddenColumns(); |
| 1902 |
|
|
| 1903 |
|
|
| 1904 |
|
|
| 1905 |
|
|
| 1906 |
|
|
| 1907 |
0 |
originalSource.firePropertyChange("alignment", null, |
| 1908 |
|
originalSource.getAlignment().getSequences()); |
| 1909 |
|
} |
| 1910 |
|
} |
| 1911 |
|
|
| 1912 |
|
|
| 1913 |
|
|
| 1914 |
|
|
| 1915 |
|
@param |
| 1916 |
|
|
| 1917 |
|
|
| |
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 4 |
Complexity Density: 0.33 |
|
| 1918 |
0 |
@Override... |
| 1919 |
|
protected void redoMenuItem_actionPerformed(ActionEvent e) |
| 1920 |
|
{ |
| 1921 |
0 |
if (viewport.getRedoList().size() < 1) |
| 1922 |
|
{ |
| 1923 |
0 |
return; |
| 1924 |
|
} |
| 1925 |
|
|
| 1926 |
0 |
CommandI command = viewport.getRedoList().pop(); |
| 1927 |
0 |
viewport.addToHistoryList(command); |
| 1928 |
0 |
command.doCommand(getViewAlignments()); |
| 1929 |
|
|
| 1930 |
0 |
AlignmentViewport originalSource = getOriginatingSource(command); |
| 1931 |
0 |
updateEditMenuBar(); |
| 1932 |
|
|
| 1933 |
0 |
if (originalSource != null) |
| 1934 |
|
{ |
| 1935 |
|
|
| 1936 |
0 |
if (originalSource != viewport) |
| 1937 |
|
{ |
| 1938 |
0 |
Console.warn( |
| 1939 |
|
"Implementation worry: mismatch of viewport origin for redo"); |
| 1940 |
|
} |
| 1941 |
0 |
originalSource.updateHiddenColumns(); |
| 1942 |
|
|
| 1943 |
|
|
| 1944 |
|
|
| 1945 |
|
|
| 1946 |
|
|
| 1947 |
0 |
originalSource.firePropertyChange("alignment", null, |
| 1948 |
|
originalSource.getAlignment().getSequences()); |
| 1949 |
|
} |
| 1950 |
|
} |
| 1951 |
|
|
| |
|
| 0% |
Uncovered Elements: 26 (26) |
Complexity: 6 |
Complexity Density: 0.38 |
|
| 1952 |
0 |
AlignmentViewport getOriginatingSource(CommandI command)... |
| 1953 |
|
{ |
| 1954 |
0 |
AlignmentViewport originalSource = null; |
| 1955 |
|
|
| 1956 |
|
|
| 1957 |
|
|
| 1958 |
0 |
AlignmentI al = null; |
| 1959 |
0 |
if (command instanceof EditCommand) |
| 1960 |
|
{ |
| 1961 |
0 |
EditCommand editCommand = (EditCommand) command; |
| 1962 |
0 |
al = editCommand.getAlignment(); |
| 1963 |
0 |
List<Component> comps = PaintRefresher.components |
| 1964 |
|
.get(viewport.getSequenceSetId()); |
| 1965 |
|
|
| 1966 |
0 |
for (Component comp : comps) |
| 1967 |
|
{ |
| 1968 |
0 |
if (comp instanceof AlignmentPanel) |
| 1969 |
|
{ |
| 1970 |
0 |
if (al == ((AlignmentPanel) comp).av.getAlignment()) |
| 1971 |
|
{ |
| 1972 |
0 |
originalSource = ((AlignmentPanel) comp).av; |
| 1973 |
0 |
break; |
| 1974 |
|
} |
| 1975 |
|
} |
| 1976 |
|
} |
| 1977 |
|
} |
| 1978 |
|
|
| 1979 |
0 |
if (originalSource == null) |
| 1980 |
|
{ |
| 1981 |
|
|
| 1982 |
|
|
| 1983 |
0 |
if (al != null) |
| 1984 |
|
{ |
| 1985 |
0 |
PaintRefresher.validateSequences(al, viewport.getAlignment()); |
| 1986 |
|
} |
| 1987 |
|
|
| 1988 |
0 |
originalSource = viewport; |
| 1989 |
|
} |
| 1990 |
|
|
| 1991 |
0 |
return originalSource; |
| 1992 |
|
} |
| 1993 |
|
|
| 1994 |
|
|
| 1995 |
|
|
| 1996 |
|
|
| 1997 |
|
|
| 1998 |
|
@param |
| 1999 |
|
|
| 2000 |
|
|
| |
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 4 |
Complexity Density: 0.4 |
|
| 2001 |
0 |
public void moveSelectedSequences(boolean up)... |
| 2002 |
|
{ |
| 2003 |
0 |
SequenceGroup sg = viewport.getSelectionGroup(); |
| 2004 |
|
|
| 2005 |
0 |
if (sg == null) |
| 2006 |
|
{ |
| 2007 |
0 |
if (viewport.cursorMode) |
| 2008 |
|
{ |
| 2009 |
0 |
sg = new SequenceGroup(); |
| 2010 |
0 |
sg.addSequence(viewport.getAlignment().getSequenceAt( |
| 2011 |
|
alignPanel.getSeqPanel().seqCanvas.cursorY), false); |
| 2012 |
|
} |
| 2013 |
|
else |
| 2014 |
|
{ |
| 2015 |
0 |
return; |
| 2016 |
|
} |
| 2017 |
|
} |
| 2018 |
|
|
| 2019 |
0 |
if (sg.getSize() < 1) |
| 2020 |
|
{ |
| 2021 |
0 |
return; |
| 2022 |
|
} |
| 2023 |
|
|
| 2024 |
|
|
| 2025 |
|
|
| 2026 |
0 |
viewport.getAlignment().moveSelectedSequencesByOne(sg, |
| 2027 |
|
viewport.getHiddenRepSequences(), up); |
| 2028 |
0 |
alignPanel.paintAlignment(true, false); |
| 2029 |
|
} |
| 2030 |
|
|
| |
|
| 0% |
Uncovered Elements: 65 (65) |
Complexity: 20 |
Complexity Density: 0.51 |
|
| 2031 |
0 |
synchronized void slideSequences(boolean right, int size)... |
| 2032 |
|
{ |
| 2033 |
0 |
List<SequenceI> sg = new ArrayList<>(); |
| 2034 |
0 |
if (viewport.cursorMode) |
| 2035 |
|
{ |
| 2036 |
0 |
sg.add(viewport.getAlignment() |
| 2037 |
|
.getSequenceAt(alignPanel.getSeqPanel().seqCanvas.cursorY)); |
| 2038 |
|
} |
| 2039 |
0 |
else if (viewport.getSelectionGroup() != null |
| 2040 |
|
&& viewport.getSelectionGroup().getSize() != viewport |
| 2041 |
|
.getAlignment().getHeight()) |
| 2042 |
|
{ |
| 2043 |
0 |
sg = viewport.getSelectionGroup() |
| 2044 |
|
.getSequences(viewport.getHiddenRepSequences()); |
| 2045 |
|
} |
| 2046 |
|
|
| 2047 |
0 |
if (sg.size() < 1) |
| 2048 |
|
{ |
| 2049 |
0 |
return; |
| 2050 |
|
} |
| 2051 |
|
|
| 2052 |
0 |
List<SequenceI> invertGroup = new ArrayList<>(); |
| 2053 |
|
|
| 2054 |
0 |
for (SequenceI seq : viewport.getAlignment().getSequences()) |
| 2055 |
|
{ |
| 2056 |
0 |
if (!sg.contains(seq)) |
| 2057 |
|
{ |
| 2058 |
0 |
invertGroup.add(seq); |
| 2059 |
|
} |
| 2060 |
|
} |
| 2061 |
|
|
| 2062 |
0 |
SequenceI[] seqs1 = sg.toArray(new SequenceI[0]); |
| 2063 |
|
|
| 2064 |
0 |
SequenceI[] seqs2 = new SequenceI[invertGroup.size()]; |
| 2065 |
0 |
for (int i = 0; i < invertGroup.size(); i++) |
| 2066 |
|
{ |
| 2067 |
0 |
seqs2[i] = invertGroup.get(i); |
| 2068 |
|
} |
| 2069 |
|
|
| 2070 |
0 |
SlideSequencesCommand ssc; |
| 2071 |
0 |
if (right) |
| 2072 |
|
{ |
| 2073 |
0 |
ssc = new SlideSequencesCommand("Slide Sequences", seqs2, seqs1, size, |
| 2074 |
|
viewport.getGapCharacter()); |
| 2075 |
|
} |
| 2076 |
|
else |
| 2077 |
|
{ |
| 2078 |
0 |
ssc = new SlideSequencesCommand("Slide Sequences", seqs1, seqs2, size, |
| 2079 |
|
viewport.getGapCharacter()); |
| 2080 |
|
} |
| 2081 |
|
|
| 2082 |
0 |
int groupAdjustment = 0; |
| 2083 |
0 |
if (ssc.getGapsInsertedBegin() && right) |
| 2084 |
|
{ |
| 2085 |
0 |
if (viewport.cursorMode) |
| 2086 |
|
{ |
| 2087 |
0 |
alignPanel.getSeqPanel().moveCursor(size, 0); |
| 2088 |
|
} |
| 2089 |
|
else |
| 2090 |
|
{ |
| 2091 |
0 |
groupAdjustment = size; |
| 2092 |
|
} |
| 2093 |
|
} |
| 2094 |
0 |
else if (!ssc.getGapsInsertedBegin() && !right) |
| 2095 |
|
{ |
| 2096 |
0 |
if (viewport.cursorMode) |
| 2097 |
|
{ |
| 2098 |
0 |
alignPanel.getSeqPanel().moveCursor(-size, 0); |
| 2099 |
|
} |
| 2100 |
|
else |
| 2101 |
|
{ |
| 2102 |
0 |
groupAdjustment = -size; |
| 2103 |
|
} |
| 2104 |
|
} |
| 2105 |
|
|
| 2106 |
0 |
if (groupAdjustment != 0) |
| 2107 |
|
{ |
| 2108 |
0 |
viewport.getSelectionGroup().setStartRes( |
| 2109 |
|
viewport.getSelectionGroup().getStartRes() + groupAdjustment); |
| 2110 |
0 |
viewport.getSelectionGroup().setEndRes( |
| 2111 |
|
viewport.getSelectionGroup().getEndRes() + groupAdjustment); |
| 2112 |
|
} |
| 2113 |
|
|
| 2114 |
|
|
| 2115 |
|
|
| 2116 |
|
|
| 2117 |
|
|
| 2118 |
0 |
boolean appendHistoryItem = false; |
| 2119 |
0 |
Deque<CommandI> historyList = viewport.getHistoryList(); |
| 2120 |
0 |
boolean inSplitFrame = getSplitViewContainer() != null; |
| 2121 |
0 |
if (!inSplitFrame && historyList != null && historyList.size() > 0 |
| 2122 |
|
&& historyList.peek() instanceof SlideSequencesCommand) |
| 2123 |
|
{ |
| 2124 |
0 |
appendHistoryItem = ssc.appendSlideCommand( |
| 2125 |
|
(SlideSequencesCommand) historyList.peek()); |
| 2126 |
|
} |
| 2127 |
|
|
| 2128 |
0 |
if (!appendHistoryItem) |
| 2129 |
|
{ |
| 2130 |
0 |
addHistoryItem(ssc); |
| 2131 |
|
} |
| 2132 |
|
|
| 2133 |
0 |
repaint(); |
| 2134 |
|
} |
| 2135 |
|
|
| 2136 |
|
|
| 2137 |
|
|
| 2138 |
|
|
| 2139 |
|
@param |
| 2140 |
|
|
| 2141 |
|
|
| |
|
| 63% |
Uncovered Elements: 10 (27) |
Complexity: 5 |
Complexity Density: 0.24 |
|
| 2142 |
1 |
@Override... |
| 2143 |
|
protected void copy_actionPerformed() |
| 2144 |
|
{ |
| 2145 |
1 |
if (viewport.getSelectionGroup() == null) |
| 2146 |
|
{ |
| 2147 |
0 |
return; |
| 2148 |
|
} |
| 2149 |
|
|
| 2150 |
|
|
| 2151 |
1 |
SequenceI[] seqs = viewport.getSelectionAsNewSequence(); |
| 2152 |
1 |
String[] omitHidden = null; |
| 2153 |
|
|
| 2154 |
1 |
if (viewport.hasHiddenColumns()) |
| 2155 |
|
{ |
| 2156 |
0 |
omitHidden = viewport.getViewAsString(true); |
| 2157 |
|
} |
| 2158 |
|
|
| 2159 |
1 |
String output = new FormatAdapter().formatSequences(FileFormat.Fasta, |
| 2160 |
|
seqs, omitHidden, null); |
| 2161 |
|
|
| 2162 |
1 |
StringSelection ss = new StringSelection(output); |
| 2163 |
|
|
| 2164 |
1 |
try |
| 2165 |
|
{ |
| 2166 |
1 |
jalview.gui.Desktop.internalCopy = true; |
| 2167 |
|
|
| 2168 |
|
|
| 2169 |
1 |
Toolkit.getDefaultToolkit().getSystemClipboard() |
| 2170 |
|
.setContents(new StringSelection(""), null); |
| 2171 |
|
|
| 2172 |
1 |
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, |
| 2173 |
|
Desktop.instance); |
| 2174 |
|
} catch (OutOfMemoryError er) |
| 2175 |
|
{ |
| 2176 |
0 |
new OOMWarning("copying region", er); |
| 2177 |
0 |
return; |
| 2178 |
|
} |
| 2179 |
|
|
| 2180 |
1 |
HiddenColumns hiddenColumns = null; |
| 2181 |
1 |
if (viewport.hasHiddenColumns()) |
| 2182 |
|
{ |
| 2183 |
0 |
int hiddenOffset = viewport.getSelectionGroup().getStartRes(); |
| 2184 |
0 |
int hiddenCutoff = viewport.getSelectionGroup().getEndRes(); |
| 2185 |
|
|
| 2186 |
|
|
| 2187 |
|
|
| 2188 |
0 |
hiddenColumns = new HiddenColumns( |
| 2189 |
|
viewport.getAlignment().getHiddenColumns(), hiddenOffset, |
| 2190 |
|
hiddenCutoff, hiddenOffset); |
| 2191 |
|
} |
| 2192 |
|
|
| 2193 |
1 |
Desktop.jalviewClipboard = new Object[] { seqs, |
| 2194 |
|
viewport.getAlignment().getDataset(), hiddenColumns }; |
| 2195 |
1 |
setStatus(MessageManager.formatMessage( |
| 2196 |
|
"label.copied_sequences_to_clipboard", new Object[] |
| 2197 |
|
{ Integer.valueOf(seqs.length).toString() })); |
| 2198 |
|
} |
| 2199 |
|
|
| 2200 |
|
|
| 2201 |
|
|
| 2202 |
|
|
| 2203 |
|
@param |
| 2204 |
|
|
| 2205 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2206 |
0 |
@Override... |
| 2207 |
|
protected void pasteNew_actionPerformed(ActionEvent e) |
| 2208 |
|
{ |
| 2209 |
0 |
paste(true); |
| 2210 |
|
} |
| 2211 |
|
|
| 2212 |
|
|
| 2213 |
|
|
| 2214 |
|
|
| 2215 |
|
@param |
| 2216 |
|
|
| 2217 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2218 |
0 |
@Override... |
| 2219 |
|
protected void pasteThis_actionPerformed(ActionEvent e) |
| 2220 |
|
{ |
| 2221 |
0 |
paste(false); |
| 2222 |
|
} |
| 2223 |
|
|
| 2224 |
|
|
| 2225 |
|
|
| 2226 |
|
|
| 2227 |
|
@param |
| 2228 |
|
|
| 2229 |
|
|
| |
|
| 0% |
Uncovered Elements: 212 (212) |
Complexity: 48 |
Complexity Density: 0.36 |
|
| 2230 |
0 |
void paste(boolean newAlignment)... |
| 2231 |
|
{ |
| 2232 |
0 |
boolean externalPaste = true; |
| 2233 |
0 |
try |
| 2234 |
|
{ |
| 2235 |
0 |
Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard(); |
| 2236 |
0 |
Transferable contents = c.getContents(this); |
| 2237 |
|
|
| 2238 |
0 |
if (contents == null) |
| 2239 |
|
{ |
| 2240 |
0 |
return; |
| 2241 |
|
} |
| 2242 |
|
|
| 2243 |
0 |
String str; |
| 2244 |
0 |
FileFormatI format; |
| 2245 |
0 |
try |
| 2246 |
|
{ |
| 2247 |
0 |
str = (String) contents.getTransferData(DataFlavor.stringFlavor); |
| 2248 |
0 |
if (str.length() < 1) |
| 2249 |
|
{ |
| 2250 |
0 |
return; |
| 2251 |
|
} |
| 2252 |
|
|
| 2253 |
0 |
format = new IdentifyFile().identify(str, DataSourceType.PASTE); |
| 2254 |
|
|
| 2255 |
|
} catch (OutOfMemoryError er) |
| 2256 |
|
{ |
| 2257 |
0 |
new OOMWarning("Out of memory pasting sequences!!", er); |
| 2258 |
0 |
return; |
| 2259 |
|
} |
| 2260 |
|
|
| 2261 |
0 |
SequenceI[] sequences; |
| 2262 |
0 |
boolean annotationAdded = false; |
| 2263 |
0 |
AlignmentI alignment = null; |
| 2264 |
|
|
| 2265 |
0 |
if (Desktop.jalviewClipboard != null) |
| 2266 |
|
{ |
| 2267 |
|
|
| 2268 |
|
|
| 2269 |
|
|
| 2270 |
0 |
SequenceI[] newseq = (SequenceI[]) Desktop.jalviewClipboard[0]; |
| 2271 |
|
|
| 2272 |
0 |
sequences = new SequenceI[newseq.length]; |
| 2273 |
0 |
for (int i = 0; i < newseq.length; i++) |
| 2274 |
|
{ |
| 2275 |
0 |
sequences[i] = new Sequence(newseq[i]); |
| 2276 |
|
} |
| 2277 |
0 |
alignment = new Alignment(sequences); |
| 2278 |
0 |
externalPaste = false; |
| 2279 |
|
} |
| 2280 |
|
else |
| 2281 |
|
{ |
| 2282 |
|
|
| 2283 |
0 |
alignment = new FormatAdapter().readFile(str, DataSourceType.PASTE, |
| 2284 |
|
format); |
| 2285 |
0 |
sequences = alignment.getSequencesArray(); |
| 2286 |
|
} |
| 2287 |
|
|
| 2288 |
0 |
int alwidth = 0; |
| 2289 |
0 |
ArrayList<Integer> newGraphGroups = new ArrayList<>(); |
| 2290 |
0 |
int fgroup = -1; |
| 2291 |
|
|
| 2292 |
0 |
if (newAlignment) |
| 2293 |
|
{ |
| 2294 |
|
|
| 2295 |
0 |
if (Desktop.jalviewClipboard != null) |
| 2296 |
|
{ |
| 2297 |
|
|
| 2298 |
0 |
alignment.setDataset((Alignment) Desktop.jalviewClipboard[1]); |
| 2299 |
|
} |
| 2300 |
|
else |
| 2301 |
|
{ |
| 2302 |
|
|
| 2303 |
0 |
alignment.setDataset(null); |
| 2304 |
|
} |
| 2305 |
0 |
alwidth = alignment.getWidth() + 1; |
| 2306 |
|
} |
| 2307 |
|
else |
| 2308 |
|
{ |
| 2309 |
0 |
AlignmentI pastedal = alignment; |
| 2310 |
|
|
| 2311 |
0 |
alignment = viewport.getAlignment(); |
| 2312 |
0 |
alwidth = alignment.getWidth() + 1; |
| 2313 |
|
|
| 2314 |
0 |
boolean importDs = Desktop.jalviewClipboard != null |
| 2315 |
|
&& Desktop.jalviewClipboard[1] != alignment.getDataset(); |
| 2316 |
|
|
| 2317 |
|
|
| 2318 |
0 |
Vector<SequenceI> newDs = (importDs) ? new Vector<>() : null; |
| 2319 |
|
|
| 2320 |
|
|
| 2321 |
|
|
| 2322 |
0 |
for (int i = 0; i < sequences.length; i++) |
| 2323 |
|
{ |
| 2324 |
0 |
if (importDs) |
| 2325 |
|
{ |
| 2326 |
0 |
newDs.addElement(null); |
| 2327 |
|
} |
| 2328 |
0 |
SequenceI ds = sequences[i].getDatasetSequence(); |
| 2329 |
|
|
| 2330 |
0 |
if (importDs && ds != null) |
| 2331 |
|
{ |
| 2332 |
0 |
if (!newDs.contains(ds)) |
| 2333 |
|
{ |
| 2334 |
0 |
newDs.setElementAt(ds, i); |
| 2335 |
0 |
ds = new Sequence(ds); |
| 2336 |
|
|
| 2337 |
0 |
sequences[i].setDatasetSequence(ds); |
| 2338 |
|
} |
| 2339 |
|
else |
| 2340 |
|
{ |
| 2341 |
0 |
ds = sequences[newDs.indexOf(ds)].getDatasetSequence(); |
| 2342 |
|
} |
| 2343 |
|
} |
| 2344 |
|
else |
| 2345 |
|
{ |
| 2346 |
|
|
| 2347 |
0 |
sequences[i] = sequences[i].deriveSequence(); |
| 2348 |
0 |
alignment.getDataset() |
| 2349 |
|
.addSequence(sequences[i].getDatasetSequence()); |
| 2350 |
|
|
| 2351 |
|
|
| 2352 |
|
} |
| 2353 |
0 |
alignment.addSequence(sequences[i]); |
| 2354 |
|
} |
| 2355 |
0 |
if (newDs != null) |
| 2356 |
|
{ |
| 2357 |
0 |
newDs.clear(); |
| 2358 |
|
} |
| 2359 |
0 |
if (alignment.getAlignmentAnnotation() != null) |
| 2360 |
|
{ |
| 2361 |
0 |
for (AlignmentAnnotation alan : alignment |
| 2362 |
|
.getAlignmentAnnotation()) |
| 2363 |
|
{ |
| 2364 |
0 |
if (alan.graphGroup > fgroup) |
| 2365 |
|
{ |
| 2366 |
0 |
fgroup = alan.graphGroup; |
| 2367 |
|
} |
| 2368 |
|
} |
| 2369 |
|
} |
| 2370 |
0 |
if (pastedal.getAlignmentAnnotation() != null) |
| 2371 |
|
{ |
| 2372 |
|
|
| 2373 |
0 |
AlignmentAnnotation[] alann = pastedal.getAlignmentAnnotation(); |
| 2374 |
0 |
for (int i = 0; i < alann.length; i++) |
| 2375 |
|
{ |
| 2376 |
0 |
annotationAdded = true; |
| 2377 |
0 |
if (alann[i].sequenceRef == null && !alann[i].autoCalculated) |
| 2378 |
|
{ |
| 2379 |
0 |
AlignmentAnnotation newann = new AlignmentAnnotation( |
| 2380 |
|
alann[i]); |
| 2381 |
0 |
if (newann.graphGroup > -1) |
| 2382 |
|
{ |
| 2383 |
0 |
if (newGraphGroups.size() <= newann.graphGroup |
| 2384 |
|
|| newGraphGroups.get(newann.graphGroup) == null) |
| 2385 |
|
{ |
| 2386 |
0 |
for (int q = newGraphGroups |
| 2387 |
0 |
.size(); q <= newann.graphGroup; q++) |
| 2388 |
|
{ |
| 2389 |
0 |
newGraphGroups.add(q, null); |
| 2390 |
|
} |
| 2391 |
0 |
newGraphGroups.set(newann.graphGroup, |
| 2392 |
|
Integer.valueOf(++fgroup)); |
| 2393 |
|
} |
| 2394 |
0 |
newann.graphGroup = newGraphGroups.get(newann.graphGroup) |
| 2395 |
|
.intValue(); |
| 2396 |
|
} |
| 2397 |
|
|
| 2398 |
0 |
newann.padAnnotation(alwidth); |
| 2399 |
0 |
alignment.addAnnotation(newann); |
| 2400 |
|
} |
| 2401 |
|
} |
| 2402 |
|
} |
| 2403 |
|
} |
| 2404 |
0 |
if (!newAlignment) |
| 2405 |
|
{ |
| 2406 |
|
|
| 2407 |
|
|
| 2408 |
|
|
| 2409 |
0 |
addHistoryItem(new EditCommand( |
| 2410 |
|
MessageManager.getString("label.add_sequences"), |
| 2411 |
|
Action.PASTE, sequences, 0, alignment.getWidth(), |
| 2412 |
|
alignment)); |
| 2413 |
|
} |
| 2414 |
|
|
| 2415 |
0 |
for (int i = 0; i < sequences.length; i++) |
| 2416 |
|
{ |
| 2417 |
0 |
if (sequences[i].getAnnotation() != null) |
| 2418 |
|
{ |
| 2419 |
0 |
AlignmentAnnotation newann; |
| 2420 |
0 |
for (int a = 0; a < sequences[i].getAnnotation().length; a++) |
| 2421 |
|
{ |
| 2422 |
0 |
annotationAdded = true; |
| 2423 |
0 |
newann = sequences[i].getAnnotation()[a]; |
| 2424 |
0 |
newann.adjustForAlignment(); |
| 2425 |
0 |
newann.padAnnotation(alwidth); |
| 2426 |
0 |
if (newann.graphGroup > -1) |
| 2427 |
|
{ |
| 2428 |
0 |
if (newann.graphGroup > -1) |
| 2429 |
|
{ |
| 2430 |
0 |
if (newGraphGroups.size() <= newann.graphGroup |
| 2431 |
|
|| newGraphGroups.get(newann.graphGroup) == null) |
| 2432 |
|
{ |
| 2433 |
0 |
for (int q = newGraphGroups |
| 2434 |
0 |
.size(); q <= newann.graphGroup; q++) |
| 2435 |
|
{ |
| 2436 |
0 |
newGraphGroups.add(q, null); |
| 2437 |
|
} |
| 2438 |
0 |
newGraphGroups.set(newann.graphGroup, |
| 2439 |
|
Integer.valueOf(++fgroup)); |
| 2440 |
|
} |
| 2441 |
0 |
newann.graphGroup = newGraphGroups.get(newann.graphGroup) |
| 2442 |
|
.intValue(); |
| 2443 |
|
} |
| 2444 |
|
} |
| 2445 |
|
|
| 2446 |
0 |
alignment.addAnnotation(sequences[i].getAnnotation()[a]); |
| 2447 |
|
|
| 2448 |
0 |
ContactMatrixI cm = sequences[i] |
| 2449 |
|
.getContactMatrixFor(sequences[i].getAnnotation()[a]); |
| 2450 |
0 |
if (cm != null) |
| 2451 |
|
{ |
| 2452 |
0 |
alignment.addContactListFor(sequences[i].getAnnotation()[a], |
| 2453 |
|
cm); |
| 2454 |
|
} |
| 2455 |
|
|
| 2456 |
0 |
alignment.setAnnotationIndex(sequences[i].getAnnotation()[a], |
| 2457 |
|
a); |
| 2458 |
|
} |
| 2459 |
|
} |
| 2460 |
|
} |
| 2461 |
0 |
if (!newAlignment) |
| 2462 |
|
{ |
| 2463 |
|
|
| 2464 |
|
|
| 2465 |
0 |
viewport.getRanges().setEndSeq(alignment.getHeight() - 1); |
| 2466 |
0 |
if (annotationAdded) |
| 2467 |
|
{ |
| 2468 |
|
|
| 2469 |
0 |
AlignmentI[] alview = this.getViewAlignments(); |
| 2470 |
0 |
for (int i = 0; i < sequences.length; i++) |
| 2471 |
|
{ |
| 2472 |
0 |
AlignmentAnnotation sann[] = sequences[i].getAnnotation(); |
| 2473 |
0 |
if (sann == null) |
| 2474 |
|
{ |
| 2475 |
0 |
continue; |
| 2476 |
|
} |
| 2477 |
0 |
for (int avnum = 0; avnum < alview.length; avnum++) |
| 2478 |
|
{ |
| 2479 |
0 |
if (alview[avnum] != alignment) |
| 2480 |
|
{ |
| 2481 |
|
|
| 2482 |
0 |
int avwidth = alview[avnum].getWidth() + 1; |
| 2483 |
|
|
| 2484 |
|
|
| 2485 |
0 |
for (int a = 0; a < sann.length; a++) |
| 2486 |
|
{ |
| 2487 |
0 |
AlignmentAnnotation newann = new AlignmentAnnotation( |
| 2488 |
|
sann[a]); |
| 2489 |
0 |
sequences[i].addAlignmentAnnotation(newann); |
| 2490 |
0 |
newann.padAnnotation(avwidth); |
| 2491 |
0 |
alview[avnum].addAnnotation(newann); |
| 2492 |
|
|
| 2493 |
|
|
| 2494 |
|
|
| 2495 |
|
|
| 2496 |
0 |
alview[avnum].setAnnotationIndex(newann, a); |
| 2497 |
|
} |
| 2498 |
|
} |
| 2499 |
|
} |
| 2500 |
|
} |
| 2501 |
0 |
buildSortByAnnotationScoresMenu(); |
| 2502 |
|
} |
| 2503 |
0 |
viewport.firePropertyChange("alignment", null, |
| 2504 |
|
alignment.getSequences()); |
| 2505 |
0 |
if (alignPanels != null) |
| 2506 |
|
{ |
| 2507 |
0 |
for (AlignmentPanel ap : alignPanels) |
| 2508 |
|
{ |
| 2509 |
0 |
ap.validateAnnotationDimensions(false); |
| 2510 |
|
} |
| 2511 |
|
} |
| 2512 |
|
else |
| 2513 |
|
{ |
| 2514 |
0 |
alignPanel.validateAnnotationDimensions(false); |
| 2515 |
|
} |
| 2516 |
|
|
| 2517 |
|
} |
| 2518 |
|
else |
| 2519 |
|
{ |
| 2520 |
0 |
AlignFrame af = new AlignFrame(alignment, DEFAULT_WIDTH, |
| 2521 |
|
DEFAULT_HEIGHT); |
| 2522 |
0 |
String newtitle = new String("Copied sequences"); |
| 2523 |
|
|
| 2524 |
0 |
if (Desktop.jalviewClipboard != null |
| 2525 |
|
&& Desktop.jalviewClipboard[2] != null) |
| 2526 |
|
{ |
| 2527 |
0 |
HiddenColumns hc = (HiddenColumns) Desktop.jalviewClipboard[2]; |
| 2528 |
0 |
af.viewport.setHiddenColumns(hc); |
| 2529 |
|
} |
| 2530 |
|
|
| 2531 |
|
|
| 2532 |
|
|
| 2533 |
0 |
af.alignPanel.getSeqPanel().seqCanvas.getFeatureRenderer() |
| 2534 |
|
.transferSettings(alignPanel.getSeqPanel().seqCanvas |
| 2535 |
|
.getFeatureRenderer()); |
| 2536 |
|
|
| 2537 |
|
|
| 2538 |
|
|
| 2539 |
0 |
if (!externalPaste) |
| 2540 |
|
{ |
| 2541 |
0 |
if (title.startsWith("Copied sequences")) |
| 2542 |
|
{ |
| 2543 |
0 |
newtitle = title; |
| 2544 |
|
} |
| 2545 |
|
else |
| 2546 |
|
{ |
| 2547 |
0 |
newtitle = newtitle.concat("- from " + title); |
| 2548 |
|
} |
| 2549 |
|
} |
| 2550 |
|
else |
| 2551 |
|
{ |
| 2552 |
0 |
newtitle = new String("Pasted sequences"); |
| 2553 |
|
} |
| 2554 |
|
|
| 2555 |
0 |
Desktop.addInternalFrame(af, newtitle, DEFAULT_WIDTH, |
| 2556 |
|
DEFAULT_HEIGHT); |
| 2557 |
|
|
| 2558 |
|
} |
| 2559 |
|
|
| 2560 |
|
} catch (Exception ex) |
| 2561 |
|
{ |
| 2562 |
0 |
ex.printStackTrace(); |
| 2563 |
0 |
jalview.bin.Console.outPrintln("Exception whilst pasting: " + ex); |
| 2564 |
|
|
| 2565 |
|
} |
| 2566 |
|
|
| 2567 |
|
} |
| 2568 |
|
|
| |
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 6 |
Complexity Density: 0.4 |
|
| 2569 |
0 |
@Override... |
| 2570 |
|
protected void expand_newalign(ActionEvent e) |
| 2571 |
|
{ |
| 2572 |
0 |
try |
| 2573 |
|
{ |
| 2574 |
0 |
AlignmentI alignment = AlignmentUtils |
| 2575 |
|
.expandContext(getViewport().getAlignment(), -1); |
| 2576 |
0 |
AlignFrame af = new AlignFrame(alignment, DEFAULT_WIDTH, |
| 2577 |
|
DEFAULT_HEIGHT); |
| 2578 |
0 |
String newtitle = new String("Flanking alignment"); |
| 2579 |
|
|
| 2580 |
0 |
if (Desktop.jalviewClipboard != null |
| 2581 |
|
&& Desktop.jalviewClipboard[2] != null) |
| 2582 |
|
{ |
| 2583 |
0 |
HiddenColumns hc = (HiddenColumns) Desktop.jalviewClipboard[2]; |
| 2584 |
0 |
af.viewport.setHiddenColumns(hc); |
| 2585 |
|
} |
| 2586 |
|
|
| 2587 |
|
|
| 2588 |
|
|
| 2589 |
0 |
af.alignPanel.getSeqPanel().seqCanvas.getFeatureRenderer() |
| 2590 |
|
.transferSettings(alignPanel.getSeqPanel().seqCanvas |
| 2591 |
|
.getFeatureRenderer()); |
| 2592 |
|
|
| 2593 |
|
|
| 2594 |
|
|
| 2595 |
|
{ |
| 2596 |
0 |
if (title.startsWith("Copied sequences")) |
| 2597 |
|
{ |
| 2598 |
0 |
newtitle = title; |
| 2599 |
|
} |
| 2600 |
|
else |
| 2601 |
|
{ |
| 2602 |
0 |
newtitle = newtitle.concat("- from " + title); |
| 2603 |
|
} |
| 2604 |
|
} |
| 2605 |
|
|
| 2606 |
0 |
Desktop.addInternalFrame(af, newtitle, DEFAULT_WIDTH, DEFAULT_HEIGHT); |
| 2607 |
|
|
| 2608 |
|
} catch (Exception ex) |
| 2609 |
|
{ |
| 2610 |
0 |
ex.printStackTrace(); |
| 2611 |
0 |
jalview.bin.Console.outPrintln("Exception whilst pasting: " + ex); |
| 2612 |
|
|
| 2613 |
|
} catch (OutOfMemoryError oom) |
| 2614 |
|
{ |
| 2615 |
0 |
new OOMWarning("Viewing flanking region of alignment", oom); |
| 2616 |
|
} |
| 2617 |
|
} |
| 2618 |
|
|
| 2619 |
|
|
| 2620 |
|
|
| 2621 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 2622 |
0 |
@Override... |
| 2623 |
|
protected void cut_actionPerformed() |
| 2624 |
|
{ |
| 2625 |
0 |
copy_actionPerformed(); |
| 2626 |
0 |
delete_actionPerformed(); |
| 2627 |
|
} |
| 2628 |
|
|
| 2629 |
|
|
| 2630 |
|
|
| 2631 |
|
|
| |
|
| 0% |
Uncovered Elements: 31 (31) |
Complexity: 8 |
Complexity Density: 0.35 |
|
| 2632 |
0 |
@Override... |
| 2633 |
|
protected void delete_actionPerformed() |
| 2634 |
|
{ |
| 2635 |
|
|
| 2636 |
0 |
SequenceGroup sg = viewport.getSelectionGroup(); |
| 2637 |
0 |
if (sg == null) |
| 2638 |
|
{ |
| 2639 |
0 |
return; |
| 2640 |
|
} |
| 2641 |
|
|
| 2642 |
0 |
Runnable okAction = () -> { |
| 2643 |
0 |
SequenceI[] cut = sg.getSequences() |
| 2644 |
|
.toArray(new SequenceI[sg.getSize()]); |
| 2645 |
|
|
| 2646 |
0 |
addHistoryItem(new EditCommand( |
| 2647 |
|
MessageManager.getString("label.cut_sequences"), Action.CUT, |
| 2648 |
|
cut, sg.getStartRes(), sg.getEndRes() - sg.getStartRes() + 1, |
| 2649 |
|
viewport.getAlignment())); |
| 2650 |
|
|
| 2651 |
0 |
viewport.setSelectionGroup(null); |
| 2652 |
0 |
viewport.sendSelection(); |
| 2653 |
0 |
viewport.getAlignment().deleteGroup(sg); |
| 2654 |
|
|
| 2655 |
0 |
viewport.firePropertyChange("alignment", null, |
| 2656 |
|
viewport.getAlignment().getSequences()); |
| 2657 |
0 |
if (viewport.getAlignment().getHeight() < 1) |
| 2658 |
|
{ |
| 2659 |
0 |
try |
| 2660 |
|
{ |
| 2661 |
0 |
AlignFrame.this.setClosed(true); |
| 2662 |
|
} catch (Exception ex) |
| 2663 |
|
{ |
| 2664 |
|
} |
| 2665 |
|
} |
| 2666 |
|
}; |
| 2667 |
|
|
| 2668 |
|
|
| 2669 |
|
|
| 2670 |
|
|
| 2671 |
0 |
boolean wholeHeight = sg.getSize() == viewport.getAlignment() |
| 2672 |
|
.getHeight(); |
| 2673 |
0 |
boolean wholeWidth = (((sg.getEndRes() - sg.getStartRes()) |
| 2674 |
|
+ 1) == viewport.getAlignment().getWidth()) ? true : false; |
| 2675 |
0 |
if (wholeHeight && wholeWidth) |
| 2676 |
|
{ |
| 2677 |
0 |
JvOptionPane dialog = JvOptionPane.newOptionDialog(Desktop.desktop); |
| 2678 |
0 |
dialog.setResponseHandler(0, okAction); |
| 2679 |
0 |
Object[] options = new Object[] { |
| 2680 |
|
MessageManager.getString("action.ok"), |
| 2681 |
|
MessageManager.getString("action.cancel") }; |
| 2682 |
0 |
dialog.showDialog(MessageManager.getString("warn.delete_all"), |
| 2683 |
|
MessageManager.getString("label.delete_all"), |
| 2684 |
|
JvOptionPane.DEFAULT_OPTION, JvOptionPane.PLAIN_MESSAGE, null, |
| 2685 |
|
options, options[0]); |
| 2686 |
|
} |
| 2687 |
|
else |
| 2688 |
|
{ |
| 2689 |
0 |
try |
| 2690 |
|
{ |
| 2691 |
0 |
okAction.run(); |
| 2692 |
|
} catch (Exception e) |
| 2693 |
|
{ |
| 2694 |
0 |
e.printStackTrace(); |
| 2695 |
|
} |
| 2696 |
|
} |
| 2697 |
|
} |
| 2698 |
|
|
| 2699 |
|
|
| 2700 |
|
|
| 2701 |
|
|
| 2702 |
|
@param |
| 2703 |
|
|
| 2704 |
|
|
| |
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 2705 |
0 |
@Override... |
| 2706 |
|
protected void deleteGroups_actionPerformed(ActionEvent e) |
| 2707 |
|
{ |
| 2708 |
0 |
if (avc.deleteGroups()) |
| 2709 |
|
{ |
| 2710 |
0 |
PaintRefresher.Refresh(this, viewport.getSequenceSetId()); |
| 2711 |
0 |
alignPanel.updateAnnotation(); |
| 2712 |
0 |
alignPanel.paintAlignment(true, true); |
| 2713 |
|
} |
| 2714 |
|
} |
| 2715 |
|
|
| 2716 |
|
|
| 2717 |
|
|
| 2718 |
|
|
| 2719 |
|
@param |
| 2720 |
|
|
| 2721 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
| 2722 |
6 |
@Override... |
| 2723 |
|
public void selectAllSequenceMenuItem_actionPerformed(ActionEvent e) |
| 2724 |
|
{ |
| 2725 |
6 |
SequenceGroup sg = new SequenceGroup( |
| 2726 |
|
viewport.getAlignment().getSequences()); |
| 2727 |
|
|
| 2728 |
6 |
sg.setEndRes(viewport.getAlignment().getWidth() - 1); |
| 2729 |
6 |
viewport.setSelectionGroup(sg); |
| 2730 |
6 |
viewport.isSelectionGroupChanged(true); |
| 2731 |
6 |
viewport.sendSelection(); |
| 2732 |
|
|
| 2733 |
|
|
| 2734 |
|
|
| 2735 |
6 |
alignPanel.paintAlignment(false, false); |
| 2736 |
6 |
PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId()); |
| 2737 |
|
} |
| 2738 |
|
|
| 2739 |
|
|
| 2740 |
|
|
| 2741 |
|
|
| 2742 |
|
@param |
| 2743 |
|
|
| 2744 |
|
|
| |
|
| 75% |
Uncovered Elements: 3 (12) |
Complexity: 2 |
Complexity Density: 0.2 |
|
| 2745 |
2 |
@Override... |
| 2746 |
|
public void deselectAllSequenceMenuItem_actionPerformed(ActionEvent e) |
| 2747 |
|
{ |
| 2748 |
2 |
if (viewport.cursorMode) |
| 2749 |
|
{ |
| 2750 |
0 |
alignPanel.getSeqPanel().keyboardNo1 = null; |
| 2751 |
0 |
alignPanel.getSeqPanel().keyboardNo2 = null; |
| 2752 |
|
} |
| 2753 |
2 |
viewport.setSelectionGroup(null); |
| 2754 |
2 |
viewport.getColumnSelection().clear(); |
| 2755 |
2 |
viewport.setSearchResults(null); |
| 2756 |
2 |
alignPanel.getIdPanel().getIdCanvas().searchResults = null; |
| 2757 |
|
|
| 2758 |
|
|
| 2759 |
|
|
| 2760 |
2 |
alignPanel.paintAlignment(false, false); |
| 2761 |
2 |
PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId()); |
| 2762 |
2 |
viewport.sendSelection(); |
| 2763 |
|
} |
| 2764 |
|
|
| 2765 |
|
|
| 2766 |
|
|
| 2767 |
|
|
| 2768 |
|
@param |
| 2769 |
|
|
| 2770 |
|
|
| |
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 3 |
Complexity Density: 0.33 |
|
| 2771 |
0 |
@Override... |
| 2772 |
|
public void invertSequenceMenuItem_actionPerformed(ActionEvent e) |
| 2773 |
|
{ |
| 2774 |
0 |
SequenceGroup sg = viewport.getSelectionGroup(); |
| 2775 |
|
|
| 2776 |
0 |
if (sg == null) |
| 2777 |
|
{ |
| 2778 |
0 |
selectAllSequenceMenuItem_actionPerformed(null); |
| 2779 |
|
|
| 2780 |
0 |
return; |
| 2781 |
|
} |
| 2782 |
|
|
| 2783 |
0 |
for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++) |
| 2784 |
|
{ |
| 2785 |
0 |
sg.addOrRemove(viewport.getAlignment().getSequenceAt(i), false); |
| 2786 |
|
} |
| 2787 |
|
|
| 2788 |
|
|
| 2789 |
|
|
| 2790 |
|
|
| 2791 |
0 |
alignPanel.paintAlignment(true, false); |
| 2792 |
0 |
PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId()); |
| 2793 |
0 |
viewport.sendSelection(); |
| 2794 |
|
} |
| 2795 |
|
|
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 2796 |
0 |
@Override... |
| 2797 |
|
public void invertColSel_actionPerformed(ActionEvent e) |
| 2798 |
|
{ |
| 2799 |
0 |
viewport.invertColumnSelection(); |
| 2800 |
0 |
alignPanel.paintAlignment(true, false); |
| 2801 |
0 |
PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId()); |
| 2802 |
0 |
viewport.sendSelection(); |
| 2803 |
|
} |
| 2804 |
|
|
| 2805 |
|
|
| 2806 |
|
|
| 2807 |
|
|
| 2808 |
|
@param |
| 2809 |
|
|
| 2810 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2811 |
0 |
@Override... |
| 2812 |
|
public void remove2LeftMenuItem_actionPerformed(ActionEvent e) |
| 2813 |
|
{ |
| 2814 |
0 |
trimAlignment(true); |
| 2815 |
|
} |
| 2816 |
|
|
| 2817 |
|
|
| 2818 |
|
|
| 2819 |
|
|
| 2820 |
|
@param |
| 2821 |
|
|
| 2822 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2823 |
0 |
@Override... |
| 2824 |
|
public void remove2RightMenuItem_actionPerformed(ActionEvent e) |
| 2825 |
|
{ |
| 2826 |
0 |
trimAlignment(false); |
| 2827 |
|
} |
| 2828 |
|
|
| |
|
| 0% |
Uncovered Elements: 31 (31) |
Complexity: 9 |
Complexity Density: 0.43 |
|
| 2829 |
0 |
void trimAlignment(boolean trimLeft)... |
| 2830 |
|
{ |
| 2831 |
0 |
ColumnSelection colSel = viewport.getColumnSelection(); |
| 2832 |
0 |
int column; |
| 2833 |
|
|
| 2834 |
0 |
if (!colSel.isEmpty()) |
| 2835 |
|
{ |
| 2836 |
0 |
if (trimLeft) |
| 2837 |
|
{ |
| 2838 |
0 |
column = colSel.getMin(); |
| 2839 |
|
} |
| 2840 |
|
else |
| 2841 |
|
{ |
| 2842 |
0 |
column = colSel.getMax(); |
| 2843 |
|
} |
| 2844 |
|
|
| 2845 |
0 |
SequenceI[] seqs; |
| 2846 |
0 |
if (viewport.getSelectionGroup() != null) |
| 2847 |
|
{ |
| 2848 |
0 |
seqs = viewport.getSelectionGroup() |
| 2849 |
|
.getSequencesAsArray(viewport.getHiddenRepSequences()); |
| 2850 |
|
} |
| 2851 |
|
else |
| 2852 |
|
{ |
| 2853 |
0 |
seqs = viewport.getAlignment().getSequencesArray(); |
| 2854 |
|
} |
| 2855 |
|
|
| 2856 |
0 |
TrimRegionCommand trimRegion; |
| 2857 |
0 |
if (trimLeft) |
| 2858 |
|
{ |
| 2859 |
0 |
trimRegion = new TrimRegionCommand("Remove Left", true, seqs, |
| 2860 |
|
column, viewport.getAlignment()); |
| 2861 |
0 |
viewport.getRanges().setStartRes(0); |
| 2862 |
|
} |
| 2863 |
|
else |
| 2864 |
|
{ |
| 2865 |
0 |
trimRegion = new TrimRegionCommand("Remove Right", false, seqs, |
| 2866 |
|
column, viewport.getAlignment()); |
| 2867 |
|
} |
| 2868 |
|
|
| 2869 |
0 |
setStatus(MessageManager.formatMessage("label.removed_columns", |
| 2870 |
|
new String[] |
| 2871 |
|
{ Integer.valueOf(trimRegion.getSize()).toString() })); |
| 2872 |
|
|
| 2873 |
0 |
addHistoryItem(trimRegion); |
| 2874 |
|
|
| 2875 |
0 |
for (SequenceGroup sg : viewport.getAlignment().getGroups()) |
| 2876 |
|
{ |
| 2877 |
0 |
if ((trimLeft && !sg.adjustForRemoveLeft(column)) |
| 2878 |
|
|| (!trimLeft && !sg.adjustForRemoveRight(column))) |
| 2879 |
|
{ |
| 2880 |
0 |
viewport.getAlignment().deleteGroup(sg); |
| 2881 |
|
} |
| 2882 |
|
} |
| 2883 |
|
|
| 2884 |
0 |
viewport.firePropertyChange("alignment", null, |
| 2885 |
|
viewport.getAlignment().getSequences()); |
| 2886 |
|
} |
| 2887 |
|
} |
| 2888 |
|
|
| 2889 |
|
|
| 2890 |
|
|
| 2891 |
|
|
| 2892 |
|
@param |
| 2893 |
|
|
| 2894 |
|
|
| |
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 2 |
Complexity Density: 0.13 |
|
| 2895 |
0 |
@Override... |
| 2896 |
|
public void removeGappedColumnMenuItem_actionPerformed(ActionEvent e) |
| 2897 |
|
{ |
| 2898 |
0 |
int start = 0, end = viewport.getAlignment().getWidth() - 1; |
| 2899 |
|
|
| 2900 |
0 |
SequenceI[] seqs; |
| 2901 |
0 |
if (viewport.getSelectionGroup() != null) |
| 2902 |
|
{ |
| 2903 |
0 |
seqs = viewport.getSelectionGroup() |
| 2904 |
|
.getSequencesAsArray(viewport.getHiddenRepSequences()); |
| 2905 |
0 |
start = viewport.getSelectionGroup().getStartRes(); |
| 2906 |
0 |
end = viewport.getSelectionGroup().getEndRes(); |
| 2907 |
|
} |
| 2908 |
|
else |
| 2909 |
|
{ |
| 2910 |
0 |
seqs = viewport.getAlignment().getSequencesArray(); |
| 2911 |
|
} |
| 2912 |
|
|
| 2913 |
0 |
RemoveGapColCommand removeGapCols = new RemoveGapColCommand( |
| 2914 |
|
"Remove Gapped Columns", seqs, start, end, |
| 2915 |
|
viewport.getAlignment()); |
| 2916 |
|
|
| 2917 |
0 |
addHistoryItem(removeGapCols); |
| 2918 |
|
|
| 2919 |
0 |
setStatus(MessageManager.formatMessage("label.removed_empty_columns", |
| 2920 |
|
new Object[] |
| 2921 |
|
{ Integer.valueOf(removeGapCols.getSize()).toString() })); |
| 2922 |
|
|
| 2923 |
|
|
| 2924 |
|
|
| 2925 |
0 |
SequenceI seq = viewport.getAlignment().getSequenceAt(0); |
| 2926 |
0 |
ViewportRanges ranges = viewport.getRanges(); |
| 2927 |
0 |
int startRes = seq.findPosition(ranges.getStartRes()); |
| 2928 |
|
|
| 2929 |
|
|
| 2930 |
|
|
| 2931 |
|
|
| 2932 |
|
|
| 2933 |
0 |
ranges.setStartRes(seq.findIndex(startRes) - 1); |
| 2934 |
0 |
viewport.firePropertyChange("alignment", null, |
| 2935 |
|
viewport.getAlignment().getSequences()); |
| 2936 |
|
|
| 2937 |
|
} |
| 2938 |
|
|
| 2939 |
|
|
| 2940 |
|
|
| 2941 |
|
|
| 2942 |
|
@param |
| 2943 |
|
|
| 2944 |
|
|
| |
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 2 |
Complexity Density: 0.17 |
|
| 2945 |
0 |
@Override... |
| 2946 |
|
public void removeAllGapsMenuItem_actionPerformed(ActionEvent e) |
| 2947 |
|
{ |
| 2948 |
0 |
int start = 0, end = viewport.getAlignment().getWidth() - 1; |
| 2949 |
|
|
| 2950 |
0 |
SequenceI[] seqs; |
| 2951 |
0 |
if (viewport.getSelectionGroup() != null) |
| 2952 |
|
{ |
| 2953 |
0 |
seqs = viewport.getSelectionGroup() |
| 2954 |
|
.getSequencesAsArray(viewport.getHiddenRepSequences()); |
| 2955 |
0 |
start = viewport.getSelectionGroup().getStartRes(); |
| 2956 |
0 |
end = viewport.getSelectionGroup().getEndRes(); |
| 2957 |
|
} |
| 2958 |
|
else |
| 2959 |
|
{ |
| 2960 |
0 |
seqs = viewport.getAlignment().getSequencesArray(); |
| 2961 |
|
} |
| 2962 |
|
|
| 2963 |
|
|
| 2964 |
|
|
| 2965 |
0 |
SequenceI seq = viewport.getAlignment().getSequenceAt(0); |
| 2966 |
0 |
int startRes = seq.findPosition(viewport.getRanges().getStartRes()); |
| 2967 |
|
|
| 2968 |
0 |
addHistoryItem(new RemoveGapsCommand("Remove Gaps", seqs, start, end, |
| 2969 |
|
viewport.getAlignment())); |
| 2970 |
|
|
| 2971 |
0 |
viewport.getRanges().setStartRes(seq.findIndex(startRes) - 1); |
| 2972 |
|
|
| 2973 |
0 |
viewport.firePropertyChange("alignment", null, |
| 2974 |
|
viewport.getAlignment().getSequences()); |
| 2975 |
|
|
| 2976 |
|
} |
| 2977 |
|
|
| 2978 |
|
|
| 2979 |
|
|
| 2980 |
|
|
| 2981 |
|
@param |
| 2982 |
|
|
| 2983 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 2984 |
0 |
@Override... |
| 2985 |
|
public void padGapsMenuitem_actionPerformed(ActionEvent e) |
| 2986 |
|
{ |
| 2987 |
0 |
viewport.setPadGaps(padGapsMenuitem.isSelected()); |
| 2988 |
0 |
viewport.firePropertyChange("alignment", null, |
| 2989 |
|
viewport.getAlignment().getSequences()); |
| 2990 |
|
} |
| 2991 |
|
|
| 2992 |
|
|
| 2993 |
|
|
| 2994 |
|
|
| 2995 |
|
@param |
| 2996 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 2997 |
0 |
@Override... |
| 2998 |
|
public void findMenuItem_actionPerformed(ActionEvent e) |
| 2999 |
|
{ |
| 3000 |
0 |
new Finder(alignPanel, false, null); |
| 3001 |
|
} |
| 3002 |
|
|
| 3003 |
|
|
| 3004 |
|
|
| 3005 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 3006 |
7 |
@Override... |
| 3007 |
|
public void newView_actionPerformed(ActionEvent e) |
| 3008 |
|
{ |
| 3009 |
7 |
newView(null, true); |
| 3010 |
|
} |
| 3011 |
|
|
| 3012 |
|
|
| 3013 |
|
|
| 3014 |
|
|
| 3015 |
|
@param |
| 3016 |
|
|
| 3017 |
|
@param |
| 3018 |
|
|
| 3019 |
|
@return |
| 3020 |
|
|
| |
|
| 82.1% |
Uncovered Elements: 5 (28) |
Complexity: 5 |
Complexity Density: 0.25 |
|
| 3021 |
10 |
public AlignmentPanel newView(String viewTitle, boolean copyAnnotation)... |
| 3022 |
|
{ |
| 3023 |
|
|
| 3024 |
|
|
| 3025 |
|
|
| 3026 |
10 |
AlignmentPanel newap = new jalview.project.Jalview2XML() |
| 3027 |
|
.copyAlignPanel(alignPanel); |
| 3028 |
10 |
if (!copyAnnotation) |
| 3029 |
|
{ |
| 3030 |
|
|
| 3031 |
|
|
| 3032 |
|
|
| 3033 |
0 |
newap.av.getAlignment().deleteAllGroups(); |
| 3034 |
0 |
newap.av.getAlignment().deleteAllAnnotations(false); |
| 3035 |
|
} |
| 3036 |
|
|
| 3037 |
10 |
newap.av.setGatherViewsHere(false); |
| 3038 |
|
|
| 3039 |
10 |
if (viewport.getViewName() == null) |
| 3040 |
|
{ |
| 3041 |
9 |
viewport.setViewName( |
| 3042 |
|
MessageManager.getString("label.view_name_original")); |
| 3043 |
|
} |
| 3044 |
|
|
| 3045 |
|
|
| 3046 |
|
|
| 3047 |
|
|
| 3048 |
10 |
newap.av.setHistoryList(viewport.getHistoryList()); |
| 3049 |
10 |
newap.av.setRedoList(viewport.getRedoList()); |
| 3050 |
|
|
| 3051 |
|
|
| 3052 |
|
|
| 3053 |
|
|
| 3054 |
10 |
newap.av.setColourAppliesToAllGroups( |
| 3055 |
|
viewport.getColourAppliesToAllGroups()); |
| 3056 |
|
|
| 3057 |
|
|
| 3058 |
|
|
| 3059 |
|
|
| 3060 |
|
|
| 3061 |
10 |
newap.av.replaceMappings(viewport.getAlignment()); |
| 3062 |
|
|
| 3063 |
|
|
| 3064 |
|
|
| 3065 |
|
|
| 3066 |
10 |
if (newap.av.initComplementConsensus()) |
| 3067 |
|
{ |
| 3068 |
0 |
newap.refresh(true); |
| 3069 |
|
} |
| 3070 |
|
|
| 3071 |
10 |
newap.av.setViewName(getNewViewName(viewTitle)); |
| 3072 |
|
|
| 3073 |
10 |
addAlignmentPanel(newap, true); |
| 3074 |
10 |
newap.alignmentChanged(); |
| 3075 |
|
|
| 3076 |
10 |
if (alignPanels.size() == 2) |
| 3077 |
|
{ |
| 3078 |
9 |
viewport.setGatherViewsHere(true); |
| 3079 |
|
} |
| 3080 |
10 |
tabbedPane.setSelectedIndex(tabbedPane.getTabCount() - 1); |
| 3081 |
|
|
| 3082 |
10 |
return newap; |
| 3083 |
|
} |
| 3084 |
|
|
| 3085 |
|
|
| 3086 |
|
|
| 3087 |
|
|
| 3088 |
|
|
| 3089 |
|
|
| 3090 |
|
@param |
| 3091 |
|
@return |
| 3092 |
|
|
| |
|
| 88.9% |
Uncovered Elements: 2 (18) |
Complexity: 5 |
Complexity Density: 0.42 |
|
| 3093 |
10 |
protected String getNewViewName(String viewTitle)... |
| 3094 |
|
{ |
| 3095 |
10 |
int index = Desktop.getViewCount(viewport.getSequenceSetId()); |
| 3096 |
10 |
boolean addFirstIndex = false; |
| 3097 |
10 |
if (viewTitle == null || viewTitle.trim().length() == 0) |
| 3098 |
|
{ |
| 3099 |
7 |
viewTitle = MessageManager.getString("action.view"); |
| 3100 |
7 |
addFirstIndex = true; |
| 3101 |
|
} |
| 3102 |
|
else |
| 3103 |
|
{ |
| 3104 |
3 |
index = 1; |
| 3105 |
|
} |
| 3106 |
10 |
String newViewName = viewTitle + ((addFirstIndex) ? " " + index : ""); |
| 3107 |
|
|
| 3108 |
10 |
List<Component> comps = PaintRefresher.components |
| 3109 |
|
.get(viewport.getSequenceSetId()); |
| 3110 |
|
|
| 3111 |
10 |
List<String> existingNames = getExistingViewNames(comps); |
| 3112 |
|
|
| 3113 |
10 |
while (existingNames.contains(newViewName)) |
| 3114 |
|
{ |
| 3115 |
0 |
newViewName = viewTitle + " " + (++index); |
| 3116 |
|
} |
| 3117 |
10 |
return newViewName; |
| 3118 |
|
} |
| 3119 |
|
|
| 3120 |
|
|
| 3121 |
|
|
| 3122 |
|
|
| 3123 |
|
|
| 3124 |
|
@param |
| 3125 |
|
@return |
| 3126 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 3 |
Complexity Density: 0.43 |
|
| 3127 |
10 |
protected List<String> getExistingViewNames(List<Component> comps)... |
| 3128 |
|
{ |
| 3129 |
10 |
List<String> existingNames = new ArrayList<>(); |
| 3130 |
10 |
for (Component comp : comps) |
| 3131 |
|
{ |
| 3132 |
63 |
if (comp instanceof AlignmentPanel) |
| 3133 |
|
{ |
| 3134 |
21 |
AlignmentPanel ap = (AlignmentPanel) comp; |
| 3135 |
21 |
if (!existingNames.contains(ap.av.getViewName())) |
| 3136 |
|
{ |
| 3137 |
20 |
existingNames.add(ap.av.getViewName()); |
| 3138 |
|
} |
| 3139 |
|
} |
| 3140 |
|
} |
| 3141 |
10 |
return existingNames; |
| 3142 |
|
} |
| 3143 |
|
|
| 3144 |
|
|
| 3145 |
|
|
| 3146 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 3147 |
0 |
@Override... |
| 3148 |
|
public void expandViews_actionPerformed(ActionEvent e) |
| 3149 |
|
{ |
| 3150 |
0 |
Desktop.explodeViews(this); |
| 3151 |
|
} |
| 3152 |
|
|
| 3153 |
|
|
| 3154 |
|
|
| 3155 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 3156 |
0 |
@Override... |
| 3157 |
|
public void gatherViews_actionPerformed(ActionEvent e) |
| 3158 |
|
{ |
| 3159 |
0 |
Desktop.instance.gatherViews(this); |
| 3160 |
|
} |
| 3161 |
|
|
| 3162 |
|
|
| 3163 |
|
|
| 3164 |
|
|
| 3165 |
|
@param |
| 3166 |
|
|
| 3167 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 3168 |
0 |
@Override... |
| 3169 |
|
public void font_actionPerformed(ActionEvent e) |
| 3170 |
|
{ |
| 3171 |
0 |
new FontChooser(alignPanel); |
| 3172 |
|
} |
| 3173 |
|
|
| 3174 |
|
|
| 3175 |
|
|
| 3176 |
|
|
| 3177 |
|
@param |
| 3178 |
|
|
| 3179 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 3180 |
0 |
@Override... |
| 3181 |
|
protected void seqLimit_actionPerformed(ActionEvent e) |
| 3182 |
|
{ |
| 3183 |
0 |
viewport.setShowJVSuffix(seqLimits.isSelected()); |
| 3184 |
|
|
| 3185 |
0 |
alignPanel.getIdPanel().getIdCanvas() |
| 3186 |
|
.setPreferredSize(alignPanel.calculateIdWidth()); |
| 3187 |
0 |
alignPanel.paintAlignment(true, false); |
| 3188 |
|
} |
| 3189 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 3190 |
0 |
@Override... |
| 3191 |
|
public void idRightAlign_actionPerformed(ActionEvent e) |
| 3192 |
|
{ |
| 3193 |
0 |
viewport.setRightAlignIds(idRightAlign.isSelected()); |
| 3194 |
0 |
alignPanel.paintAlignment(false, false); |
| 3195 |
|
} |
| 3196 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 3197 |
0 |
@Override... |
| 3198 |
|
public void centreColumnLabels_actionPerformed(ActionEvent e) |
| 3199 |
|
{ |
| 3200 |
0 |
viewport.setCentreColumnLabels(centreColumnLabelsMenuItem.getState()); |
| 3201 |
0 |
alignPanel.paintAlignment(false, false); |
| 3202 |
|
} |
| 3203 |
|
|
| 3204 |
|
|
| 3205 |
|
|
| 3206 |
|
|
| 3207 |
|
@see |
| 3208 |
|
|
| |
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 3209 |
0 |
@Override... |
| 3210 |
|
protected void followHighlight_actionPerformed() |
| 3211 |
|
{ |
| 3212 |
|
|
| 3213 |
|
|
| 3214 |
|
|
| 3215 |
0 |
final boolean state = this.followHighlightMenuItem.getState(); |
| 3216 |
0 |
viewport.setFollowHighlight(state); |
| 3217 |
0 |
if (state) |
| 3218 |
|
{ |
| 3219 |
0 |
alignPanel.scrollToPosition(viewport.getSearchResults()); |
| 3220 |
|
} |
| 3221 |
|
} |
| 3222 |
|
|
| 3223 |
|
|
| 3224 |
|
|
| 3225 |
|
|
| 3226 |
|
@param |
| 3227 |
|
|
| 3228 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 3229 |
0 |
@Override... |
| 3230 |
|
protected void colourTextMenuItem_actionPerformed(ActionEvent e) |
| 3231 |
|
{ |
| 3232 |
0 |
viewport.setColourText(colourTextMenuItem.isSelected()); |
| 3233 |
0 |
alignPanel.paintAlignment(false, false); |
| 3234 |
|
} |
| 3235 |
|
|
| 3236 |
|
|
| 3237 |
|
|
| 3238 |
|
|
| 3239 |
|
@param |
| 3240 |
|
|
| 3241 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 3242 |
7 |
@Override... |
| 3243 |
|
public void wrapMenuItem_actionPerformed(ActionEvent e) |
| 3244 |
|
{ |
| 3245 |
7 |
setWrapFormat(wrapMenuItem.isSelected(), false); |
| 3246 |
|
} |
| 3247 |
|
|
| |
|
| 77.8% |
Uncovered Elements: 2 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
| 3248 |
8 |
public void setWrapFormat(boolean b, boolean setMenuItem)... |
| 3249 |
|
{ |
| 3250 |
8 |
scaleAbove.setVisible(b); |
| 3251 |
8 |
scaleLeft.setVisible(b); |
| 3252 |
8 |
scaleRight.setVisible(b); |
| 3253 |
8 |
viewport.setWrapAlignment(b); |
| 3254 |
8 |
alignPanel.updateLayout(); |
| 3255 |
8 |
if (setMenuItem) |
| 3256 |
|
{ |
| 3257 |
0 |
wrapMenuItem.setSelected(b); |
| 3258 |
|
} |
| 3259 |
|
} |
| 3260 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 3261 |
0 |
@Override... |
| 3262 |
|
public void showAllSeqs_actionPerformed(ActionEvent e) |
| 3263 |
|
{ |
| 3264 |
0 |
viewport.showAllHiddenSeqs(); |
| 3265 |
|
} |
| 3266 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 3267 |
0 |
@Override... |
| 3268 |
|
public void showAllColumns_actionPerformed(ActionEvent e) |
| 3269 |
|
{ |
| 3270 |
0 |
viewport.showAllHiddenColumns(); |
| 3271 |
0 |
alignPanel.paintAlignment(true, true); |
| 3272 |
0 |
viewport.sendSelection(); |
| 3273 |
|
} |
| 3274 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 3275 |
0 |
@Override... |
| 3276 |
|
public void hideSelSequences_actionPerformed(ActionEvent e) |
| 3277 |
|
{ |
| 3278 |
0 |
viewport.hideAllSelectedSeqs(); |
| 3279 |
|
} |
| 3280 |
|
|
| 3281 |
|
|
| 3282 |
|
|
| 3283 |
|
|
| 3284 |
|
@param |
| 3285 |
|
@param |
| 3286 |
|
|
| |
|
| 0% |
Uncovered Elements: 44 (44) |
Complexity: 17 |
Complexity Density: 0.71 |
|
| 3287 |
0 |
protected void toggleHiddenRegions(boolean toggleSeqs, boolean toggleCols)... |
| 3288 |
|
{ |
| 3289 |
|
|
| 3290 |
0 |
boolean hide = false; |
| 3291 |
0 |
SequenceGroup sg = viewport.getSelectionGroup(); |
| 3292 |
0 |
if (!toggleSeqs && !toggleCols) |
| 3293 |
|
{ |
| 3294 |
|
|
| 3295 |
|
|
| 3296 |
|
|
| 3297 |
0 |
if (viewport.hasSelectedColumns() || (sg != null && sg.getSize() > 0 |
| 3298 |
|
&& sg.getStartRes() <= sg.getEndRes())) |
| 3299 |
|
{ |
| 3300 |
|
|
| 3301 |
|
|
| 3302 |
0 |
if (sg != null) |
| 3303 |
|
{ |
| 3304 |
0 |
invertSequenceMenuItem_actionPerformed(null); |
| 3305 |
0 |
sg = viewport.getSelectionGroup(); |
| 3306 |
0 |
toggleSeqs = true; |
| 3307 |
|
|
| 3308 |
|
} |
| 3309 |
0 |
viewport.expandColSelection(sg, true); |
| 3310 |
|
|
| 3311 |
|
|
| 3312 |
0 |
invertColSel_actionPerformed(null); |
| 3313 |
0 |
toggleCols = true; |
| 3314 |
|
} |
| 3315 |
|
} |
| 3316 |
|
|
| 3317 |
0 |
if (toggleSeqs) |
| 3318 |
|
{ |
| 3319 |
0 |
if (sg != null && sg.getSize() != viewport.getAlignment().getHeight()) |
| 3320 |
|
{ |
| 3321 |
0 |
hideSelSequences_actionPerformed(null); |
| 3322 |
0 |
hide = true; |
| 3323 |
|
} |
| 3324 |
0 |
else if (!(toggleCols && viewport.hasSelectedColumns())) |
| 3325 |
|
{ |
| 3326 |
0 |
showAllSeqs_actionPerformed(null); |
| 3327 |
|
} |
| 3328 |
|
} |
| 3329 |
|
|
| 3330 |
0 |
if (toggleCols) |
| 3331 |
|
{ |
| 3332 |
0 |
if (viewport.hasSelectedColumns()) |
| 3333 |
|
{ |
| 3334 |
0 |
hideSelColumns_actionPerformed(null); |
| 3335 |
0 |
if (!toggleSeqs) |
| 3336 |
|
{ |
| 3337 |
0 |
viewport.setSelectionGroup(sg); |
| 3338 |
|
} |
| 3339 |
|
} |
| 3340 |
0 |
else if (!hide) |
| 3341 |
|
{ |
| 3342 |
0 |
showAllColumns_actionPerformed(null); |
| 3343 |
|
} |
| 3344 |
|
} |
| 3345 |
|
} |
| 3346 |
|
|
| 3347 |
|
|
| 3348 |
|
|
| 3349 |
|
|
| 3350 |
|
@see |
| 3351 |
|
|
| 3352 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 3353 |
0 |
@Override... |
| 3354 |
|
public void hideAllButSelection_actionPerformed(ActionEvent e) |
| 3355 |
|
{ |
| 3356 |
0 |
toggleHiddenRegions(false, false); |
| 3357 |
0 |
viewport.sendSelection(); |
| 3358 |
|
} |
| 3359 |
|
|
| 3360 |
|
|
| 3361 |
|
|
| 3362 |
|
|
| 3363 |
|
@see |
| 3364 |
|
|
| 3365 |
|
|
| 3366 |
|
|
| |
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
| 3367 |
0 |
@Override... |
| 3368 |
|
public void hideAllSelection_actionPerformed(ActionEvent e) |
| 3369 |
|
{ |
| 3370 |
0 |
SequenceGroup sg = viewport.getSelectionGroup(); |
| 3371 |
0 |
viewport.expandColSelection(sg, false); |
| 3372 |
0 |
viewport.hideAllSelectedSeqs(); |
| 3373 |
0 |
viewport.hideSelectedColumns(); |
| 3374 |
0 |
alignPanel.updateLayout(); |
| 3375 |
0 |
alignPanel.paintAlignment(true, true); |
| 3376 |
0 |
viewport.sendSelection(); |
| 3377 |
|
} |
| 3378 |
|
|
| 3379 |
|
|
| 3380 |
|
|
| 3381 |
|
|
| 3382 |
|
@see |
| 3383 |
|
|
| 3384 |
|
|
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 3385 |
0 |
@Override... |
| 3386 |
|
public void showAllhidden_actionPerformed(ActionEvent e) |
| 3387 |
|
{ |
| 3388 |
0 |
viewport.showAllHiddenColumns(); |
| 3389 |
0 |
viewport.showAllHiddenSeqs(); |
| 3390 |
0 |
alignPanel.paintAlignment(true, true); |
| 3391 |
0 |
viewport.sendSelection(); |
| 3392 |
|
} |
| 3393 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 3394 |
2 |
@Override... |
| 3395 |
|
public void hideSelColumns_actionPerformed(ActionEvent e) |
| 3396 |
|
{ |
| 3397 |
2 |
viewport.hideSelectedColumns(); |
| 3398 |
2 |
alignPanel.updateLayout(); |
| 3399 |
2 |
alignPanel.paintAlignment(true, true); |
| 3400 |
2 |
viewport.sendSelection(); |
| 3401 |
|
} |
| 3402 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 3403 |
0 |
@Override... |
| 3404 |
|
public void hiddenMarkers_actionPerformed(ActionEvent e) |
| 3405 |
|
{ |
| 3406 |
0 |
viewport.setShowHiddenMarkers(hiddenMarkers.isSelected()); |
| 3407 |
0 |
repaint(); |
| 3408 |
|
} |
| 3409 |
|
|
| 3410 |
|
|
| 3411 |
|
|
| 3412 |
|
|
| 3413 |
|
@param |
| 3414 |
|
|
| 3415 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 3416 |
0 |
@Override... |
| 3417 |
|
protected void scaleAbove_actionPerformed(ActionEvent e) |
| 3418 |
|
{ |
| 3419 |
0 |
viewport.setScaleAboveWrapped(scaleAbove.isSelected()); |
| 3420 |
0 |
alignPanel.updateLayout(); |
| 3421 |
0 |
alignPanel.paintAlignment(true, false); |
| 3422 |
|
} |
| 3423 |
|
|
| 3424 |
|
|
| 3425 |
|
|
| 3426 |
|
|
| 3427 |
|
@param |
| 3428 |
|
|
| 3429 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 3430 |
0 |
@Override... |
| 3431 |
|
protected void scaleLeft_actionPerformed(ActionEvent e) |
| 3432 |
|
{ |
| 3433 |
0 |
viewport.setScaleLeftWrapped(scaleLeft.isSelected()); |
| 3434 |
0 |
alignPanel.updateLayout(); |
| 3435 |
0 |
alignPanel.paintAlignment(true, false); |
| 3436 |
|
} |
| 3437 |
|
|
| 3438 |
|
|
| 3439 |
|
|
| 3440 |
|
|
| 3441 |
|
@param |
| 3442 |
|
|
| 3443 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 3444 |
0 |
@Override... |
| 3445 |
|
protected void scaleRight_actionPerformed(ActionEvent e) |
| 3446 |
|
{ |
| 3447 |
0 |
viewport.setScaleRightWrapped(scaleRight.isSelected()); |
| 3448 |
0 |
alignPanel.updateLayout(); |
| 3449 |
0 |
alignPanel.paintAlignment(true, false); |
| 3450 |
|
} |
| 3451 |
|
|
| 3452 |
|
|
| 3453 |
|
|
| 3454 |
|
|
| 3455 |
|
@param |
| 3456 |
|
|
| 3457 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 3458 |
0 |
@Override... |
| 3459 |
|
public void viewBoxesMenuItem_actionPerformed(ActionEvent e) |
| 3460 |
|
{ |
| 3461 |
0 |
viewport.setShowBoxes(viewBoxesMenuItem.isSelected()); |
| 3462 |
0 |
alignPanel.paintAlignment(false, false); |
| 3463 |
|
} |
| 3464 |
|
|
| 3465 |
|
|
| 3466 |
|
|
| 3467 |
|
|
| 3468 |
|
@param |
| 3469 |
|
|
| 3470 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 3471 |
0 |
@Override... |
| 3472 |
|
public void viewTextMenuItem_actionPerformed(ActionEvent e) |
| 3473 |
|
{ |
| 3474 |
0 |
viewport.setShowText(viewTextMenuItem.isSelected()); |
| 3475 |
0 |
alignPanel.paintAlignment(false, false); |
| 3476 |
|
} |
| 3477 |
|
|
| 3478 |
|
|
| 3479 |
|
|
| 3480 |
|
|
| 3481 |
|
@param |
| 3482 |
|
|
| 3483 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 3484 |
0 |
@Override... |
| 3485 |
|
protected void renderGapsMenuItem_actionPerformed(ActionEvent e) |
| 3486 |
|
{ |
| 3487 |
0 |
viewport.setRenderGaps(renderGapsMenuItem.isSelected()); |
| 3488 |
0 |
alignPanel.paintAlignment(false, false); |
| 3489 |
|
} |
| 3490 |
|
|
| 3491 |
|
public FeatureSettings featureSettings; |
| 3492 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 3493 |
4 |
@Override... |
| 3494 |
|
public FeatureSettingsControllerI getFeatureSettingsUI() |
| 3495 |
|
{ |
| 3496 |
4 |
return featureSettings; |
| 3497 |
|
} |
| 3498 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 3499 |
0 |
@Override... |
| 3500 |
|
public void featureSettings_actionPerformed(ActionEvent e) |
| 3501 |
|
{ |
| 3502 |
0 |
showFeatureSettingsUI(); |
| 3503 |
|
} |
| 3504 |
|
|
| |
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 3 |
Complexity Density: 0.38 |
|
| 3505 |
0 |
@Override... |
| 3506 |
|
public FeatureSettingsControllerI showFeatureSettingsUI() |
| 3507 |
|
{ |
| 3508 |
0 |
if (featureSettings != null) |
| 3509 |
|
{ |
| 3510 |
0 |
featureSettings.closeOldSettings(); |
| 3511 |
0 |
featureSettings = null; |
| 3512 |
|
} |
| 3513 |
0 |
if (!showSeqFeatures.isSelected()) |
| 3514 |
|
{ |
| 3515 |
|
|
| 3516 |
0 |
showSeqFeatures.setSelected(true); |
| 3517 |
0 |
showSeqFeatures_actionPerformed(null); |
| 3518 |
|
} |
| 3519 |
0 |
featureSettings = new FeatureSettings(this); |
| 3520 |
0 |
return featureSettings; |
| 3521 |
|
} |
| 3522 |
|
|
| 3523 |
|
|
| 3524 |
|
|
| 3525 |
|
|
| 3526 |
|
@param |
| 3527 |
|
|
| 3528 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 3529 |
0 |
@Override... |
| 3530 |
|
public void showSeqFeatures_actionPerformed(ActionEvent evt) |
| 3531 |
|
{ |
| 3532 |
0 |
viewport.setShowSequenceFeatures(showSeqFeatures.isSelected()); |
| 3533 |
0 |
alignPanel.paintAlignment(true, true); |
| 3534 |
|
} |
| 3535 |
|
|
| 3536 |
|
|
| 3537 |
|
|
| 3538 |
|
|
| 3539 |
|
|
| 3540 |
|
|
| 3541 |
|
|
| 3542 |
|
|
| 3543 |
|
@param |
| 3544 |
|
|
| |
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
| 3545 |
0 |
@Override... |
| 3546 |
|
public void annotationPanelMenuItem_actionPerformed(ActionEvent e) |
| 3547 |
|
{ |
| 3548 |
0 |
final boolean setVisible = annotationPanelMenuItem.isSelected(); |
| 3549 |
0 |
viewport.setShowAnnotation(setVisible); |
| 3550 |
0 |
this.showAllSeqAnnotations.setEnabled(setVisible); |
| 3551 |
0 |
this.hideAllSeqAnnotations.setEnabled(setVisible); |
| 3552 |
0 |
this.showAllAlAnnotations.setEnabled(setVisible); |
| 3553 |
0 |
this.hideAllAlAnnotations.setEnabled(setVisible); |
| 3554 |
0 |
alignPanel.updateLayout(); |
| 3555 |
|
} |
| 3556 |
|
|
| |
|
| 0% |
Uncovered Elements: 22 (22) |
Complexity: 2 |
Complexity Density: 0.1 |
|
| 3557 |
0 |
@Override... |
| 3558 |
|
public void alignmentProperties() |
| 3559 |
|
{ |
| 3560 |
0 |
JComponent pane; |
| 3561 |
0 |
StringBuffer contents = new AlignmentProperties(viewport.getAlignment()) |
| 3562 |
|
|
| 3563 |
|
.formatAsHtml(); |
| 3564 |
0 |
String content = MessageManager.formatMessage("label.html_content", |
| 3565 |
|
new Object[] |
| 3566 |
|
{ contents.toString() }); |
| 3567 |
0 |
contents = null; |
| 3568 |
|
|
| 3569 |
0 |
if (Platform.isJS()) |
| 3570 |
|
{ |
| 3571 |
0 |
JLabel textLabel = new JLabel(); |
| 3572 |
0 |
textLabel.setText(content); |
| 3573 |
0 |
textLabel.setBackground(Color.WHITE); |
| 3574 |
|
|
| 3575 |
0 |
pane = new JPanel(new BorderLayout()); |
| 3576 |
0 |
((JPanel) pane).setOpaque(true); |
| 3577 |
0 |
pane.setBackground(Color.WHITE); |
| 3578 |
0 |
((JPanel) pane).add(textLabel, BorderLayout.NORTH); |
| 3579 |
|
} |
| 3580 |
|
else |
| 3581 |
|
|
| 3582 |
|
|
| 3583 |
|
|
| 3584 |
|
|
| 3585 |
|
|
| 3586 |
|
{ |
| 3587 |
0 |
JEditorPane editPane = new JEditorPane("text/html", ""); |
| 3588 |
0 |
editPane.setEditable(false); |
| 3589 |
0 |
editPane.setText(content); |
| 3590 |
0 |
pane = editPane; |
| 3591 |
|
} |
| 3592 |
|
|
| 3593 |
0 |
JInternalFrame frame = new JInternalFrame(); |
| 3594 |
0 |
frame.setFrameIcon(null); |
| 3595 |
0 |
frame.getContentPane().add(new JScrollPane(pane)); |
| 3596 |
|
|
| 3597 |
0 |
Desktop.addInternalFrame(frame, MessageManager |
| 3598 |
|
.formatMessage("label.alignment_properties", new Object[] |
| 3599 |
|
{ getTitle() }), 500, 400); |
| 3600 |
|
} |
| 3601 |
|
|
| 3602 |
|
|
| 3603 |
|
|
| 3604 |
|
|
| 3605 |
|
@param |
| 3606 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 3607 |
30 |
@Override... |
| 3608 |
|
public void overviewMenuItem_actionPerformed(ActionEvent e) |
| 3609 |
|
{ |
| 3610 |
30 |
boolean showHiddenRegions = Cache |
| 3611 |
|
.getDefault(Preferences.SHOW_OV_HIDDEN_AT_START, false); |
| 3612 |
30 |
openOverviewPanel(showHiddenRegions); |
| 3613 |
|
} |
| 3614 |
|
|
| |
|
| 90% |
Uncovered Elements: 2 (20) |
Complexity: 3 |
Complexity Density: 0.19 |
|
| 3615 |
43 |
public OverviewPanel openOverviewPanel(boolean showHidden)... |
| 3616 |
|
{ |
| 3617 |
43 |
if (alignPanel.overviewPanel != null) |
| 3618 |
|
{ |
| 3619 |
0 |
return alignPanel.overviewPanel; |
| 3620 |
|
} |
| 3621 |
43 |
JInternalFrame frame = new JInternalFrame(); |
| 3622 |
43 |
frame.setFrameIcon(null); |
| 3623 |
43 |
final OverviewPanel overview = new OverviewPanel(alignPanel, frame, |
| 3624 |
|
showHidden); |
| 3625 |
43 |
frame.setContentPane(overview); |
| 3626 |
|
|
| 3627 |
43 |
alignPanel.setOverviewPanel(overview); |
| 3628 |
43 |
alignPanel.setOverviewTitle(this); |
| 3629 |
|
|
| 3630 |
43 |
Desktop.addInternalFrame(frame, overview.getTitle(), true, |
| 3631 |
|
frame.getWidth(), frame.getHeight(), true, true); |
| 3632 |
43 |
frame.pack(); |
| 3633 |
43 |
frame.setLayer(JLayeredPane.PALETTE_LAYER); |
| 3634 |
43 |
final AlignmentPanel thePanel = this.alignPanel; |
| 3635 |
43 |
frame.addInternalFrameListener( |
| 3636 |
|
new javax.swing.event.InternalFrameAdapter() |
| 3637 |
|
{ |
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 3638 |
39 |
@Override... |
| 3639 |
|
public void internalFrameClosed( |
| 3640 |
|
javax.swing.event.InternalFrameEvent evt) |
| 3641 |
|
{ |
| 3642 |
39 |
overview.dispose(); |
| 3643 |
39 |
thePanel.setOverviewPanel(null); |
| 3644 |
|
} |
| 3645 |
|
}); |
| 3646 |
43 |
if (getKeyListeners().length > 0) |
| 3647 |
|
{ |
| 3648 |
15 |
frame.addKeyListener(getKeyListeners()[0]); |
| 3649 |
|
} |
| 3650 |
|
|
| 3651 |
43 |
return overview; |
| 3652 |
|
} |
| 3653 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 3654 |
0 |
@Override... |
| 3655 |
|
public void textColour_actionPerformed() |
| 3656 |
|
{ |
| 3657 |
0 |
new TextColourChooser().chooseColour(alignPanel, null); |
| 3658 |
|
} |
| 3659 |
|
|
| 3660 |
|
|
| 3661 |
|
|
| 3662 |
|
|
| 3663 |
|
|
| 3664 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 3665 |
0 |
@Override... |
| 3666 |
|
public void annotationColour_actionPerformed() |
| 3667 |
|
{ |
| 3668 |
0 |
new AnnotationColourChooser(viewport, alignPanel); |
| 3669 |
|
} |
| 3670 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 3671 |
0 |
@Override... |
| 3672 |
|
public void annotationColumn_actionPerformed(ActionEvent e) |
| 3673 |
|
{ |
| 3674 |
0 |
new AnnotationColumnChooser(viewport, alignPanel); |
| 3675 |
|
} |
| 3676 |
|
|
| 3677 |
|
|
| 3678 |
|
|
| 3679 |
|
|
| 3680 |
|
|
| 3681 |
|
|
| 3682 |
|
@param |
| 3683 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 3684 |
3 |
@Override... |
| 3685 |
|
public void applyToAllGroups_actionPerformed(boolean selected) |
| 3686 |
|
{ |
| 3687 |
3 |
viewport.setColourAppliesToAllGroups(selected); |
| 3688 |
|
} |
| 3689 |
|
|
| 3690 |
|
|
| 3691 |
|
|
| 3692 |
|
|
| 3693 |
|
@param |
| 3694 |
|
|
| 3695 |
|
|
| |
|
| 57.1% |
Uncovered Elements: 3 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 3696 |
15 |
@Override... |
| 3697 |
|
public void changeColour_actionPerformed(String name) |
| 3698 |
|
{ |
| 3699 |
|
|
| 3700 |
|
|
| 3701 |
|
|
| 3702 |
|
|
| 3703 |
15 |
if (ResidueColourScheme.USER_DEFINED_MENU.equals(name)) |
| 3704 |
|
{ |
| 3705 |
0 |
new UserDefinedColours(alignPanel); |
| 3706 |
0 |
return; |
| 3707 |
|
} |
| 3708 |
|
|
| 3709 |
|
|
| 3710 |
|
|
| 3711 |
|
|
| 3712 |
15 |
ColourSchemeI cs = ColourSchemes.getInstance().getColourScheme(name, |
| 3713 |
|
viewport, viewport.getAlignment(), |
| 3714 |
|
viewport.getHiddenRepSequences()); |
| 3715 |
15 |
changeColour(cs); |
| 3716 |
|
} |
| 3717 |
|
|
| 3718 |
|
|
| 3719 |
|
|
| 3720 |
|
|
| 3721 |
|
@param |
| 3722 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 3723 |
186 |
@Override... |
| 3724 |
|
public void changeColour(ColourSchemeI cs) |
| 3725 |
|
{ |
| 3726 |
|
|
| 3727 |
186 |
ColourMenuHelper.setColourSelected(colourMenu, cs); |
| 3728 |
|
|
| 3729 |
186 |
viewport.setGlobalColourScheme(cs); |
| 3730 |
|
|
| 3731 |
186 |
alignPanel.paintAlignment(true, true); |
| 3732 |
|
} |
| 3733 |
|
|
| 3734 |
|
|
| 3735 |
|
|
| 3736 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 3737 |
6 |
@Override... |
| 3738 |
|
protected void modifyPID_actionPerformed() |
| 3739 |
|
{ |
| 3740 |
6 |
SliderPanel.setPIDSliderSource(alignPanel, viewport.getResidueShading(), |
| 3741 |
|
alignPanel.getViewName()); |
| 3742 |
6 |
SliderPanel.showPIDSlider(); |
| 3743 |
|
} |
| 3744 |
|
|
| 3745 |
|
|
| 3746 |
|
|
| 3747 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 3748 |
6 |
@Override... |
| 3749 |
|
protected void modifyConservation_actionPerformed() |
| 3750 |
|
{ |
| 3751 |
6 |
SliderPanel.setConservationSlider(alignPanel, |
| 3752 |
|
viewport.getResidueShading(), alignPanel.getViewName()); |
| 3753 |
6 |
SliderPanel.showConservationSlider(); |
| 3754 |
|
} |
| 3755 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 3756 |
0 |
@Override... |
| 3757 |
|
protected void modifyConsensusSecondaryStructureThreshold_actionPerformed() |
| 3758 |
|
{ |
| 3759 |
0 |
SliderPanel.setConsensusSecondaryStructureSlider(alignPanel, |
| 3760 |
|
viewport.getResidueShading(), alignPanel.getViewName()); |
| 3761 |
0 |
SliderPanel.showConsensusSecondaryStructureSlider(); |
| 3762 |
|
} |
| 3763 |
|
|
| 3764 |
|
|
| 3765 |
|
|
| 3766 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
| 3767 |
8 |
@Override... |
| 3768 |
|
public void conservationMenuItem_actionPerformed(boolean selected) |
| 3769 |
|
{ |
| 3770 |
8 |
modifyConservation.setEnabled(selected); |
| 3771 |
8 |
viewport.setConservationSelected(selected); |
| 3772 |
8 |
viewport.getResidueShading().setConservationApplied(selected); |
| 3773 |
|
|
| 3774 |
8 |
changeColour(viewport.getGlobalColourScheme()); |
| 3775 |
8 |
if (selected) |
| 3776 |
|
{ |
| 3777 |
6 |
modifyConservation_actionPerformed(); |
| 3778 |
|
} |
| 3779 |
|
else |
| 3780 |
|
{ |
| 3781 |
2 |
SliderPanel.hideConservationSlider(); |
| 3782 |
|
} |
| 3783 |
|
} |
| 3784 |
|
|
| |
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
| 3785 |
0 |
@Override... |
| 3786 |
|
public void colourByConsensusSecondaryStructureMenuItem_actionPerformed( |
| 3787 |
|
boolean selected) |
| 3788 |
|
{ |
| 3789 |
0 |
modifyConsensusSecondaryStructureThreshold.setEnabled(selected); |
| 3790 |
0 |
viewport.setByConsensusSecondaryStructureSelected(selected); |
| 3791 |
0 |
viewport.getResidueShading() |
| 3792 |
|
.setConsensusSecondaryStructureColouring(selected); |
| 3793 |
|
|
| 3794 |
0 |
changeColour(viewport.getGlobalColourScheme()); |
| 3795 |
0 |
if (selected) |
| 3796 |
|
{ |
| 3797 |
0 |
modifyConsensusSecondaryStructureThreshold_actionPerformed(); |
| 3798 |
|
} |
| 3799 |
|
else |
| 3800 |
|
{ |
| 3801 |
0 |
SliderPanel.hideConsensusSecondaryStructureSlider(); |
| 3802 |
|
} |
| 3803 |
|
} |
| 3804 |
|
|
| 3805 |
|
|
| 3806 |
|
|
| 3807 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 3 |
Complexity Density: 0.38 |
|
| 3808 |
9 |
@Override... |
| 3809 |
|
public void abovePIDThreshold_actionPerformed(boolean selected) |
| 3810 |
|
{ |
| 3811 |
9 |
modifyPID.setEnabled(selected); |
| 3812 |
9 |
viewport.setAbovePIDThreshold(selected); |
| 3813 |
9 |
if (!selected) |
| 3814 |
|
{ |
| 3815 |
3 |
viewport.getResidueShading().setThreshold(0, |
| 3816 |
|
viewport.isIgnoreGapsConsensus()); |
| 3817 |
|
} |
| 3818 |
|
|
| 3819 |
9 |
changeColour(viewport.getGlobalColourScheme()); |
| 3820 |
9 |
if (selected) |
| 3821 |
|
{ |
| 3822 |
6 |
modifyPID_actionPerformed(); |
| 3823 |
|
} |
| 3824 |
|
else |
| 3825 |
|
{ |
| 3826 |
3 |
SliderPanel.hidePIDSlider(); |
| 3827 |
|
} |
| 3828 |
|
} |
| 3829 |
|
|
| 3830 |
|
|
| 3831 |
|
|
| 3832 |
|
|
| 3833 |
|
@param |
| 3834 |
|
|
| 3835 |
|
|
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 3836 |
0 |
@Override... |
| 3837 |
|
public void sortPairwiseMenuItem_actionPerformed(ActionEvent e) |
| 3838 |
|
{ |
| 3839 |
0 |
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); |
| 3840 |
0 |
AlignmentSorter.sortByPID(viewport.getAlignment(), |
| 3841 |
|
viewport.getAlignment().getSequenceAt(0)); |
| 3842 |
0 |
addHistoryItem(new OrderCommand("Pairwise Sort", oldOrder, |
| 3843 |
|
viewport.getAlignment())); |
| 3844 |
0 |
alignPanel.paintAlignment(true, false); |
| 3845 |
|
} |
| 3846 |
|
|
| 3847 |
|
|
| 3848 |
|
|
| 3849 |
|
|
| 3850 |
|
@param |
| 3851 |
|
|
| 3852 |
|
|
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 3853 |
0 |
@Override... |
| 3854 |
|
public void sortIDMenuItem_actionPerformed(ActionEvent e) |
| 3855 |
|
{ |
| 3856 |
0 |
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); |
| 3857 |
0 |
AlignmentSorter.sortByID(viewport.getAlignment()); |
| 3858 |
0 |
addHistoryItem( |
| 3859 |
|
new OrderCommand("ID Sort", oldOrder, viewport.getAlignment())); |
| 3860 |
0 |
alignPanel.paintAlignment(true, false); |
| 3861 |
|
} |
| 3862 |
|
|
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 3863 |
0 |
@Override... |
| 3864 |
|
protected void sortDescriptionMenuItem_actionPerformed(ActionEvent e) |
| 3865 |
|
{ |
| 3866 |
0 |
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); |
| 3867 |
0 |
AlignmentSorter.sortByDescription(viewport.getAlignment()); |
| 3868 |
0 |
addHistoryItem(new OrderCommand("Description Sort", oldOrder, |
| 3869 |
|
viewport.getAlignment())); |
| 3870 |
0 |
alignPanel.paintAlignment(true, false); |
| 3871 |
|
} |
| 3872 |
|
|
| 3873 |
|
|
| 3874 |
|
|
| 3875 |
|
|
| 3876 |
|
@param |
| 3877 |
|
|
| 3878 |
|
|
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 3879 |
0 |
@Override... |
| 3880 |
|
public void sortLengthMenuItem_actionPerformed(ActionEvent e) |
| 3881 |
|
{ |
| 3882 |
0 |
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); |
| 3883 |
0 |
AlignmentSorter.sortByLength(viewport.getAlignment()); |
| 3884 |
0 |
addHistoryItem(new OrderCommand("Length Sort", oldOrder, |
| 3885 |
|
viewport.getAlignment())); |
| 3886 |
0 |
alignPanel.paintAlignment(true, false); |
| 3887 |
|
} |
| 3888 |
|
|
| 3889 |
|
|
| 3890 |
|
|
| 3891 |
|
|
| 3892 |
|
@param |
| 3893 |
|
|
| 3894 |
|
|
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 3895 |
0 |
@Override... |
| 3896 |
|
public void sortGroupMenuItem_actionPerformed(ActionEvent e) |
| 3897 |
|
{ |
| 3898 |
0 |
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); |
| 3899 |
0 |
AlignmentSorter.sortByGroup(viewport.getAlignment()); |
| 3900 |
0 |
addHistoryItem(new OrderCommand("Group Sort", oldOrder, |
| 3901 |
|
viewport.getAlignment())); |
| 3902 |
|
|
| 3903 |
0 |
alignPanel.paintAlignment(true, false); |
| 3904 |
|
} |
| 3905 |
|
|
| 3906 |
|
|
| 3907 |
|
|
| 3908 |
|
|
| 3909 |
|
@param |
| 3910 |
|
|
| 3911 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 3912 |
0 |
@Override... |
| 3913 |
|
public void removeRedundancyMenuItem_actionPerformed(ActionEvent e) |
| 3914 |
|
{ |
| 3915 |
0 |
new RedundancyPanel(alignPanel, this); |
| 3916 |
|
} |
| 3917 |
|
|
| 3918 |
|
|
| 3919 |
|
|
| 3920 |
|
|
| 3921 |
|
@param |
| 3922 |
|
|
| 3923 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 3 |
Complexity Density: 1 |
|
| 3924 |
0 |
@Override... |
| 3925 |
|
public void pairwiseAlignmentMenuItem_actionPerformed(ActionEvent e) |
| 3926 |
|
{ |
| 3927 |
0 |
if ((viewport.getSelectionGroup() == null) |
| 3928 |
|
|| (viewport.getSelectionGroup().getSize() < 2)) |
| 3929 |
|
{ |
| 3930 |
0 |
JvOptionPane.showInternalMessageDialog(this, |
| 3931 |
|
MessageManager.getString( |
| 3932 |
|
"label.you_must_select_least_two_sequences"), |
| 3933 |
|
MessageManager.getString("label.invalid_selection"), |
| 3934 |
|
JvOptionPane.WARNING_MESSAGE); |
| 3935 |
|
} |
| 3936 |
|
else |
| 3937 |
|
{ |
| 3938 |
0 |
new Thread(new Runnable() |
| 3939 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 3940 |
0 |
@Override... |
| 3941 |
|
public void run() |
| 3942 |
|
{ |
| 3943 |
0 |
JInternalFrame frame = new JInternalFrame(); |
| 3944 |
0 |
frame.setFrameIcon(null); |
| 3945 |
0 |
frame.setContentPane(new PairwiseAlignPanel(viewport)); |
| 3946 |
0 |
Desktop.addInternalFrame(frame, |
| 3947 |
|
MessageManager.getString("action.pairwise_alignment"), |
| 3948 |
|
600, 500); |
| 3949 |
|
} |
| 3950 |
|
}).start(); |
| 3951 |
|
|
| 3952 |
|
} |
| 3953 |
|
} |
| 3954 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 3955 |
0 |
@Override... |
| 3956 |
|
public void autoCalculate_actionPerformed(ActionEvent e) |
| 3957 |
|
{ |
| 3958 |
0 |
viewport.autoCalculateConsensus = autoCalculate.isSelected(); |
| 3959 |
0 |
if (viewport.autoCalculateConsensus) |
| 3960 |
|
{ |
| 3961 |
0 |
viewport.firePropertyChange("alignment", null, |
| 3962 |
|
viewport.getAlignment().getSequences()); |
| 3963 |
|
} |
| 3964 |
|
} |
| 3965 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 3966 |
0 |
@Override... |
| 3967 |
|
public void sortByTreeOption_actionPerformed(ActionEvent e) |
| 3968 |
|
{ |
| 3969 |
0 |
viewport.sortByTree = sortByTree.isSelected(); |
| 3970 |
|
} |
| 3971 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 3972 |
0 |
@Override... |
| 3973 |
|
protected void listenToViewSelections_actionPerformed(ActionEvent e) |
| 3974 |
|
{ |
| 3975 |
0 |
viewport.followSelection = listenToViewSelections.isSelected(); |
| 3976 |
|
} |
| 3977 |
|
|
| 3978 |
|
|
| 3979 |
|
|
| 3980 |
|
|
| 3981 |
|
@param |
| 3982 |
|
|
| 3983 |
|
@param |
| 3984 |
|
|
| 3985 |
|
@param |
| 3986 |
|
|
| 3987 |
|
|
| |
|
| 0% |
Uncovered Elements: 21 (21) |
Complexity: 8 |
Complexity Density: 0.53 |
|
| 3988 |
0 |
void newTreePanel(String type, String modelName,... |
| 3989 |
|
SimilarityParamsI options, boolean isAnnotationBased) |
| 3990 |
|
{ |
| 3991 |
0 |
String frameTitle = ""; |
| 3992 |
0 |
TreePanel tp; |
| 3993 |
|
|
| 3994 |
0 |
boolean onSelection = false; |
| 3995 |
0 |
if (viewport.getSelectionGroup() != null |
| 3996 |
|
&& viewport.getSelectionGroup().getSize() > 0) |
| 3997 |
|
{ |
| 3998 |
0 |
SequenceGroup sg = viewport.getSelectionGroup(); |
| 3999 |
|
|
| 4000 |
|
|
| 4001 |
0 |
for (SequenceI _s : sg.getSequences()) |
| 4002 |
|
{ |
| 4003 |
0 |
if (_s.getLength() < sg.getEndRes()) |
| 4004 |
|
{ |
| 4005 |
0 |
JvOptionPane.showMessageDialog(Desktop.desktop, |
| 4006 |
|
MessageManager.getString( |
| 4007 |
|
"label.selected_region_to_tree_may_only_contain_residues_or_gaps"), |
| 4008 |
|
MessageManager.getString( |
| 4009 |
|
"label.sequences_selection_not_aligned"), |
| 4010 |
|
JvOptionPane.WARNING_MESSAGE); |
| 4011 |
|
|
| 4012 |
0 |
return; |
| 4013 |
|
} |
| 4014 |
|
} |
| 4015 |
0 |
onSelection = true; |
| 4016 |
|
} |
| 4017 |
|
else |
| 4018 |
|
{ |
| 4019 |
|
|
| 4020 |
|
|
| 4021 |
|
|
| 4022 |
0 |
if ((viewport.getAlignment().getHeight() < 2 && !isAnnotationBased) |
| 4023 |
|
|| (viewport.getAlignment().getHeight() < 1 |
| 4024 |
|
&& isAnnotationBased)) |
| 4025 |
|
{ |
| 4026 |
0 |
return; |
| 4027 |
|
} |
| 4028 |
|
} |
| 4029 |
|
|
| 4030 |
0 |
tp = new TreePanel(alignPanel, type, modelName, options); |
| 4031 |
|
|
| 4032 |
0 |
frameTitle = formCalculationTitle(tp.getPanelTitle(), onSelection, |
| 4033 |
|
this.title); |
| 4034 |
|
|
| 4035 |
0 |
Desktop.addInternalFrame(tp, frameTitle, 600, 500); |
| 4036 |
|
} |
| 4037 |
|
|
| 4038 |
|
|
| 4039 |
|
|
| 4040 |
|
@param |
| 4041 |
|
|
| 4042 |
|
@param |
| 4043 |
|
|
| 4044 |
|
@param |
| 4045 |
|
|
| 4046 |
|
@param |
| 4047 |
|
|
| 4048 |
|
@return |
| 4049 |
|
|
| |
|
| 81.8% |
Uncovered Elements: 2 (11) |
Complexity: 3 |
Complexity Density: 0.43 |
|
| 4050 |
2 |
public String formCalculationTitle(String panelTitle, boolean onSelection,... |
| 4051 |
|
String title) |
| 4052 |
|
{ |
| 4053 |
2 |
String frameTitle = panelTitle; |
| 4054 |
|
|
| 4055 |
2 |
frameTitle += (onSelection ? " on region" : ""); |
| 4056 |
|
|
| 4057 |
2 |
frameTitle += " from "; |
| 4058 |
|
|
| 4059 |
2 |
if (viewport.getViewName() != null) |
| 4060 |
|
{ |
| 4061 |
2 |
frameTitle += viewport.getViewName() + " of "; |
| 4062 |
|
} |
| 4063 |
|
|
| 4064 |
2 |
frameTitle += title; |
| 4065 |
2 |
return frameTitle; |
| 4066 |
|
} |
| 4067 |
|
|
| 4068 |
|
|
| 4069 |
|
|
| 4070 |
|
|
| 4071 |
|
@param |
| 4072 |
|
|
| 4073 |
|
@param |
| 4074 |
|
|
| 4075 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 4076 |
0 |
public void addSortByOrderMenuItem(String title,... |
| 4077 |
|
final AlignmentOrder order) |
| 4078 |
|
{ |
| 4079 |
0 |
final JMenuItem item = new JMenuItem(MessageManager |
| 4080 |
|
.formatMessage("action.by_title_param", new Object[] |
| 4081 |
|
{ title })); |
| 4082 |
0 |
sort.add(item); |
| 4083 |
0 |
item.addActionListener(new java.awt.event.ActionListener() |
| 4084 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 4085 |
0 |
@Override... |
| 4086 |
|
public void actionPerformed(ActionEvent e) |
| 4087 |
|
{ |
| 4088 |
0 |
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); |
| 4089 |
|
|
| 4090 |
|
|
| 4091 |
|
|
| 4092 |
0 |
AlignmentSorter.sortBy(viewport.getAlignment(), order); |
| 4093 |
|
|
| 4094 |
0 |
addHistoryItem(new OrderCommand(order.getName(), oldOrder, |
| 4095 |
|
viewport.getAlignment())); |
| 4096 |
|
|
| 4097 |
0 |
alignPanel.paintAlignment(true, false); |
| 4098 |
|
} |
| 4099 |
|
}); |
| 4100 |
|
} |
| 4101 |
|
|
| 4102 |
|
|
| 4103 |
|
|
| 4104 |
|
|
| 4105 |
|
@param |
| 4106 |
|
|
| 4107 |
|
@param |
| 4108 |
|
|
| 4109 |
|
|
| 4110 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 4111 |
4 |
public void addSortByAnnotScoreMenuItem(JMenu sort,... |
| 4112 |
|
final String scoreLabel) |
| 4113 |
|
{ |
| 4114 |
4 |
final JMenuItem item = new JMenuItem(scoreLabel); |
| 4115 |
4 |
sort.add(item); |
| 4116 |
4 |
item.addActionListener(new java.awt.event.ActionListener() |
| 4117 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 4118 |
0 |
@Override... |
| 4119 |
|
public void actionPerformed(ActionEvent e) |
| 4120 |
|
{ |
| 4121 |
0 |
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); |
| 4122 |
0 |
AlignmentSorter.sortByAnnotationScore(scoreLabel, |
| 4123 |
|
viewport.getAlignment()); |
| 4124 |
0 |
addHistoryItem(new OrderCommand("Sort by " + scoreLabel, oldOrder, |
| 4125 |
|
viewport.getAlignment())); |
| 4126 |
0 |
alignPanel.paintAlignment(true, false); |
| 4127 |
|
} |
| 4128 |
|
}); |
| 4129 |
|
} |
| 4130 |
|
|
| 4131 |
|
|
| 4132 |
|
|
| 4133 |
|
|
| 4134 |
|
|
| 4135 |
|
protected int _annotationScoreVectorHash; |
| 4136 |
|
|
| 4137 |
|
|
| 4138 |
|
|
| 4139 |
|
|
| 4140 |
|
|
| 4141 |
|
|
| 4142 |
|
|
| |
|
| 92.6% |
Uncovered Elements: 2 (27) |
Complexity: 8 |
Complexity Density: 0.47 |
|
| 4143 |
484 |
@Override... |
| 4144 |
|
public void buildSortByAnnotationScoresMenu() |
| 4145 |
|
{ |
| 4146 |
484 |
if (viewport.getAlignment().getAlignmentAnnotation() == null) |
| 4147 |
|
{ |
| 4148 |
0 |
return; |
| 4149 |
|
} |
| 4150 |
|
|
| 4151 |
484 |
if (viewport.getAlignment().getAlignmentAnnotation() |
| 4152 |
|
.hashCode() != _annotationScoreVectorHash) |
| 4153 |
|
{ |
| 4154 |
483 |
sortByAnnotScore.removeAll(); |
| 4155 |
|
|
| 4156 |
483 |
Hashtable<String, String> scoreSorts = new Hashtable<>(); |
| 4157 |
483 |
AlignmentAnnotation aann[]; |
| 4158 |
483 |
for (SequenceI sqa : viewport.getAlignment().getSequences()) |
| 4159 |
|
{ |
| 4160 |
4424 |
aann = sqa.getAnnotation(); |
| 4161 |
5003 |
for (int i = 0; aann != null && i < aann.length; i++) |
| 4162 |
|
{ |
| 4163 |
579 |
if (aann[i].hasScore() && aann[i].sequenceRef != null) |
| 4164 |
|
{ |
| 4165 |
152 |
scoreSorts.put(aann[i].label, aann[i].label); |
| 4166 |
|
} |
| 4167 |
|
} |
| 4168 |
|
} |
| 4169 |
483 |
Enumeration<String> labels = scoreSorts.keys(); |
| 4170 |
487 |
while (labels.hasMoreElements()) |
| 4171 |
|
{ |
| 4172 |
4 |
addSortByAnnotScoreMenuItem(sortByAnnotScore, labels.nextElement()); |
| 4173 |
|
} |
| 4174 |
483 |
sortByAnnotScore.setVisible(scoreSorts.size() > 0); |
| 4175 |
483 |
scoreSorts.clear(); |
| 4176 |
|
|
| 4177 |
483 |
_annotationScoreVectorHash = viewport.getAlignment() |
| 4178 |
|
.getAlignmentAnnotation().hashCode(); |
| 4179 |
|
} |
| 4180 |
|
} |
| 4181 |
|
|
| 4182 |
|
|
| 4183 |
|
|
| 4184 |
|
|
| 4185 |
|
|
| 4186 |
|
|
| 4187 |
|
|
| 4188 |
|
|
| |
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 4 |
Complexity Density: 0.24 |
|
| 4189 |
0 |
@Override... |
| 4190 |
|
public void buildTreeSortMenu() |
| 4191 |
|
{ |
| 4192 |
0 |
sortByTreeMenu.removeAll(); |
| 4193 |
|
|
| 4194 |
0 |
List<Component> comps = PaintRefresher.components |
| 4195 |
|
.get(viewport.getSequenceSetId()); |
| 4196 |
0 |
List<TreePanel> treePanels = new ArrayList<>(); |
| 4197 |
|
|
| 4198 |
0 |
List<TreePanel> annotTreePanels = new ArrayList<>(); |
| 4199 |
0 |
for (Component comp : comps) |
| 4200 |
|
{ |
| 4201 |
0 |
if (comp instanceof TreePanel) |
| 4202 |
|
{ |
| 4203 |
0 |
treePanels.add((TreePanel) comp); |
| 4204 |
|
|
| 4205 |
0 |
if (((TreePanel) comp).isAnnotationBased()) |
| 4206 |
|
{ |
| 4207 |
0 |
annotTreePanels.add((TreePanel) comp); |
| 4208 |
|
} |
| 4209 |
|
} |
| 4210 |
|
} |
| 4211 |
|
|
| 4212 |
0 |
if (treePanels.size() < 1) |
| 4213 |
|
{ |
| 4214 |
0 |
sortByTreeMenu.setVisible(false); |
| 4215 |
0 |
return; |
| 4216 |
|
} |
| 4217 |
|
|
| 4218 |
0 |
sortByTreeMenu.setVisible(true); |
| 4219 |
|
|
| 4220 |
0 |
for (final TreePanel tp : treePanels) |
| 4221 |
|
{ |
| 4222 |
0 |
final JMenuItem item = new JMenuItem(tp.getTitle()); |
| 4223 |
0 |
item.addActionListener(new java.awt.event.ActionListener() |
| 4224 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 4225 |
0 |
@Override... |
| 4226 |
|
public void actionPerformed(ActionEvent e) |
| 4227 |
|
{ |
| 4228 |
0 |
tp.sortByTree_actionPerformed(); |
| 4229 |
0 |
addHistoryItem(tp.sortAlignmentIn(alignPanel)); |
| 4230 |
|
|
| 4231 |
|
} |
| 4232 |
|
}); |
| 4233 |
|
|
| 4234 |
0 |
sortByTreeMenu.add(item); |
| 4235 |
|
} |
| 4236 |
|
} |
| 4237 |
|
|
| |
|
| 0% |
Uncovered Elements: 21 (21) |
Complexity: 4 |
Complexity Density: 0.27 |
|
| 4238 |
0 |
@Override... |
| 4239 |
|
public void buildSortAnnotationByTreeMenu() |
| 4240 |
|
{ |
| 4241 |
0 |
sortAnnotationByTreeMenu.removeAll(); |
| 4242 |
|
|
| 4243 |
0 |
List<Component> comps = PaintRefresher.components |
| 4244 |
|
.get(viewport.getSequenceSetId()); |
| 4245 |
|
|
| 4246 |
0 |
List<TreePanel> annotTreePanels = new ArrayList<>(); |
| 4247 |
0 |
for (Component comp : comps) |
| 4248 |
|
{ |
| 4249 |
0 |
if (comp instanceof TreePanel) |
| 4250 |
|
{ |
| 4251 |
0 |
if (((TreePanel) comp).isAnnotationBased()) |
| 4252 |
|
{ |
| 4253 |
0 |
annotTreePanels.add((TreePanel) comp); |
| 4254 |
|
} |
| 4255 |
|
} |
| 4256 |
|
} |
| 4257 |
|
|
| 4258 |
0 |
if (annotTreePanels.size() < 1) |
| 4259 |
|
{ |
| 4260 |
0 |
sortAnnotationByTreeMenu.setVisible(false); |
| 4261 |
0 |
return; |
| 4262 |
|
} |
| 4263 |
|
|
| 4264 |
0 |
sortAnnotationByTreeMenu.setVisible(true); |
| 4265 |
|
|
| 4266 |
0 |
for (final TreePanel tp : annotTreePanels) |
| 4267 |
|
{ |
| 4268 |
0 |
final JMenuItem item = new JMenuItem(tp.getTitle()); |
| 4269 |
0 |
item.addActionListener(new java.awt.event.ActionListener() |
| 4270 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 4271 |
0 |
@Override... |
| 4272 |
|
public void actionPerformed(ActionEvent e) |
| 4273 |
|
{ |
| 4274 |
0 |
sortAnnByLabel.setSelected(false); |
| 4275 |
0 |
sortAnnBySequence.setSelected(false); |
| 4276 |
0 |
setAnnotationSortOrder(SequenceAnnotationOrder.NONE); |
| 4277 |
0 |
tp.sortAnnotationByTree_actionPerformed(); |
| 4278 |
|
} |
| 4279 |
|
}); |
| 4280 |
|
|
| 4281 |
0 |
sortAnnotationByTreeMenu.add(item); |
| 4282 |
|
} |
| 4283 |
|
} |
| 4284 |
|
|
| |
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
| 4285 |
0 |
public boolean sortBy(AlignmentOrder alorder, String undoname)... |
| 4286 |
|
{ |
| 4287 |
0 |
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); |
| 4288 |
0 |
AlignmentSorter.sortBy(viewport.getAlignment(), alorder); |
| 4289 |
0 |
if (undoname != null) |
| 4290 |
|
{ |
| 4291 |
0 |
addHistoryItem(new OrderCommand(undoname, oldOrder, |
| 4292 |
|
viewport.getAlignment())); |
| 4293 |
|
} |
| 4294 |
0 |
alignPanel.paintAlignment(true, false); |
| 4295 |
0 |
return true; |
| 4296 |
|
} |
| 4297 |
|
|
| 4298 |
|
|
| 4299 |
|
|
| 4300 |
|
|
| 4301 |
|
|
| 4302 |
|
|
| |
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 6 |
Complexity Density: 0.67 |
|
| 4303 |
0 |
public jalview.datamodel.AlignmentView gatherSequencesForAlignment()... |
| 4304 |
|
{ |
| 4305 |
|
|
| 4306 |
0 |
AlignmentView msa = null; |
| 4307 |
|
|
| 4308 |
0 |
if ((viewport.getSelectionGroup() != null) |
| 4309 |
|
&& (viewport.getSelectionGroup().getSize() > 1)) |
| 4310 |
|
{ |
| 4311 |
|
|
| 4312 |
|
|
| 4313 |
|
|
| 4314 |
|
|
| 4315 |
|
|
| 4316 |
|
|
| 4317 |
|
|
| 4318 |
|
|
| 4319 |
0 |
msa = viewport.getAlignmentView(true); |
| 4320 |
|
} |
| 4321 |
0 |
else if (viewport.getSelectionGroup() != null |
| 4322 |
|
&& viewport.getSelectionGroup().getSize() == 1) |
| 4323 |
|
{ |
| 4324 |
0 |
int option = JvOptionPane.showConfirmDialog(this, |
| 4325 |
|
MessageManager.getString("warn.oneseq_msainput_selection"), |
| 4326 |
|
MessageManager.getString("label.invalid_selection"), |
| 4327 |
|
JvOptionPane.OK_CANCEL_OPTION); |
| 4328 |
0 |
if (option == JvOptionPane.OK_OPTION) |
| 4329 |
|
{ |
| 4330 |
0 |
msa = viewport.getAlignmentView(false); |
| 4331 |
|
} |
| 4332 |
|
} |
| 4333 |
|
else |
| 4334 |
|
{ |
| 4335 |
0 |
msa = viewport.getAlignmentView(false); |
| 4336 |
|
} |
| 4337 |
0 |
return msa; |
| 4338 |
|
} |
| 4339 |
|
|
| 4340 |
|
|
| 4341 |
|
|
| 4342 |
|
|
| 4343 |
|
|
| 4344 |
|
|
| 4345 |
|
|
| 4346 |
|
|
| |
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 4 |
Complexity Density: 0.57 |
|
| 4347 |
0 |
public AlignmentView gatherSeqOrMsaForSecStrPrediction()... |
| 4348 |
|
{ |
| 4349 |
0 |
AlignmentView seqs = null; |
| 4350 |
|
|
| 4351 |
0 |
if ((viewport.getSelectionGroup() != null) |
| 4352 |
|
&& (viewport.getSelectionGroup().getSize() > 0)) |
| 4353 |
|
{ |
| 4354 |
0 |
seqs = viewport.getAlignmentView(true); |
| 4355 |
|
} |
| 4356 |
|
else |
| 4357 |
|
{ |
| 4358 |
0 |
seqs = viewport.getAlignmentView(false); |
| 4359 |
|
} |
| 4360 |
|
|
| 4361 |
|
|
| 4362 |
|
|
| 4363 |
|
|
| 4364 |
0 |
if (!viewport.getAlignment().isAligned(false)) |
| 4365 |
|
{ |
| 4366 |
0 |
seqs.setSequences(new SeqCigar[] { seqs.getSequences()[0] }); |
| 4367 |
|
|
| 4368 |
|
|
| 4369 |
|
|
| 4370 |
|
} |
| 4371 |
0 |
return seqs; |
| 4372 |
|
} |
| 4373 |
|
|
| 4374 |
|
|
| 4375 |
|
|
| 4376 |
|
|
| 4377 |
|
|
| 4378 |
|
|
| 4379 |
|
|
| 4380 |
|
|
| 4381 |
|
@param |
| 4382 |
|
|
| 4383 |
|
|
| |
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 4 |
Complexity Density: 0.25 |
|
| 4384 |
0 |
@Override... |
| 4385 |
|
protected void loadTreeMenuItem_actionPerformed(ActionEvent e) |
| 4386 |
|
{ |
| 4387 |
|
|
| 4388 |
0 |
JalviewFileChooser chooser = new JalviewFileChooser( |
| 4389 |
|
Cache.getProperty("LAST_DIRECTORY")); |
| 4390 |
0 |
chooser.setFileView(new JalviewFileView()); |
| 4391 |
0 |
chooser.setDialogTitle( |
| 4392 |
|
MessageManager.getString("label.select_newick_like_tree_file")); |
| 4393 |
0 |
chooser.setToolTipText( |
| 4394 |
|
MessageManager.getString("label.load_tree_file")); |
| 4395 |
|
|
| 4396 |
0 |
chooser.setResponseHandler(0, () -> { |
| 4397 |
0 |
String filePath = chooser.getSelectedFile().getPath(); |
| 4398 |
0 |
Cache.setProperty("LAST_DIRECTORY", filePath); |
| 4399 |
0 |
NewickFile fin = null; |
| 4400 |
0 |
try |
| 4401 |
|
{ |
| 4402 |
0 |
fin = new NewickFile(new FileParse(chooser.getSelectedFile(), |
| 4403 |
|
DataSourceType.FILE)); |
| 4404 |
0 |
viewport.setCurrentTree(showNewickTree(fin, filePath).getTree()); |
| 4405 |
|
} catch (Exception ex) |
| 4406 |
|
{ |
| 4407 |
0 |
JvOptionPane.showMessageDialog(Desktop.desktop, ex.getMessage(), |
| 4408 |
|
MessageManager.getString("label.problem_reading_tree_file"), |
| 4409 |
|
JvOptionPane.WARNING_MESSAGE); |
| 4410 |
0 |
ex.printStackTrace(); |
| 4411 |
|
} |
| 4412 |
0 |
if (fin != null && fin.hasWarningMessage()) |
| 4413 |
|
{ |
| 4414 |
0 |
JvOptionPane.showMessageDialog(Desktop.desktop, |
| 4415 |
|
fin.getWarningMessage(), |
| 4416 |
|
MessageManager |
| 4417 |
|
.getString("label.possible_problem_with_tree_file"), |
| 4418 |
|
JvOptionPane.WARNING_MESSAGE); |
| 4419 |
|
} |
| 4420 |
|
}); |
| 4421 |
0 |
chooser.showOpenDialog(this); |
| 4422 |
|
} |
| 4423 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 4424 |
2 |
public TreePanel showNewickTree(NewickFile nf, String treeTitle)... |
| 4425 |
|
{ |
| 4426 |
2 |
return showNewickTree(nf, treeTitle, 600, 500, 4, 5); |
| 4427 |
|
} |
| 4428 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 4429 |
14 |
public TreePanel showNewickTree(NewickFile nf, String treeTitle, int w,... |
| 4430 |
|
int h, int x, int y) |
| 4431 |
|
{ |
| 4432 |
14 |
return showNewickTree(nf, treeTitle, null, w, h, x, y); |
| 4433 |
|
} |
| 4434 |
|
|
| 4435 |
|
|
| 4436 |
|
|
| 4437 |
|
|
| 4438 |
|
|
| 4439 |
|
@param |
| 4440 |
|
|
| 4441 |
|
@param |
| 4442 |
|
|
| 4443 |
|
@param |
| 4444 |
|
|
| 4445 |
|
@param |
| 4446 |
|
|
| 4447 |
|
@param |
| 4448 |
|
|
| 4449 |
|
@param |
| 4450 |
|
|
| 4451 |
|
@param |
| 4452 |
|
|
| 4453 |
|
@return |
| 4454 |
|
|
| |
|
| 80% |
Uncovered Elements: 2 (10) |
Complexity: 3 |
Complexity Density: 0.38 |
|
| 4455 |
14 |
public TreePanel showNewickTree(NewickFile nf, String treeTitle,... |
| 4456 |
|
AlignmentView input, int w, int h, int x, int y) |
| 4457 |
|
{ |
| 4458 |
14 |
TreePanel tp = null; |
| 4459 |
|
|
| 4460 |
14 |
try |
| 4461 |
|
{ |
| 4462 |
14 |
nf.parse(); |
| 4463 |
|
|
| 4464 |
14 |
if (nf.getTree() != null) |
| 4465 |
|
{ |
| 4466 |
14 |
tp = new TreePanel(alignPanel, nf, treeTitle, input); |
| 4467 |
|
|
| 4468 |
14 |
layoutTreePanel(tp, treeTitle, w, h, x, y); |
| 4469 |
|
} |
| 4470 |
|
} catch (Exception ex) |
| 4471 |
|
{ |
| 4472 |
0 |
ex.printStackTrace(); |
| 4473 |
|
} |
| 4474 |
|
|
| 4475 |
14 |
return tp; |
| 4476 |
|
} |
| 4477 |
|
|
| 4478 |
|
|
| 4479 |
|
|
| 4480 |
|
|
| 4481 |
|
|
| 4482 |
|
@param |
| 4483 |
|
@param |
| 4484 |
|
@param |
| 4485 |
|
@param |
| 4486 |
|
@param |
| 4487 |
|
@param |
| 4488 |
|
@param |
| 4489 |
|
@param |
| 4490 |
|
@return |
| 4491 |
|
|
| |
|
| 80% |
Uncovered Elements: 2 (10) |
Complexity: 3 |
Complexity Density: 0.38 |
|
| 4492 |
3 |
public TreePanel showNewickTreeForAnnotation(NewickFile nf,... |
| 4493 |
|
Map<String, AlignmentAnnotation> annotationIds, String treeTitle, |
| 4494 |
|
AlignmentView input, int w, int h, int x, int y) |
| 4495 |
|
{ |
| 4496 |
3 |
TreePanel tp = null; |
| 4497 |
|
|
| 4498 |
3 |
try |
| 4499 |
|
{ |
| 4500 |
3 |
nf.parse(); |
| 4501 |
|
|
| 4502 |
3 |
if (nf.getTree() != null) |
| 4503 |
|
{ |
| 4504 |
3 |
tp = TreePanel.newTreeForAnnotations(alignPanel, nf, annotationIds, |
| 4505 |
|
treeTitle, input); |
| 4506 |
|
|
| 4507 |
3 |
layoutTreePanel(tp, treeTitle, w, h, x, y); |
| 4508 |
|
} |
| 4509 |
|
} catch (Exception ex) |
| 4510 |
|
{ |
| 4511 |
0 |
ex.printStackTrace(); |
| 4512 |
|
} |
| 4513 |
|
|
| 4514 |
3 |
return tp; |
| 4515 |
|
} |
| 4516 |
|
|
| 4517 |
|
|
| 4518 |
|
|
| 4519 |
|
|
| 4520 |
|
@param |
| 4521 |
|
|
| 4522 |
|
@param |
| 4523 |
|
|
| 4524 |
|
@param |
| 4525 |
|
|
| 4526 |
|
@param |
| 4527 |
|
|
| 4528 |
|
@param |
| 4529 |
|
|
| 4530 |
|
@param |
| 4531 |
|
|
| 4532 |
|
|
| |
|
| 83.3% |
Uncovered Elements: 1 (6) |
Complexity: 3 |
Complexity Density: 0.75 |
|
| 4533 |
17 |
public static void layoutTreePanel(TreePanel tp, String title, int w,... |
| 4534 |
|
int h, int x, int y) |
| 4535 |
|
{ |
| 4536 |
17 |
tp.setSize(w, h); |
| 4537 |
17 |
if (x > 0 && y > 0) |
| 4538 |
|
{ |
| 4539 |
17 |
tp.setLocation(x, y); |
| 4540 |
|
} |
| 4541 |
17 |
Desktop.addInternalFrame(tp, title, w, h); |
| 4542 |
|
} |
| 4543 |
|
|
| |
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
| 4544 |
0 |
public void showContactMapTree(AlignmentAnnotation aa, ContactMatrixI cm)... |
| 4545 |
|
{ |
| 4546 |
0 |
int x = 4, y = 5; |
| 4547 |
0 |
int w = 400, h = 500; |
| 4548 |
|
|
| 4549 |
0 |
try |
| 4550 |
|
{ |
| 4551 |
0 |
NewickFile fin = new NewickFile( |
| 4552 |
|
new FileParse(cm.getNewick(), DataSourceType.PASTE)); |
| 4553 |
0 |
String title = aa.label + " " + cm.getTreeMethod() + " tree" |
| 4554 |
0 |
+ (aa.sequenceRef != null |
| 4555 |
|
? (" for " + aa.sequenceRef.getDisplayId(false)) |
| 4556 |
|
: ""); |
| 4557 |
|
|
| 4558 |
0 |
showColumnWiseTree(fin, aa, title, w, h, x, y); |
| 4559 |
|
} catch (Throwable xx) |
| 4560 |
|
{ |
| 4561 |
0 |
Console.error("Unexpected exception showing tree for contact matrix", |
| 4562 |
|
xx); |
| 4563 |
|
} |
| 4564 |
|
} |
| 4565 |
|
|
| |
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 5 |
Complexity Density: 0.38 |
|
| 4566 |
0 |
public TreePanel showColumnWiseTree(NewickFile nf, AlignmentAnnotation aa,... |
| 4567 |
|
String treeTitle, int w, int h, int x, int y) |
| 4568 |
|
{ |
| 4569 |
0 |
try |
| 4570 |
|
{ |
| 4571 |
0 |
nf.parse(); |
| 4572 |
0 |
if (nf.getTree() == null) |
| 4573 |
|
{ |
| 4574 |
0 |
return null; |
| 4575 |
|
} |
| 4576 |
0 |
TreePanel tp = new TreePanel(alignPanel, nf, aa, treeTitle); |
| 4577 |
|
|
| 4578 |
0 |
tp.setSize(w, h); |
| 4579 |
|
|
| 4580 |
0 |
if (x > 0 && y > 0) |
| 4581 |
|
{ |
| 4582 |
0 |
tp.setLocation(x, y); |
| 4583 |
|
} |
| 4584 |
|
|
| 4585 |
0 |
tp.setLayer(JLayeredPane.PALETTE_LAYER); |
| 4586 |
|
|
| 4587 |
0 |
Desktop.addInternalFrame(tp, treeTitle, w, h); |
| 4588 |
0 |
return tp; |
| 4589 |
|
} catch (Throwable xx) |
| 4590 |
|
{ |
| 4591 |
0 |
Console.error("Unexpected exception showing tree for contact matrix", |
| 4592 |
|
xx); |
| 4593 |
|
} |
| 4594 |
0 |
return null; |
| 4595 |
|
} |
| 4596 |
|
|
| 4597 |
|
|
| 4598 |
|
|
| 4599 |
|
|
| 4600 |
|
private boolean buildingMenu = false; |
| 4601 |
|
|
| 4602 |
|
|
| 4603 |
|
|
| 4604 |
|
|
| 4605 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
| 4606 |
3037 |
public void BuildWebServiceMenu()... |
| 4607 |
|
{ |
| 4608 |
3048 |
while (buildingMenu) |
| 4609 |
|
{ |
| 4610 |
11 |
try |
| 4611 |
|
{ |
| 4612 |
11 |
jalview.bin.Console |
| 4613 |
|
.errPrintln("Waiting for building menu to finish."); |
| 4614 |
11 |
Thread.sleep(10); |
| 4615 |
|
} catch (Exception e) |
| 4616 |
|
{ |
| 4617 |
|
} |
| 4618 |
|
} |
| 4619 |
3037 |
final AlignFrame me = this; |
| 4620 |
3037 |
buildingMenu = true; |
| 4621 |
3037 |
new Thread(new Runnable() |
| 4622 |
|
{ |
| |
|
| 94.1% |
Uncovered Elements: 2 (34) |
Complexity: 7 |
Complexity Density: 0.27 |
|
| 4623 |
3037 |
@Override... |
| 4624 |
|
public void run() |
| 4625 |
|
{ |
| 4626 |
3037 |
final List<JMenuItem> legacyItems = new ArrayList<>(); |
| 4627 |
3036 |
try |
| 4628 |
|
{ |
| 4629 |
|
|
| 4630 |
|
|
| 4631 |
|
|
| 4632 |
|
|
| 4633 |
|
|
| 4634 |
|
|
| 4635 |
|
|
| 4636 |
|
|
| 4637 |
|
|
| 4638 |
|
|
| 4639 |
|
|
| 4640 |
|
|
| 4641 |
3037 |
final Vector<JMenu> wsmenu = new Vector<>(); |
| 4642 |
3037 |
final IProgressIndicator af = me; |
| 4643 |
|
|
| 4644 |
|
|
| 4645 |
|
|
| 4646 |
|
|
| 4647 |
|
|
| 4648 |
|
|
| 4649 |
3037 |
final JMenu msawsmenu = new JMenu("Alignment"); |
| 4650 |
3037 |
final JMenu secstrmenu = new JMenu( |
| 4651 |
|
"Secondary Structure Prediction"); |
| 4652 |
3037 |
final JMenu seqsrchmenu = new JMenu("Sequence Database Search"); |
| 4653 |
3037 |
final JMenu analymenu = new JMenu("Analysis"); |
| 4654 |
3037 |
final JMenu dismenu = new JMenu("Protein Disorder"); |
| 4655 |
|
|
| 4656 |
|
|
| 4657 |
3037 |
if ( |
| 4658 |
|
|
| 4659 |
3037 |
Discoverer.services != null && (Discoverer.services.size() > 0)) |
| 4660 |
|
{ |
| 4661 |
|
|
| 4662 |
|
|
| 4663 |
|
|
| 4664 |
|
|
| 4665 |
|
|
| 4666 |
|
|
| 4667 |
3037 |
Vector<ServiceHandle> secstrpr = Discoverer.services |
| 4668 |
|
.get("SecStrPred"); |
| 4669 |
3037 |
if (secstrpr != null) |
| 4670 |
|
{ |
| 4671 |
|
|
| 4672 |
6074 |
for (int i = 0, j = secstrpr.size(); i < j; i++) |
| 4673 |
|
{ |
| 4674 |
3037 |
final ext.vamsas.ServiceHandle sh = secstrpr.get(i); |
| 4675 |
3037 |
jalview.ws.WSMenuEntryProviderI impl = jalview.ws.jws1.Discoverer |
| 4676 |
|
.getServiceClient(sh); |
| 4677 |
3037 |
int p = secstrmenu.getItemCount(); |
| 4678 |
3037 |
impl.attachWSMenuEntry(secstrmenu, me); |
| 4679 |
3037 |
int q = secstrmenu.getItemCount(); |
| 4680 |
6074 |
for (int litm = p; litm < q; litm++) |
| 4681 |
|
{ |
| 4682 |
3037 |
legacyItems.add(secstrmenu.getItem(litm)); |
| 4683 |
|
} |
| 4684 |
|
} |
| 4685 |
|
} |
| 4686 |
|
} |
| 4687 |
|
|
| 4688 |
|
|
| 4689 |
|
|
| 4690 |
3037 |
wsmenu.add(msawsmenu); |
| 4691 |
3037 |
wsmenu.add(secstrmenu); |
| 4692 |
3037 |
wsmenu.add(dismenu); |
| 4693 |
3037 |
wsmenu.add(analymenu); |
| 4694 |
|
|
| 4695 |
|
|
| 4696 |
|
|
| 4697 |
3037 |
javax.swing.SwingUtilities.invokeLater(new Runnable() |
| 4698 |
|
{ |
| |
|
| 74.5% |
Uncovered Elements: 12 (47) |
Complexity: 10 |
Complexity Density: 0.32 |
|
| 4699 |
3037 |
@Override... |
| 4700 |
|
public void run() |
| 4701 |
|
{ |
| 4702 |
3037 |
try |
| 4703 |
|
{ |
| 4704 |
3037 |
webService.removeAll(); |
| 4705 |
|
|
| 4706 |
3037 |
if (wsmenu.size() > 0) |
| 4707 |
|
{ |
| 4708 |
15185 |
for (int i = 0, j = wsmenu.size(); i < j; i++) |
| 4709 |
|
{ |
| 4710 |
12148 |
webService.add(wsmenu.get(i)); |
| 4711 |
|
} |
| 4712 |
|
} |
| 4713 |
|
else |
| 4714 |
|
{ |
| 4715 |
0 |
webService.add(me.webServiceNoServices); |
| 4716 |
|
} |
| 4717 |
|
|
| 4718 |
|
{ |
| 4719 |
|
|
| 4720 |
|
|
| 4721 |
|
|
| 4722 |
|
|
| 4723 |
|
|
| 4724 |
|
|
| 4725 |
|
|
| 4726 |
|
|
| 4727 |
3037 |
Jws2Discoverer jws2servs = Jws2Discoverer.getDiscoverer(); |
| 4728 |
3037 |
if (jws2servs != null) |
| 4729 |
|
{ |
| 4730 |
3037 |
if (jws2servs.hasServices()) |
| 4731 |
|
{ |
| 4732 |
634 |
jws2servs.attachWSMenuEntry(webService, me); |
| 4733 |
626 |
for (Jws2Instance sv : jws2servs.getServices()) |
| 4734 |
|
{ |
| 4735 |
7009 |
if (sv.description.toLowerCase(Locale.ROOT) |
| 4736 |
|
.contains("jpred")) |
| 4737 |
|
{ |
| 4738 |
0 |
for (JMenuItem jmi : legacyItems) |
| 4739 |
|
{ |
| 4740 |
0 |
jmi.setVisible(false); |
| 4741 |
|
} |
| 4742 |
|
} |
| 4743 |
|
} |
| 4744 |
|
} |
| 4745 |
|
|
| 4746 |
3029 |
if (jws2servs.isRunning()) |
| 4747 |
|
{ |
| 4748 |
1911 |
JMenuItem tm = new JMenuItem( |
| 4749 |
|
"Still discovering JABA Services"); |
| 4750 |
1911 |
tm.setEnabled(false); |
| 4751 |
1911 |
webService.add(tm); |
| 4752 |
|
} |
| 4753 |
1118 |
else if (!Cache.getDefault("SHOW_JWS2_SERVICES", true)) |
| 4754 |
|
{ |
| 4755 |
0 |
JMenuItem enableJws2 = new JMenuItem( |
| 4756 |
|
"Discover Web Services"); |
| 4757 |
0 |
enableJws2.setToolTipText( |
| 4758 |
|
"Select to start JABA Web Service discovery (or enable option in Web Service preferences)"); |
| 4759 |
0 |
enableJws2.setEnabled(true); |
| 4760 |
0 |
enableJws2.addActionListener(new ActionListener() |
| 4761 |
|
{ |
| 4762 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 4763 |
0 |
@Override... |
| 4764 |
|
public void actionPerformed(ActionEvent e) |
| 4765 |
|
{ |
| 4766 |
|
|
| 4767 |
0 |
Desktop.instance.startServiceDiscovery(false, |
| 4768 |
|
true); |
| 4769 |
|
} |
| 4770 |
|
}); |
| 4771 |
0 |
webService.add(enableJws2); |
| 4772 |
|
} |
| 4773 |
|
} |
| 4774 |
|
} |
| 4775 |
3029 |
build_urlServiceMenu(me.webService); |
| 4776 |
3029 |
build_fetchdbmenu(webService); |
| 4777 |
3029 |
for (JMenu item : wsmenu) |
| 4778 |
|
{ |
| 4779 |
12116 |
if (item.getItemCount() == 0) |
| 4780 |
|
{ |
| 4781 |
4995 |
item.setEnabled(false); |
| 4782 |
|
} |
| 4783 |
|
else |
| 4784 |
|
{ |
| 4785 |
7121 |
item.setEnabled(true); |
| 4786 |
|
} |
| 4787 |
|
} |
| 4788 |
|
} catch (Exception e) |
| 4789 |
|
{ |
| 4790 |
8 |
Console.debug( |
| 4791 |
|
"Exception during web service menu building process.", |
| 4792 |
|
e); |
| 4793 |
|
} |
| 4794 |
|
} |
| 4795 |
|
}); |
| 4796 |
|
} catch (Exception e) |
| 4797 |
|
{ |
| 4798 |
|
} |
| 4799 |
3037 |
buildingMenu = false; |
| 4800 |
|
} |
| 4801 |
|
}).start(); |
| 4802 |
|
|
| 4803 |
|
} |
| 4804 |
|
|
| 4805 |
|
|
| 4806 |
|
|
| 4807 |
|
|
| 4808 |
|
@param |
| 4809 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 4810 |
3029 |
protected void build_urlServiceMenu(JMenu webService)... |
| 4811 |
|
{ |
| 4812 |
|
|
| 4813 |
|
|
| 4814 |
|
|
| 4815 |
|
|
| 4816 |
|
|
| 4817 |
|
|
| 4818 |
|
|
| 4819 |
|
|
| 4820 |
|
|
| 4821 |
|
|
| 4822 |
|
|
| 4823 |
|
|
| 4824 |
|
|
| 4825 |
|
|
| 4826 |
|
|
| 4827 |
|
|
| 4828 |
|
|
| 4829 |
|
|
| 4830 |
3029 |
for (jalview.ws.rest.RestClient client : jalview.ws.rest.RestClient |
| 4831 |
|
.getRestClients()) |
| 4832 |
|
{ |
| 4833 |
3029 |
client.attachWSMenuEntry( |
| 4834 |
|
JvSwingUtils.findOrCreateMenu(webService, client.getAction()), |
| 4835 |
|
this); |
| 4836 |
|
} |
| 4837 |
|
} |
| 4838 |
|
|
| 4839 |
|
|
| 4840 |
|
|
| 4841 |
|
|
| 4842 |
|
|
| 4843 |
|
|
| 4844 |
|
|
| 4845 |
|
@return |
| 4846 |
|
|
| |
|
| 81.8% |
Uncovered Elements: 4 (22) |
Complexity: 4 |
Complexity Density: 0.2 |
|
| 4847 |
703 |
public boolean canShowProducts()... |
| 4848 |
|
{ |
| 4849 |
703 |
SequenceI[] seqs = viewport.getAlignment().getSequencesArray(); |
| 4850 |
703 |
AlignmentI dataset = viewport.getAlignment().getDataset(); |
| 4851 |
|
|
| 4852 |
703 |
showProducts.removeAll(); |
| 4853 |
703 |
final boolean dna = viewport.getAlignment().isNucleotide(); |
| 4854 |
|
|
| 4855 |
703 |
if (seqs == null || seqs.length == 0) |
| 4856 |
|
{ |
| 4857 |
|
|
| 4858 |
0 |
return false; |
| 4859 |
|
} |
| 4860 |
|
|
| 4861 |
703 |
boolean showp = false; |
| 4862 |
703 |
try |
| 4863 |
|
{ |
| 4864 |
703 |
List<String> ptypes = new CrossRef(seqs, dataset) |
| 4865 |
|
.findXrefSourcesForSequences(dna); |
| 4866 |
|
|
| 4867 |
703 |
for (final String source : ptypes) |
| 4868 |
|
{ |
| 4869 |
14 |
showp = true; |
| 4870 |
14 |
final AlignFrame af = this; |
| 4871 |
14 |
JMenuItem xtype = new JMenuItem(source); |
| 4872 |
14 |
xtype.addActionListener(new ActionListener() |
| 4873 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 4874 |
0 |
@Override... |
| 4875 |
|
public void actionPerformed(ActionEvent e) |
| 4876 |
|
{ |
| 4877 |
0 |
showProductsFor(af.viewport.getSequenceSelection(), dna, |
| 4878 |
|
source); |
| 4879 |
|
} |
| 4880 |
|
}); |
| 4881 |
14 |
showProducts.add(xtype); |
| 4882 |
|
} |
| 4883 |
703 |
showProducts.setVisible(showp); |
| 4884 |
703 |
showProducts.setEnabled(showp); |
| 4885 |
|
} catch (Exception e) |
| 4886 |
|
{ |
| 4887 |
0 |
Console.warn( |
| 4888 |
|
"canShowProducts threw an exception - please report to help@jalview.org", |
| 4889 |
|
e); |
| 4890 |
0 |
return false; |
| 4891 |
|
} |
| 4892 |
703 |
return showp; |
| 4893 |
|
} |
| 4894 |
|
|
| 4895 |
|
|
| 4896 |
|
|
| 4897 |
|
|
| 4898 |
|
|
| 4899 |
|
@param |
| 4900 |
|
|
| 4901 |
|
@param |
| 4902 |
|
|
| 4903 |
|
@param |
| 4904 |
|
|
| 4905 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 4906 |
0 |
protected void showProductsFor(final SequenceI[] sel, final boolean _odna,... |
| 4907 |
|
final String source) |
| 4908 |
|
{ |
| 4909 |
0 |
new Thread(CrossRefAction.getHandlerFor(sel, _odna, source, this)) |
| 4910 |
|
.start(); |
| 4911 |
|
} |
| 4912 |
|
|
| 4913 |
|
|
| 4914 |
|
|
| 4915 |
|
|
| 4916 |
|
|
| |
|
| 56% |
Uncovered Elements: 11 (25) |
Complexity: 5 |
Complexity Density: 0.24 |
|
| 4917 |
1 |
@Override... |
| 4918 |
|
public void showTranslation_actionPerformed(GeneticCodeI codeTable) |
| 4919 |
|
{ |
| 4920 |
1 |
AlignmentI al = null; |
| 4921 |
1 |
try |
| 4922 |
|
{ |
| 4923 |
1 |
Dna dna = new Dna(viewport, viewport.getViewAsVisibleContigs(true)); |
| 4924 |
|
|
| 4925 |
1 |
al = dna.translateCdna(codeTable); |
| 4926 |
|
} catch (Exception ex) |
| 4927 |
|
{ |
| 4928 |
0 |
Console.error("Exception during translation. Please report this !", |
| 4929 |
|
ex); |
| 4930 |
0 |
final String msg = MessageManager.getString( |
| 4931 |
|
"label.error_when_translating_sequences_submit_bug_report"); |
| 4932 |
0 |
final String errorTitle = MessageManager |
| 4933 |
|
.getString("label.implementation_error") |
| 4934 |
|
+ MessageManager.getString("label.translation_failed"); |
| 4935 |
0 |
JvOptionPane.showMessageDialog(Desktop.desktop, msg, errorTitle, |
| 4936 |
|
JvOptionPane.ERROR_MESSAGE); |
| 4937 |
0 |
return; |
| 4938 |
|
} |
| 4939 |
1 |
if (al == null || al.getHeight() == 0) |
| 4940 |
|
{ |
| 4941 |
0 |
final String msg = MessageManager.getString( |
| 4942 |
|
"label.select_at_least_three_bases_in_at_least_one_sequence_to_cDNA_translation"); |
| 4943 |
0 |
final String errorTitle = MessageManager |
| 4944 |
|
.getString("label.translation_failed"); |
| 4945 |
0 |
JvOptionPane.showMessageDialog(Desktop.desktop, msg, errorTitle, |
| 4946 |
|
JvOptionPane.WARNING_MESSAGE); |
| 4947 |
|
} |
| 4948 |
|
else |
| 4949 |
|
{ |
| 4950 |
1 |
AlignFrame af = new AlignFrame(al, DEFAULT_WIDTH, DEFAULT_HEIGHT); |
| 4951 |
1 |
af.setFileFormat(this.currentFileFormat); |
| 4952 |
1 |
final String newTitle = MessageManager |
| 4953 |
|
.formatMessage("label.translation_of_params", new Object[] |
| 4954 |
|
{ this.getTitle(), codeTable.getId() }); |
| 4955 |
1 |
af.setTitle(newTitle); |
| 4956 |
1 |
if (Cache.getDefault(Preferences.ENABLE_SPLIT_FRAME, true)) |
| 4957 |
|
{ |
| 4958 |
1 |
final SequenceI[] seqs = viewport.getSelectionAsNewSequence(); |
| 4959 |
1 |
viewport.openSplitFrame(af, new Alignment(seqs)); |
| 4960 |
|
} |
| 4961 |
|
else |
| 4962 |
|
{ |
| 4963 |
0 |
Desktop.addInternalFrame(af, newTitle, DEFAULT_WIDTH, |
| 4964 |
|
DEFAULT_HEIGHT); |
| 4965 |
|
} |
| 4966 |
|
} |
| 4967 |
|
} |
| 4968 |
|
|
| 4969 |
|
|
| 4970 |
|
|
| 4971 |
|
|
| 4972 |
|
@param |
| 4973 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 4974 |
344 |
public void setFileFormat(FileFormatI format)... |
| 4975 |
|
{ |
| 4976 |
344 |
this.currentFileFormat = format; |
| 4977 |
|
} |
| 4978 |
|
|
| 4979 |
|
|
| 4980 |
|
|
| 4981 |
|
|
| 4982 |
|
@param |
| 4983 |
|
|
| 4984 |
|
@param |
| 4985 |
|
|
| 4986 |
|
@return |
| 4987 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 4988 |
4 |
public boolean parseFeaturesFile(Object file, DataSourceType sourceType)... |
| 4989 |
|
{ |
| 4990 |
|
|
| 4991 |
4 |
return avc.parseFeaturesFile(file, sourceType, |
| 4992 |
|
Cache.getDefault("RELAXEDSEQIDMATCHING", false)); |
| 4993 |
|
|
| 4994 |
|
} |
| 4995 |
|
|
| |
|
| 80% |
Uncovered Elements: 1 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 4996 |
5 |
@Override... |
| 4997 |
|
public void refreshFeatureUI(boolean enableIfNecessary) |
| 4998 |
|
{ |
| 4999 |
|
|
| 5000 |
|
|
| 5001 |
|
|
| 5002 |
5 |
if (enableIfNecessary) |
| 5003 |
|
{ |
| 5004 |
5 |
viewport.setShowSequenceFeatures(true); |
| 5005 |
5 |
showSeqFeatures.setSelected(true); |
| 5006 |
|
} |
| 5007 |
|
|
| 5008 |
|
} |
| 5009 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 5010 |
0 |
@Override... |
| 5011 |
|
public void dragEnter(DropTargetDragEvent evt) |
| 5012 |
|
{ |
| 5013 |
|
} |
| 5014 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 5015 |
0 |
@Override... |
| 5016 |
|
public void dragExit(DropTargetEvent evt) |
| 5017 |
|
{ |
| 5018 |
|
} |
| 5019 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 5020 |
0 |
@Override... |
| 5021 |
|
public void dragOver(DropTargetDragEvent evt) |
| 5022 |
|
{ |
| 5023 |
|
} |
| 5024 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 5025 |
0 |
@Override... |
| 5026 |
|
public void dropActionChanged(DropTargetDragEvent evt) |
| 5027 |
|
{ |
| 5028 |
|
} |
| 5029 |
|
|
| |
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 3 |
Complexity Density: 0.3 |
|
| 5030 |
0 |
@Override... |
| 5031 |
|
public void drop(DropTargetDropEvent evt) |
| 5032 |
|
{ |
| 5033 |
|
|
| 5034 |
|
|
| 5035 |
0 |
evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE); |
| 5036 |
0 |
Transferable t = evt.getTransferable(); |
| 5037 |
|
|
| 5038 |
0 |
final AlignFrame thisaf = this; |
| 5039 |
0 |
final List<Object> files = new ArrayList<>(); |
| 5040 |
0 |
List<DataSourceType> protocols = new ArrayList<>(); |
| 5041 |
|
|
| 5042 |
0 |
try |
| 5043 |
|
{ |
| 5044 |
0 |
Desktop.transferFromDropTarget(files, protocols, evt, t); |
| 5045 |
|
} catch (Exception e) |
| 5046 |
|
{ |
| 5047 |
0 |
e.printStackTrace(); |
| 5048 |
|
} |
| 5049 |
0 |
if (files != null) |
| 5050 |
|
{ |
| 5051 |
0 |
new Thread(new Runnable() |
| 5052 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 95 (95) |
Complexity: 24 |
Complexity Density: 0.39 |
|
| 5053 |
0 |
@Override... |
| 5054 |
|
public void run() |
| 5055 |
|
{ |
| 5056 |
0 |
try |
| 5057 |
|
{ |
| 5058 |
|
|
| 5059 |
|
|
| 5060 |
|
|
| 5061 |
0 |
SequenceIdMatcher idm = new SequenceIdMatcher( |
| 5062 |
|
viewport.getAlignment().getSequencesArray()); |
| 5063 |
|
|
| 5064 |
|
|
| 5065 |
|
|
| 5066 |
0 |
ArrayList<Object[]> filesmatched = new ArrayList<>(); |
| 5067 |
0 |
ArrayList<Object[]> filesnotmatched = new ArrayList<>(); |
| 5068 |
0 |
for (int i = 0; i < files.size(); i++) |
| 5069 |
|
{ |
| 5070 |
|
|
| 5071 |
0 |
Object file = files.get(i); |
| 5072 |
0 |
String fileName = file.toString(); |
| 5073 |
0 |
String pdbfn = ""; |
| 5074 |
0 |
DataSourceType protocol = (file instanceof File |
| 5075 |
|
? DataSourceType.FILE |
| 5076 |
|
: FormatAdapter.checkProtocol(fileName)); |
| 5077 |
0 |
if (protocol == DataSourceType.FILE) |
| 5078 |
|
{ |
| 5079 |
0 |
File fl; |
| 5080 |
0 |
if (file instanceof File) |
| 5081 |
|
{ |
| 5082 |
0 |
fl = (File) file; |
| 5083 |
0 |
Platform.cacheFileData(fl); |
| 5084 |
|
} |
| 5085 |
|
else |
| 5086 |
|
{ |
| 5087 |
0 |
fl = new File(fileName); |
| 5088 |
|
} |
| 5089 |
0 |
pdbfn = fl.getName(); |
| 5090 |
|
} |
| 5091 |
0 |
else if (protocol == DataSourceType.URL) |
| 5092 |
|
{ |
| 5093 |
0 |
URL url = new URL(fileName); |
| 5094 |
0 |
pdbfn = url.getFile(); |
| 5095 |
|
} |
| 5096 |
0 |
if (pdbfn.length() > 0) |
| 5097 |
|
{ |
| 5098 |
|
|
| 5099 |
0 |
SequenceI[] mtch = idm.findAllIdMatches(pdbfn); |
| 5100 |
0 |
int l = 0, c = pdbfn.indexOf("."); |
| 5101 |
0 |
while (mtch == null && c != -1) |
| 5102 |
|
{ |
| 5103 |
0 |
do |
| 5104 |
|
{ |
| 5105 |
0 |
l = c; |
| 5106 |
? |
} while ((c = pdbfn.indexOf(".", l)) > l); |
| 5107 |
0 |
if (l > -1) |
| 5108 |
|
{ |
| 5109 |
0 |
pdbfn = pdbfn.substring(0, l); |
| 5110 |
|
} |
| 5111 |
0 |
mtch = idm.findAllIdMatches(pdbfn); |
| 5112 |
|
} |
| 5113 |
0 |
FileFormatI type = null; |
| 5114 |
0 |
if (mtch != null) |
| 5115 |
|
{ |
| 5116 |
0 |
try |
| 5117 |
|
{ |
| 5118 |
0 |
type = new IdentifyFile().identify(file, protocol); |
| 5119 |
|
} catch (Exception ex) |
| 5120 |
|
{ |
| 5121 |
0 |
type = null; |
| 5122 |
|
} |
| 5123 |
0 |
if (type != null && type.isStructureFile()) |
| 5124 |
|
{ |
| 5125 |
0 |
filesmatched.add(new Object[] { file, protocol, mtch }); |
| 5126 |
0 |
continue; |
| 5127 |
|
} |
| 5128 |
|
} |
| 5129 |
|
|
| 5130 |
|
|
| 5131 |
0 |
filesnotmatched.add(new Object[] { file, protocol, type }); |
| 5132 |
|
} |
| 5133 |
|
} |
| 5134 |
0 |
int assocfiles = 0; |
| 5135 |
0 |
if (filesmatched.size() > 0) |
| 5136 |
|
{ |
| 5137 |
0 |
boolean autoAssociate = Cache |
| 5138 |
|
.getDefault("AUTOASSOCIATE_PDBANDSEQS", false); |
| 5139 |
0 |
if (!autoAssociate) |
| 5140 |
|
{ |
| 5141 |
0 |
String msg = MessageManager.formatMessage( |
| 5142 |
|
"label.automatically_associate_structure_files_with_sequences_same_name", |
| 5143 |
|
new Object[] |
| 5144 |
|
{ Integer.valueOf(filesmatched.size()) |
| 5145 |
|
.toString() }); |
| 5146 |
0 |
String ttl = MessageManager.getString( |
| 5147 |
|
"label.automatically_associate_structure_files_by_name"); |
| 5148 |
0 |
int choice = JvOptionPane.showConfirmDialog(thisaf, msg, |
| 5149 |
|
ttl, JvOptionPane.YES_NO_OPTION); |
| 5150 |
0 |
autoAssociate = choice == JvOptionPane.YES_OPTION; |
| 5151 |
|
} |
| 5152 |
0 |
if (autoAssociate) |
| 5153 |
|
{ |
| 5154 |
0 |
for (Object[] fm : filesmatched) |
| 5155 |
|
{ |
| 5156 |
|
|
| 5157 |
|
|
| 5158 |
|
|
| 5159 |
0 |
for (SequenceI toassoc : (SequenceI[]) fm[2]) |
| 5160 |
|
{ |
| 5161 |
0 |
PDBEntry pe = new AssociatePdbFileWithSeq() |
| 5162 |
|
.associatePdbWithSeq(fm[0].toString(), |
| 5163 |
|
(DataSourceType) fm[1], toassoc, false, |
| 5164 |
|
Desktop.instance); |
| 5165 |
0 |
if (pe != null) |
| 5166 |
|
{ |
| 5167 |
0 |
jalview.bin.Console.errPrintln("Associated file : " |
| 5168 |
|
+ (fm[0].toString()) + " with " |
| 5169 |
|
+ toassoc.getDisplayId(true)); |
| 5170 |
0 |
assocfiles++; |
| 5171 |
|
} |
| 5172 |
|
} |
| 5173 |
|
|
| 5174 |
|
|
| 5175 |
0 |
alignPanel.paintAlignment(true, false); |
| 5176 |
|
} |
| 5177 |
|
} |
| 5178 |
|
else |
| 5179 |
|
{ |
| 5180 |
|
|
| 5181 |
|
|
| 5182 |
|
|
| 5183 |
0 |
for (Object[] o : filesmatched) |
| 5184 |
|
{ |
| 5185 |
0 |
filesnotmatched.add(new Object[] { o[0], o[1] }); |
| 5186 |
|
} |
| 5187 |
|
} |
| 5188 |
|
} |
| 5189 |
0 |
if (filesnotmatched.size() > 0) |
| 5190 |
|
{ |
| 5191 |
0 |
if (assocfiles > 0 && (Cache.getDefault( |
| 5192 |
|
"AUTOASSOCIATE_PDBANDSEQS_IGNOREOTHERS", false) |
| 5193 |
|
|| JvOptionPane.showConfirmDialog(thisaf, |
| 5194 |
|
"<html>" + MessageManager.formatMessage( |
| 5195 |
|
"label.ignore_unmatched_dropped_files_info", |
| 5196 |
|
new Object[] |
| 5197 |
|
{ Integer.valueOf( |
| 5198 |
|
filesnotmatched.size()) |
| 5199 |
|
.toString() }) |
| 5200 |
|
+ "</html>", |
| 5201 |
|
MessageManager.getString( |
| 5202 |
|
"label.ignore_unmatched_dropped_files"), |
| 5203 |
|
JvOptionPane.YES_NO_OPTION) == JvOptionPane.YES_OPTION)) |
| 5204 |
|
{ |
| 5205 |
0 |
return; |
| 5206 |
|
} |
| 5207 |
0 |
for (Object[] fn : filesnotmatched) |
| 5208 |
|
{ |
| 5209 |
0 |
loadJalviewDataFile(fn[0], (DataSourceType) fn[1], |
| 5210 |
|
(FileFormatI) fn[2], null); |
| 5211 |
|
} |
| 5212 |
|
|
| 5213 |
|
} |
| 5214 |
|
} catch (Exception ex) |
| 5215 |
|
{ |
| 5216 |
0 |
ex.printStackTrace(); |
| 5217 |
|
} |
| 5218 |
|
} |
| 5219 |
|
}).start(); |
| 5220 |
|
} |
| 5221 |
|
} |
| 5222 |
|
|
| 5223 |
|
|
| 5224 |
|
|
| 5225 |
|
|
| 5226 |
|
|
| 5227 |
|
|
| 5228 |
|
|
| 5229 |
|
|
| 5230 |
|
|
| 5231 |
|
|
| 5232 |
|
@param |
| 5233 |
|
|
| 5234 |
|
|
| |
|
| 58.5% |
Uncovered Elements: 39 (94) |
Complexity: 25 |
Complexity Density: 0.45 |
|
| 5235 |
11 |
public void loadJalviewDataFile(Object file, DataSourceType sourceType,... |
| 5236 |
|
FileFormatI format, SequenceI assocSeq) |
| 5237 |
|
{ |
| 5238 |
|
|
| 5239 |
11 |
try |
| 5240 |
|
{ |
| 5241 |
11 |
if (sourceType == null) |
| 5242 |
|
{ |
| 5243 |
6 |
sourceType = FormatAdapter.checkProtocol(file); |
| 5244 |
|
} |
| 5245 |
|
|
| 5246 |
|
|
| 5247 |
|
|
| 5248 |
11 |
boolean isAnnotation = (format == null |
| 5249 |
|
|| FileFormat.Pfam.equals(format)) |
| 5250 |
|
? new AnnotationFile().annotateAlignmentView(viewport, |
| 5251 |
|
file, sourceType) |
| 5252 |
|
: false; |
| 5253 |
|
|
| 5254 |
11 |
isAnnotation |= new IdentifyFile().identify(file, sourceType, |
| 5255 |
|
true) == FileFormat.JalviewAnnotation; |
| 5256 |
11 |
; |
| 5257 |
|
|
| 5258 |
11 |
if (!isAnnotation) |
| 5259 |
|
{ |
| 5260 |
|
|
| 5261 |
3 |
TCoffeeScoreFile tcf = null; |
| 5262 |
3 |
try |
| 5263 |
|
{ |
| 5264 |
3 |
tcf = new TCoffeeScoreFile(file, sourceType); |
| 5265 |
3 |
if (tcf.isValid()) |
| 5266 |
|
{ |
| 5267 |
1 |
if (tcf.annotateAlignment(viewport.getAlignment(), true)) |
| 5268 |
|
{ |
| 5269 |
1 |
buildColourMenu(); |
| 5270 |
1 |
changeColour( |
| 5271 |
|
new TCoffeeColourScheme(viewport.getAlignment())); |
| 5272 |
1 |
isAnnotation = true; |
| 5273 |
1 |
setStatus(MessageManager.getString( |
| 5274 |
|
"label.successfully_pasted_tcoffee_scores_to_alignment")); |
| 5275 |
|
} |
| 5276 |
|
else |
| 5277 |
|
{ |
| 5278 |
|
|
| 5279 |
|
|
| 5280 |
0 |
JvOptionPane.showMessageDialog(Desktop.desktop, |
| 5281 |
0 |
tcf.getWarningMessage() == null |
| 5282 |
|
? MessageManager.getString( |
| 5283 |
|
"label.check_file_matches_sequence_ids_alignment") |
| 5284 |
|
: tcf.getWarningMessage(), |
| 5285 |
|
MessageManager.getString( |
| 5286 |
|
"label.problem_reading_tcoffee_score_file"), |
| 5287 |
|
JvOptionPane.WARNING_MESSAGE); |
| 5288 |
|
} |
| 5289 |
|
} |
| 5290 |
|
else |
| 5291 |
|
{ |
| 5292 |
2 |
tcf = null; |
| 5293 |
|
} |
| 5294 |
|
} catch (Exception x) |
| 5295 |
|
{ |
| 5296 |
0 |
Console.debug( |
| 5297 |
|
"Exception when processing data source as T-COFFEE score file", |
| 5298 |
|
x); |
| 5299 |
0 |
tcf = null; |
| 5300 |
|
} |
| 5301 |
3 |
if (tcf == null) |
| 5302 |
|
{ |
| 5303 |
|
|
| 5304 |
|
|
| 5305 |
|
|
| 5306 |
2 |
if (format == null) |
| 5307 |
|
{ |
| 5308 |
2 |
format = new IdentifyFile().identify(file, sourceType); |
| 5309 |
|
} |
| 5310 |
2 |
if (FileFormat.FeatureSettings == format) |
| 5311 |
|
{ |
| 5312 |
0 |
if (featureSettings != null) |
| 5313 |
|
{ |
| 5314 |
0 |
featureSettings.load(file, sourceType); |
| 5315 |
|
} |
| 5316 |
|
else |
| 5317 |
|
{ |
| 5318 |
0 |
FeatureSettings.loadFeatureSettingsFile(getFeatureRenderer(), |
| 5319 |
|
fileObject, sourceType); |
| 5320 |
|
} |
| 5321 |
|
} |
| 5322 |
2 |
else if (FileFormat.ScoreMatrix == format) |
| 5323 |
|
{ |
| 5324 |
0 |
ScoreMatrixFile sm = new ScoreMatrixFile( |
| 5325 |
|
new FileParse(file, sourceType)); |
| 5326 |
0 |
sm.parse(); |
| 5327 |
|
|
| 5328 |
0 |
setStatus(MessageManager.formatMessage( |
| 5329 |
|
"label.successfully_loaded_matrix", |
| 5330 |
|
sm.getMatrixName())); |
| 5331 |
|
} |
| 5332 |
2 |
else if (FileFormat.Jnet.equals(format)) |
| 5333 |
|
{ |
| 5334 |
0 |
JPredFile predictions = new JPredFile(file, sourceType); |
| 5335 |
0 |
new JnetAnnotationMaker(); |
| 5336 |
0 |
JnetAnnotationMaker.add_annotation(predictions, |
| 5337 |
|
viewport.getAlignment(), 0, false); |
| 5338 |
0 |
viewport.getAlignment().setupJPredAlignment(); |
| 5339 |
0 |
isAnnotation = true; |
| 5340 |
|
} |
| 5341 |
|
|
| 5342 |
|
|
| 5343 |
2 |
else if (FileFormat.Features.equals(format)) |
| 5344 |
|
{ |
| 5345 |
2 |
if (parseFeaturesFile(file, sourceType)) |
| 5346 |
|
{ |
| 5347 |
2 |
SplitFrame splitFrame = (SplitFrame) getSplitViewContainer(); |
| 5348 |
2 |
if (splitFrame != null) |
| 5349 |
|
{ |
| 5350 |
0 |
splitFrame.repaint(); |
| 5351 |
|
} |
| 5352 |
|
else |
| 5353 |
|
{ |
| 5354 |
2 |
alignPanel.paintAlignment(true, true); |
| 5355 |
|
} |
| 5356 |
|
} |
| 5357 |
|
} |
| 5358 |
|
else |
| 5359 |
|
{ |
| 5360 |
0 |
new FileLoader().LoadFile(viewport, file, sourceType, format); |
| 5361 |
|
} |
| 5362 |
|
} |
| 5363 |
|
} |
| 5364 |
11 |
if (isAnnotation) |
| 5365 |
|
{ |
| 5366 |
9 |
viewport.updateSequenceIdColours(); |
| 5367 |
9 |
viewport.updateAnnotationColours(); |
| 5368 |
9 |
buildSortByAnnotationScoresMenu(); |
| 5369 |
9 |
alignPanel.alignmentChanged(); |
| 5370 |
9 |
viewport.updateSecondaryStructureConsensus(alignPanel); |
| 5371 |
9 |
viewport.alignmentChanged(alignPanel); |
| 5372 |
9 |
alignPanel.paintAlignment(true, true); |
| 5373 |
|
} |
| 5374 |
|
} catch (Exception ex) |
| 5375 |
|
{ |
| 5376 |
0 |
ex.printStackTrace(); |
| 5377 |
|
} catch (OutOfMemoryError oom) |
| 5378 |
|
{ |
| 5379 |
0 |
try |
| 5380 |
|
{ |
| 5381 |
0 |
System.gc(); |
| 5382 |
|
} catch (Exception x) |
| 5383 |
|
{ |
| 5384 |
|
} |
| 5385 |
0 |
new OOMWarning( |
| 5386 |
|
"loading data " |
| 5387 |
0 |
+ (sourceType != null |
| 5388 |
0 |
? (sourceType == DataSourceType.PASTE |
| 5389 |
|
? "from clipboard." |
| 5390 |
|
: "using " + sourceType + " from " |
| 5391 |
|
+ file) |
| 5392 |
|
: ".") |
| 5393 |
0 |
+ (format != null |
| 5394 |
|
? "(parsing as '" + format + "' file)" |
| 5395 |
|
: ""), |
| 5396 |
|
oom, Desktop.desktop); |
| 5397 |
|
} |
| 5398 |
|
} |
| 5399 |
|
|
| 5400 |
|
|
| 5401 |
|
|
| 5402 |
|
|
| 5403 |
|
|
| |
|
| 65.9% |
Uncovered Elements: 14 (41) |
Complexity: 11 |
Complexity Density: 0.44 |
|
| 5404 |
160 |
@Override... |
| 5405 |
|
public void tabSelectionChanged(int index) |
| 5406 |
|
{ |
| 5407 |
160 |
if (index > -1) |
| 5408 |
|
{ |
| 5409 |
|
|
| 5410 |
|
|
| 5411 |
|
|
| 5412 |
|
|
| 5413 |
105 |
alignPanel.setOverviewTitle(this); |
| 5414 |
|
|
| 5415 |
|
|
| 5416 |
|
|
| 5417 |
|
|
| 5418 |
|
|
| 5419 |
105 |
alignPanel = alignPanels.get(index); |
| 5420 |
105 |
alignPanel.setOverviewTitle(this); |
| 5421 |
|
|
| 5422 |
105 |
viewport = alignPanel.av; |
| 5423 |
105 |
avc.setViewportAndAlignmentPanel(viewport, alignPanel); |
| 5424 |
105 |
setMenusFromViewport(viewport); |
| 5425 |
105 |
if (featureSettings != null && featureSettings.isOpen() |
| 5426 |
|
&& featureSettings.fr.getViewport() != viewport) |
| 5427 |
|
{ |
| 5428 |
0 |
if (viewport.isShowSequenceFeatures()) |
| 5429 |
|
{ |
| 5430 |
|
|
| 5431 |
0 |
showFeatureSettingsUI(); |
| 5432 |
|
} |
| 5433 |
|
else |
| 5434 |
|
{ |
| 5435 |
|
|
| 5436 |
0 |
featureSettings.close(); |
| 5437 |
|
} |
| 5438 |
|
} |
| 5439 |
|
|
| 5440 |
|
} |
| 5441 |
|
|
| 5442 |
|
|
| 5443 |
|
|
| 5444 |
|
|
| 5445 |
160 |
if (viewport.getConservationSelected()) |
| 5446 |
|
{ |
| 5447 |
2 |
SliderPanel.setConservationSlider(alignPanel, |
| 5448 |
|
viewport.getResidueShading(), alignPanel.getViewName()); |
| 5449 |
|
} |
| 5450 |
|
else |
| 5451 |
|
{ |
| 5452 |
158 |
SliderPanel.hideConservationSlider(); |
| 5453 |
|
} |
| 5454 |
160 |
if (viewport.getByConsensusSecondaryStructureSelected()) |
| 5455 |
|
{ |
| 5456 |
0 |
SliderPanel.setConsensusSecondaryStructureSlider(alignPanel, |
| 5457 |
|
viewport.getResidueShading(), alignPanel.getViewName()); |
| 5458 |
|
} |
| 5459 |
|
else |
| 5460 |
|
{ |
| 5461 |
160 |
SliderPanel.hideConsensusSecondaryStructureSlider(); |
| 5462 |
|
} |
| 5463 |
160 |
if (viewport.getAbovePIDThreshold()) |
| 5464 |
|
{ |
| 5465 |
2 |
SliderPanel.setPIDSliderSource(alignPanel, |
| 5466 |
|
viewport.getResidueShading(), alignPanel.getViewName()); |
| 5467 |
|
} |
| 5468 |
|
else |
| 5469 |
|
{ |
| 5470 |
158 |
SliderPanel.hidePIDSlider(); |
| 5471 |
|
} |
| 5472 |
|
|
| 5473 |
|
|
| 5474 |
|
|
| 5475 |
|
|
| 5476 |
|
|
| 5477 |
|
|
| 5478 |
|
|
| 5479 |
|
|
| 5480 |
160 |
final AlignViewportI peer = viewport.getCodingComplement(); |
| 5481 |
160 |
if (peer != null) |
| 5482 |
|
{ |
| 5483 |
0 |
AlignFrame linkedAlignFrame = ((AlignViewport) peer) |
| 5484 |
|
.getAlignPanel().alignFrame; |
| 5485 |
0 |
if (linkedAlignFrame.tabbedPane.getTabCount() > index) |
| 5486 |
|
{ |
| 5487 |
0 |
linkedAlignFrame.tabbedPane.setSelectedIndex(index); |
| 5488 |
|
} |
| 5489 |
|
} |
| 5490 |
|
} |
| 5491 |
|
|
| 5492 |
|
|
| 5493 |
|
|
| 5494 |
|
|
| |
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 3 |
Complexity Density: 0.43 |
|
| 5495 |
0 |
@Override... |
| 5496 |
|
public void tabbedPane_mousePressed(MouseEvent e) |
| 5497 |
|
{ |
| 5498 |
0 |
if (e.isPopupTrigger()) |
| 5499 |
|
{ |
| 5500 |
0 |
String msg = MessageManager.getString("label.enter_view_name"); |
| 5501 |
0 |
String ttl = tabbedPane.getTitleAt(tabbedPane.getSelectedIndex()); |
| 5502 |
0 |
String reply = JvOptionPane.showInputDialog(msg, ttl); |
| 5503 |
|
|
| 5504 |
0 |
if (reply != null) |
| 5505 |
|
{ |
| 5506 |
0 |
viewport.setViewName(reply); |
| 5507 |
|
|
| 5508 |
0 |
tabbedPane.setTitleAt(tabbedPane.getSelectedIndex(), reply); |
| 5509 |
|
} |
| 5510 |
|
} |
| 5511 |
|
} |
| 5512 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 5513 |
231 |
public AlignViewport getCurrentView()... |
| 5514 |
|
{ |
| 5515 |
231 |
return viewport; |
| 5516 |
|
} |
| 5517 |
|
|
| 5518 |
|
|
| 5519 |
|
|
| 5520 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 5521 |
0 |
@Override... |
| 5522 |
|
protected void extractScores_actionPerformed(ActionEvent e) |
| 5523 |
|
{ |
| 5524 |
0 |
ParseProperties pp = new jalview.analysis.ParseProperties( |
| 5525 |
|
viewport.getAlignment()); |
| 5526 |
|
|
| 5527 |
|
|
| 5528 |
|
|
| 5529 |
|
|
| 5530 |
0 |
if (pp.getScoresFromDescription("description column", |
| 5531 |
|
"score in description column ", "\\W*([-+eE0-9.]+)", true) > 0) |
| 5532 |
|
{ |
| 5533 |
0 |
buildSortByAnnotationScoresMenu(); |
| 5534 |
|
} |
| 5535 |
|
} |
| 5536 |
|
|
| 5537 |
|
|
| 5538 |
|
|
| 5539 |
|
|
| 5540 |
|
@see |
| 5541 |
|
|
| 5542 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 5543 |
0 |
@Override... |
| 5544 |
|
protected void showDbRefs_actionPerformed(ActionEvent e) |
| 5545 |
|
{ |
| 5546 |
0 |
viewport.setShowDBRefs(showDbRefsMenuitem.isSelected()); |
| 5547 |
|
} |
| 5548 |
|
|
| 5549 |
|
|
| 5550 |
|
|
| 5551 |
|
|
| 5552 |
|
|
| 5553 |
|
|
| 5554 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 5555 |
0 |
@Override... |
| 5556 |
|
protected void showNpFeats_actionPerformed(ActionEvent e) |
| 5557 |
|
{ |
| 5558 |
0 |
viewport.setShowNPFeats(showNpFeatsMenuitem.isSelected()); |
| 5559 |
|
} |
| 5560 |
|
|
| 5561 |
|
|
| 5562 |
|
|
| 5563 |
|
|
| 5564 |
|
|
| 5565 |
|
@param |
| 5566 |
|
|
| |
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 6 |
Complexity Density: 0.6 |
|
| 5567 |
0 |
public boolean closeView(AlignViewportI av)... |
| 5568 |
|
{ |
| 5569 |
0 |
if (viewport == av) |
| 5570 |
|
{ |
| 5571 |
0 |
this.closeMenuItem_actionPerformed(false); |
| 5572 |
0 |
return true; |
| 5573 |
|
} |
| 5574 |
0 |
Component[] comp = tabbedPane.getComponents(); |
| 5575 |
0 |
for (int i = 0; comp != null && i < comp.length; i++) |
| 5576 |
|
{ |
| 5577 |
0 |
if (comp[i] instanceof AlignmentPanel) |
| 5578 |
|
{ |
| 5579 |
0 |
if (((AlignmentPanel) comp[i]).av == av) |
| 5580 |
|
{ |
| 5581 |
|
|
| 5582 |
0 |
closeView((AlignmentPanel) comp[i]); |
| 5583 |
0 |
return true; |
| 5584 |
|
} |
| 5585 |
|
} |
| 5586 |
|
} |
| 5587 |
0 |
return false; |
| 5588 |
|
} |
| 5589 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
|
| 5590 |
3029 |
protected void build_fetchdbmenu(JMenu webService)... |
| 5591 |
|
{ |
| 5592 |
|
|
| 5593 |
|
|
| 5594 |
|
|
| 5595 |
|
|
| 5596 |
3029 |
final JMenu rfetch = new JMenu( |
| 5597 |
|
MessageManager.getString("action.fetch_db_references")); |
| 5598 |
3029 |
rfetch.setToolTipText(MessageManager.getString( |
| 5599 |
|
"label.retrieve_parse_sequence_database_records_alignment_or_selected_sequences")); |
| 5600 |
3029 |
webService.add(rfetch); |
| 5601 |
|
|
| 5602 |
3029 |
final JCheckBoxMenuItem trimrs = new JCheckBoxMenuItem( |
| 5603 |
|
MessageManager.getString("option.trim_retrieved_seqs")); |
| 5604 |
3029 |
trimrs.setToolTipText( |
| 5605 |
|
MessageManager.getString("label.trim_retrieved_sequences")); |
| 5606 |
3029 |
trimrs.setSelected( |
| 5607 |
|
Cache.getDefault(DBRefFetcher.TRIM_RETRIEVED_SEQUENCES, true)); |
| 5608 |
3029 |
trimrs.addActionListener(new ActionListener() |
| 5609 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 5610 |
0 |
@Override... |
| 5611 |
|
public void actionPerformed(ActionEvent e) |
| 5612 |
|
{ |
| 5613 |
0 |
trimrs.setSelected(trimrs.isSelected()); |
| 5614 |
0 |
Cache.setProperty(DBRefFetcher.TRIM_RETRIEVED_SEQUENCES, |
| 5615 |
|
Boolean.valueOf(trimrs.isSelected()).toString()); |
| 5616 |
|
} |
| 5617 |
|
}); |
| 5618 |
3029 |
rfetch.add(trimrs); |
| 5619 |
3029 |
JMenuItem fetchr = new JMenuItem( |
| 5620 |
|
MessageManager.getString("label.standard_databases")); |
| 5621 |
3029 |
fetchr.setToolTipText( |
| 5622 |
|
MessageManager.getString("label.fetch_embl_uniprot")); |
| 5623 |
3029 |
fetchr.addActionListener(new ActionListener() |
| 5624 |
|
{ |
| 5625 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 5626 |
0 |
@Override... |
| 5627 |
|
public void actionPerformed(ActionEvent e) |
| 5628 |
|
{ |
| 5629 |
0 |
new Thread(new Runnable() |
| 5630 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 5631 |
0 |
@Override... |
| 5632 |
|
public void run() |
| 5633 |
|
{ |
| 5634 |
0 |
boolean isNucleotide = alignPanel.alignFrame.getViewport() |
| 5635 |
|
.getAlignment().isNucleotide(); |
| 5636 |
0 |
DBRefFetcher dbRefFetcher = new DBRefFetcher( |
| 5637 |
|
alignPanel.av.getSequenceSelection(), |
| 5638 |
|
alignPanel.alignFrame, null, |
| 5639 |
|
alignPanel.alignFrame.featureSettings, isNucleotide); |
| 5640 |
0 |
dbRefFetcher.addListener(new FetchFinishedListenerI() |
| 5641 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 5642 |
0 |
@Override... |
| 5643 |
|
public void finished() |
| 5644 |
|
{ |
| 5645 |
|
|
| 5646 |
0 |
for (FeatureSettingsModelI srcSettings : dbRefFetcher |
| 5647 |
|
.getFeatureSettingsModels()) |
| 5648 |
|
{ |
| 5649 |
|
|
| 5650 |
0 |
alignPanel.av.mergeFeaturesStyle(srcSettings); |
| 5651 |
|
} |
| 5652 |
0 |
AlignFrame.this.setMenusForViewport(); |
| 5653 |
|
} |
| 5654 |
|
}); |
| 5655 |
0 |
dbRefFetcher.fetchDBRefs(false); |
| 5656 |
|
} |
| 5657 |
|
}).start(); |
| 5658 |
|
|
| 5659 |
|
} |
| 5660 |
|
|
| 5661 |
|
}); |
| 5662 |
3029 |
rfetch.add(fetchr); |
| 5663 |
3029 |
new Thread(new Runnable() |
| 5664 |
|
{ |
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 5665 |
3029 |
@Override... |
| 5666 |
|
public void run() |
| 5667 |
|
{ |
| 5668 |
3029 |
final jalview.ws.SequenceFetcher sf = jalview.gui.SequenceFetcher |
| 5669 |
|
.getSequenceFetcherSingleton(); |
| 5670 |
3029 |
javax.swing.SwingUtilities.invokeLater(new Runnable() |
| 5671 |
|
{ |
| |
|
| 45.3% |
Uncovered Elements: 41 (75) |
Complexity: 12 |
Complexity Density: 0.2 |
|
| 5672 |
3029 |
@Override... |
| 5673 |
|
public void run() |
| 5674 |
|
{ |
| 5675 |
3029 |
String[] dbclasses = sf.getNonAlignmentSources(); |
| 5676 |
3029 |
List<DbSourceProxy> otherdb; |
| 5677 |
3029 |
JMenu dfetch = new JMenu(); |
| 5678 |
3029 |
JMenu ifetch = new JMenu(); |
| 5679 |
3029 |
JMenuItem fetchr = null; |
| 5680 |
3029 |
int comp = 0, icomp = 0, mcomp = 15; |
| 5681 |
3029 |
String mname = null; |
| 5682 |
3029 |
int dbi = 0; |
| 5683 |
3029 |
for (String dbclass : dbclasses) |
| 5684 |
|
{ |
| 5685 |
15145 |
otherdb = sf.getSourceProxy(dbclass); |
| 5686 |
|
|
| 5687 |
|
|
| 5688 |
15145 |
if (otherdb == null || otherdb.size() < 1) |
| 5689 |
|
{ |
| 5690 |
0 |
continue; |
| 5691 |
|
} |
| 5692 |
15145 |
if (mname == null) |
| 5693 |
|
{ |
| 5694 |
3029 |
mname = "From " + dbclass; |
| 5695 |
|
} |
| 5696 |
15145 |
if (otherdb.size() == 1) |
| 5697 |
|
{ |
| 5698 |
15145 |
final DbSourceProxy[] dassource = otherdb |
| 5699 |
|
.toArray(new DbSourceProxy[0]); |
| 5700 |
15145 |
DbSourceProxy src = otherdb.get(0); |
| 5701 |
15145 |
fetchr = new JMenuItem(src.getDbSource()); |
| 5702 |
15145 |
fetchr.addActionListener(new ActionListener() |
| 5703 |
|
{ |
| 5704 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 5705 |
0 |
@Override... |
| 5706 |
|
public void actionPerformed(ActionEvent e) |
| 5707 |
|
{ |
| 5708 |
0 |
new Thread(new Runnable() |
| 5709 |
|
{ |
| 5710 |
|
|
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 5711 |
0 |
@Override... |
| 5712 |
|
public void run() |
| 5713 |
|
{ |
| 5714 |
0 |
boolean isNucleotide = alignPanel.alignFrame |
| 5715 |
|
.getViewport().getAlignment() |
| 5716 |
|
.isNucleotide(); |
| 5717 |
0 |
DBRefFetcher dbRefFetcher = new DBRefFetcher( |
| 5718 |
|
alignPanel.av.getSequenceSelection(), |
| 5719 |
|
alignPanel.alignFrame, dassource, |
| 5720 |
|
alignPanel.alignFrame.featureSettings, |
| 5721 |
|
isNucleotide); |
| 5722 |
0 |
dbRefFetcher |
| 5723 |
|
.addListener(new FetchFinishedListenerI() |
| 5724 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 5725 |
0 |
@Override... |
| 5726 |
|
public void finished() |
| 5727 |
|
{ |
| 5728 |
0 |
FeatureSettingsModelI srcSettings = dassource[0] |
| 5729 |
|
.getFeatureColourScheme(); |
| 5730 |
0 |
alignPanel.av.mergeFeaturesStyle( |
| 5731 |
|
srcSettings); |
| 5732 |
0 |
AlignFrame.this.setMenusForViewport(); |
| 5733 |
|
} |
| 5734 |
|
}); |
| 5735 |
0 |
dbRefFetcher.fetchDBRefs(false); |
| 5736 |
|
} |
| 5737 |
|
}).start(); |
| 5738 |
|
} |
| 5739 |
|
|
| 5740 |
|
}); |
| 5741 |
15145 |
fetchr.setToolTipText(JvSwingUtils.wrapTooltip(true, |
| 5742 |
|
MessageManager.formatMessage( |
| 5743 |
|
"label.fetch_retrieve_from", new Object[] |
| 5744 |
|
{ src.getDbName() }))); |
| 5745 |
15145 |
dfetch.add(fetchr); |
| 5746 |
15145 |
comp++; |
| 5747 |
|
} |
| 5748 |
|
else |
| 5749 |
|
{ |
| 5750 |
0 |
final DbSourceProxy[] dassource = otherdb |
| 5751 |
|
.toArray(new DbSourceProxy[0]); |
| 5752 |
|
|
| 5753 |
0 |
DbSourceProxy src = otherdb.get(0); |
| 5754 |
0 |
fetchr = new JMenuItem(MessageManager |
| 5755 |
|
.formatMessage("label.fetch_all_param", new Object[] |
| 5756 |
|
{ src.getDbSource() })); |
| 5757 |
0 |
fetchr.addActionListener(new ActionListener() |
| 5758 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 5759 |
0 |
@Override... |
| 5760 |
|
public void actionPerformed(ActionEvent e) |
| 5761 |
|
{ |
| 5762 |
0 |
new Thread(new Runnable() |
| 5763 |
|
{ |
| 5764 |
|
|
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 5765 |
0 |
@Override... |
| 5766 |
|
public void run() |
| 5767 |
|
{ |
| 5768 |
0 |
boolean isNucleotide = alignPanel.alignFrame |
| 5769 |
|
.getViewport().getAlignment() |
| 5770 |
|
.isNucleotide(); |
| 5771 |
0 |
DBRefFetcher dbRefFetcher = new DBRefFetcher( |
| 5772 |
|
alignPanel.av.getSequenceSelection(), |
| 5773 |
|
alignPanel.alignFrame, dassource, |
| 5774 |
|
alignPanel.alignFrame.featureSettings, |
| 5775 |
|
isNucleotide); |
| 5776 |
0 |
dbRefFetcher |
| 5777 |
|
.addListener(new FetchFinishedListenerI() |
| 5778 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 5779 |
0 |
@Override... |
| 5780 |
|
public void finished() |
| 5781 |
|
{ |
| 5782 |
0 |
AlignFrame.this.setMenusForViewport(); |
| 5783 |
|
} |
| 5784 |
|
}); |
| 5785 |
0 |
dbRefFetcher.fetchDBRefs(false); |
| 5786 |
|
} |
| 5787 |
|
}).start(); |
| 5788 |
|
} |
| 5789 |
|
}); |
| 5790 |
|
|
| 5791 |
0 |
fetchr.setToolTipText(JvSwingUtils.wrapTooltip(true, |
| 5792 |
|
MessageManager.formatMessage( |
| 5793 |
|
"label.fetch_retrieve_from_all_sources", |
| 5794 |
|
new Object[] |
| 5795 |
|
{ Integer.valueOf(otherdb.size()) |
| 5796 |
|
.toString(), |
| 5797 |
|
src.getDbSource(), src.getDbName() }))); |
| 5798 |
0 |
dfetch.add(fetchr); |
| 5799 |
0 |
comp++; |
| 5800 |
|
|
| 5801 |
0 |
ifetch = new JMenu(MessageManager.formatMessage( |
| 5802 |
|
"label.source_from_db_source", new Object[] |
| 5803 |
|
{ src.getDbSource() })); |
| 5804 |
0 |
icomp = 0; |
| 5805 |
0 |
String imname = null; |
| 5806 |
0 |
int i = 0; |
| 5807 |
0 |
for (DbSourceProxy sproxy : otherdb) |
| 5808 |
|
{ |
| 5809 |
0 |
String dbname = sproxy.getDbName(); |
| 5810 |
0 |
String sname = dbname.length() > 5 |
| 5811 |
|
? dbname.substring(0, 5) + "..." |
| 5812 |
|
: dbname; |
| 5813 |
0 |
String msname = dbname.length() > 10 |
| 5814 |
|
? dbname.substring(0, 10) + "..." |
| 5815 |
|
: dbname; |
| 5816 |
0 |
if (imname == null) |
| 5817 |
|
{ |
| 5818 |
0 |
imname = MessageManager |
| 5819 |
|
.formatMessage("label.from_msname", new Object[] |
| 5820 |
|
{ sname }); |
| 5821 |
|
} |
| 5822 |
0 |
fetchr = new JMenuItem(msname); |
| 5823 |
0 |
final DbSourceProxy[] dassrc = { sproxy }; |
| 5824 |
0 |
fetchr.addActionListener(new ActionListener() |
| 5825 |
|
{ |
| 5826 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 5827 |
0 |
@Override... |
| 5828 |
|
public void actionPerformed(ActionEvent e) |
| 5829 |
|
{ |
| 5830 |
0 |
new Thread(new Runnable() |
| 5831 |
|
{ |
| 5832 |
|
|
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 5833 |
0 |
@Override... |
| 5834 |
|
public void run() |
| 5835 |
|
{ |
| 5836 |
0 |
boolean isNucleotide = alignPanel.alignFrame |
| 5837 |
|
.getViewport().getAlignment() |
| 5838 |
|
.isNucleotide(); |
| 5839 |
0 |
DBRefFetcher dbRefFetcher = new DBRefFetcher( |
| 5840 |
|
alignPanel.av.getSequenceSelection(), |
| 5841 |
|
alignPanel.alignFrame, dassrc, |
| 5842 |
|
alignPanel.alignFrame.featureSettings, |
| 5843 |
|
isNucleotide); |
| 5844 |
0 |
dbRefFetcher |
| 5845 |
|
.addListener(new FetchFinishedListenerI() |
| 5846 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 5847 |
0 |
@Override... |
| 5848 |
|
public void finished() |
| 5849 |
|
{ |
| 5850 |
0 |
AlignFrame.this.setMenusForViewport(); |
| 5851 |
|
} |
| 5852 |
|
}); |
| 5853 |
0 |
dbRefFetcher.fetchDBRefs(false); |
| 5854 |
|
} |
| 5855 |
|
}).start(); |
| 5856 |
|
} |
| 5857 |
|
|
| 5858 |
|
}); |
| 5859 |
0 |
fetchr.setToolTipText( |
| 5860 |
|
"<html>" + MessageManager.formatMessage( |
| 5861 |
|
"label.fetch_retrieve_from", new Object[] |
| 5862 |
|
{ dbname })); |
| 5863 |
0 |
ifetch.add(fetchr); |
| 5864 |
0 |
++i; |
| 5865 |
0 |
if (++icomp >= mcomp || i == (otherdb.size())) |
| 5866 |
|
{ |
| 5867 |
0 |
ifetch.setText(MessageManager.formatMessage( |
| 5868 |
|
"label.source_to_target", imname, sname)); |
| 5869 |
0 |
dfetch.add(ifetch); |
| 5870 |
0 |
ifetch = new JMenu(); |
| 5871 |
0 |
imname = null; |
| 5872 |
0 |
icomp = 0; |
| 5873 |
0 |
comp++; |
| 5874 |
|
} |
| 5875 |
|
} |
| 5876 |
|
} |
| 5877 |
15145 |
++dbi; |
| 5878 |
15145 |
if (comp >= mcomp || dbi >= (dbclasses.length)) |
| 5879 |
|
{ |
| 5880 |
3029 |
dfetch.setText(MessageManager.formatMessage( |
| 5881 |
|
"label.source_to_target", mname, dbclass)); |
| 5882 |
3029 |
rfetch.add(dfetch); |
| 5883 |
3029 |
dfetch = new JMenu(); |
| 5884 |
3029 |
mname = null; |
| 5885 |
3029 |
comp = 0; |
| 5886 |
|
} |
| 5887 |
|
} |
| 5888 |
|
} |
| 5889 |
|
|
| 5890 |
|
}); |
| 5891 |
|
} |
| 5892 |
|
}).start(); |
| 5893 |
|
|
| 5894 |
|
} |
| 5895 |
|
|
| 5896 |
|
|
| 5897 |
|
|
| 5898 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 5899 |
0 |
@Override... |
| 5900 |
|
protected void justifyLeftMenuItem_actionPerformed(ActionEvent e) |
| 5901 |
|
{ |
| 5902 |
0 |
avc.justify_Region(true); |
| 5903 |
|
} |
| 5904 |
|
|
| 5905 |
|
|
| 5906 |
|
|
| 5907 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 5908 |
0 |
@Override... |
| 5909 |
|
protected void justifyRightMenuItem_actionPerformed(ActionEvent e) |
| 5910 |
|
{ |
| 5911 |
0 |
avc.justify_Region(false); |
| 5912 |
|
} |
| 5913 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 5914 |
16 |
@Override... |
| 5915 |
|
public void setShowSeqFeatures(boolean b) |
| 5916 |
|
{ |
| 5917 |
16 |
showSeqFeatures.setSelected(b); |
| 5918 |
16 |
viewport.setShowSequenceFeatures(b); |
| 5919 |
|
} |
| 5920 |
|
|
| 5921 |
|
|
| 5922 |
|
|
| 5923 |
|
|
| 5924 |
|
@see |
| 5925 |
|
|
| 5926 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 5927 |
0 |
@Override... |
| 5928 |
|
protected void showUnconservedMenuItem_actionPerformed(ActionEvent e) |
| 5929 |
|
{ |
| 5930 |
0 |
viewport.setShowUnconserved(showNonconservedMenuItem.getState()); |
| 5931 |
0 |
alignPanel.paintAlignment(false, false); |
| 5932 |
|
} |
| 5933 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 5934 |
0 |
@Override... |
| 5935 |
|
protected void showStructureProvider_actionPerformed(ActionEvent e) |
| 5936 |
|
{ |
| 5937 |
0 |
viewport.setShowStructureProvider(showStrucProvider.getState()); |
| 5938 |
0 |
alignPanel.paintAlignment(false, false); |
| 5939 |
|
|
| 5940 |
|
} |
| 5941 |
|
|
| |
|
| 0% |
Uncovered Elements: 37 (37) |
Complexity: 6 |
Complexity Density: 0.22 |
|
| 5942 |
0 |
@Override... |
| 5943 |
|
protected void updateShowSecondaryStructureMenu(JMenu showSS, |
| 5944 |
|
ButtonGroup ssButtonGroup) |
| 5945 |
|
{ |
| 5946 |
|
|
| 5947 |
0 |
List<String> ssSources = new ArrayList<String>(); |
| 5948 |
0 |
AlignmentAnnotation[] anns = alignPanel.getAlignment() |
| 5949 |
|
.getAlignmentAnnotation(); |
| 5950 |
0 |
Map<String, JCheckBoxMenuItem> checkboxMap = getCheckboxesInMenu( |
| 5951 |
|
showSS); |
| 5952 |
|
|
| 5953 |
0 |
ssSources = AlignmentUtils.extractSSSourceInAlignmentAnnotation(anns); |
| 5954 |
|
|
| 5955 |
0 |
if (ssSources == null) |
| 5956 |
|
{ |
| 5957 |
0 |
showSS.removeAll(); |
| 5958 |
0 |
ssButtonGroup.clearSelection(); |
| 5959 |
0 |
return; |
| 5960 |
|
} |
| 5961 |
|
|
| 5962 |
0 |
List<String> selectedCheckBoxes = getSelectedOptions(checkboxMap); |
| 5963 |
|
|
| 5964 |
|
|
| 5965 |
0 |
for (String ssSource : ssSources) |
| 5966 |
|
{ |
| 5967 |
|
|
| 5968 |
0 |
if (checkboxMap.get(ssSource) == null) |
| 5969 |
|
{ |
| 5970 |
0 |
JCheckBoxMenuItem checkBox = new JCheckBoxMenuItem(ssSource); |
| 5971 |
0 |
checkBox.setSelected(false); |
| 5972 |
|
|
| 5973 |
0 |
checkBox.addItemListener(e -> { |
| 5974 |
0 |
if (e.getStateChange() == ItemEvent.SELECTED) |
| 5975 |
|
{ |
| 5976 |
|
|
| 5977 |
0 |
showOrHideSecondaryStructureForSource(ssSource, true); |
| 5978 |
|
|
| 5979 |
|
} |
| 5980 |
|
else |
| 5981 |
|
{ |
| 5982 |
|
|
| 5983 |
0 |
showOrHideSecondaryStructureForSource(ssSource, false); |
| 5984 |
|
|
| 5985 |
|
} |
| 5986 |
|
}); |
| 5987 |
0 |
showSS.add(checkBox); |
| 5988 |
|
} |
| 5989 |
|
} |
| 5990 |
|
|
| 5991 |
0 |
for (String key : checkboxMap.keySet()) |
| 5992 |
|
{ |
| 5993 |
|
|
| 5994 |
0 |
if (!ssSources.contains(key)) |
| 5995 |
|
{ |
| 5996 |
0 |
showSS.remove(checkboxMap.get(key)); |
| 5997 |
0 |
checkboxMap.remove(key); |
| 5998 |
0 |
selectedCheckBoxes.remove(key); |
| 5999 |
|
} |
| 6000 |
0 |
if (selectedCheckBoxes.contains(key)) |
| 6001 |
|
{ |
| 6002 |
0 |
checkboxMap.get(key).setSelected(true); |
| 6003 |
|
} |
| 6004 |
|
else |
| 6005 |
|
{ |
| 6006 |
0 |
checkboxMap.get(key).setSelected(false); |
| 6007 |
|
} |
| 6008 |
|
|
| 6009 |
0 |
ssButtonGroup.clearSelection(); |
| 6010 |
|
} |
| 6011 |
|
|
| 6012 |
|
} |
| 6013 |
|
|
| |
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
| 6014 |
0 |
private List<String> getSelectedOptions(... |
| 6015 |
|
Map<String, JCheckBoxMenuItem> checkboxMap) |
| 6016 |
|
{ |
| 6017 |
0 |
List<String> selectedOptions = new ArrayList<>(); |
| 6018 |
0 |
for (String key : checkboxMap.keySet()) |
| 6019 |
|
{ |
| 6020 |
0 |
JCheckBoxMenuItem checkbox = checkboxMap.get(key); |
| 6021 |
0 |
if (checkbox.isSelected()) |
| 6022 |
|
{ |
| 6023 |
0 |
selectedOptions.add(key); |
| 6024 |
|
} |
| 6025 |
|
} |
| 6026 |
0 |
return selectedOptions; |
| 6027 |
|
} |
| 6028 |
|
|
| |
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
| 6029 |
0 |
private Map<String, JCheckBoxMenuItem> getCheckboxesInMenu(JMenu menu)... |
| 6030 |
|
{ |
| 6031 |
0 |
Map<String, JCheckBoxMenuItem> checkboxMap = new HashMap<>(); |
| 6032 |
0 |
for (Component component : menu.getMenuComponents()) |
| 6033 |
|
{ |
| 6034 |
0 |
if (component instanceof JCheckBoxMenuItem) |
| 6035 |
|
{ |
| 6036 |
0 |
JCheckBoxMenuItem checkbox = (JCheckBoxMenuItem) component; |
| 6037 |
0 |
checkboxMap.put(checkbox.getText(), checkbox); |
| 6038 |
|
} |
| 6039 |
|
} |
| 6040 |
0 |
return checkboxMap; |
| 6041 |
|
} |
| 6042 |
|
|
| |
|
| 0% |
Uncovered Elements: 36 (36) |
Complexity: 11 |
Complexity Density: 0.46 |
|
| 6043 |
0 |
@Override... |
| 6044 |
|
protected void showOrHideSecondaryStructureForSource( |
| 6045 |
|
String ssSourceSelection, boolean visible) |
| 6046 |
|
{ |
| 6047 |
|
|
| 6048 |
0 |
String _noneOption = MessageManager |
| 6049 |
|
.getString("option.ss_providers_none"); |
| 6050 |
0 |
boolean nonOption = ssSourceSelection != null |
| 6051 |
|
&& ssSourceSelection.equals(_noneOption); |
| 6052 |
0 |
String allOption = MessageManager.getString("option.ss_providers_all"); |
| 6053 |
|
|
| 6054 |
0 |
AlignmentAnnotation[] annotations = alignPanel.getAlignment() |
| 6055 |
|
.getAlignmentAnnotation(); |
| 6056 |
|
|
| 6057 |
0 |
for (AlignmentAnnotation aa : annotations) |
| 6058 |
|
{ |
| 6059 |
|
|
| 6060 |
0 |
if (aa.groupRef != null) |
| 6061 |
|
{ |
| 6062 |
0 |
continue; |
| 6063 |
|
} |
| 6064 |
|
|
| 6065 |
0 |
boolean isSSConsensus = aa.label.startsWith( |
| 6066 |
|
MessageManager.getString("label.ssconsensus_label")); |
| 6067 |
0 |
boolean matchesSSSourceSelection = aa.description |
| 6068 |
|
.startsWith(ssSourceSelection); |
| 6069 |
|
|
| 6070 |
0 |
if (isSSConsensus && (matchesSSSourceSelection || nonOption)) |
| 6071 |
|
{ |
| 6072 |
|
|
| 6073 |
0 |
if (ssSourceSelection.equals(allOption)) |
| 6074 |
|
{ |
| 6075 |
0 |
aa.visible = true; |
| 6076 |
0 |
break; |
| 6077 |
|
} |
| 6078 |
|
|
| 6079 |
0 |
if (!aa.description.startsWith(allOption)) |
| 6080 |
0 |
aa.visible = visible; |
| 6081 |
|
|
| 6082 |
|
} |
| 6083 |
|
|
| 6084 |
0 |
for (String label : Constants.SECONDARY_STRUCTURE_LABELS.keySet()) |
| 6085 |
|
{ |
| 6086 |
|
|
| 6087 |
0 |
if (label.equals(aa.label)) |
| 6088 |
|
{ |
| 6089 |
|
|
| 6090 |
0 |
String ssSource = AlignmentAnnotationUtils |
| 6091 |
|
.extractSSSourceFromAnnotationDescription(aa); |
| 6092 |
|
|
| 6093 |
0 |
if (nonOption || ssSource != null |
| 6094 |
|
&& (ssSource.equals(ssSourceSelection))) |
| 6095 |
|
{ |
| 6096 |
0 |
aa.visible = visible; |
| 6097 |
|
} |
| 6098 |
|
} |
| 6099 |
|
} |
| 6100 |
|
|
| 6101 |
|
} |
| 6102 |
|
|
| 6103 |
0 |
PaintRefresher.Refresh(this, viewport.getSequenceSetId()); |
| 6104 |
0 |
alignPanel.updateAnnotation(); |
| 6105 |
0 |
viewport.updateSecondaryStructureConsensus(alignPanel); |
| 6106 |
0 |
alignPanel.paintAlignment(true, true); |
| 6107 |
|
|
| 6108 |
|
} |
| 6109 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 6110 |
0 |
@Override... |
| 6111 |
|
protected void showSSConsensus_actionPerformed(ActionEvent e) |
| 6112 |
|
{ |
| 6113 |
0 |
viewport.setShowSSConsensus(showSSConsensus.getState()); |
| 6114 |
0 |
viewport.updateSecondaryStructureConsensus(alignPanel); |
| 6115 |
0 |
alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); |
| 6116 |
|
} |
| 6117 |
|
|
| 6118 |
|
|
| 6119 |
|
|
| 6120 |
|
|
| 6121 |
|
@see |
| 6122 |
|
|
| 6123 |
|
|
| 6124 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 6125 |
0 |
@Override... |
| 6126 |
|
protected void showGroupConsensus_actionPerformed(ActionEvent e) |
| 6127 |
|
{ |
| 6128 |
0 |
viewport.setShowGroupConsensus(showGroupConsensus.getState()); |
| 6129 |
0 |
alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); |
| 6130 |
|
|
| 6131 |
|
} |
| 6132 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 6133 |
0 |
@Override... |
| 6134 |
|
protected void showGroupSSConsensus_actionPerformed(ActionEvent e) |
| 6135 |
|
{ |
| 6136 |
0 |
viewport.setShowGroupSSConsensus(showGroupSSConsensus.getState()); |
| 6137 |
0 |
alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); |
| 6138 |
|
|
| 6139 |
|
} |
| 6140 |
|
|
| 6141 |
|
|
| 6142 |
|
|
| 6143 |
|
|
| 6144 |
|
@see |
| 6145 |
|
|
| 6146 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 6147 |
0 |
@Override... |
| 6148 |
|
protected void showGroupConservation_actionPerformed(ActionEvent e) |
| 6149 |
|
{ |
| 6150 |
0 |
viewport.setShowGroupConservation(showGroupConservation.getState()); |
| 6151 |
0 |
alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); |
| 6152 |
|
} |
| 6153 |
|
|
| 6154 |
|
|
| 6155 |
|
|
| 6156 |
|
|
| 6157 |
|
@see |
| 6158 |
|
|
| 6159 |
|
|
| 6160 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 6161 |
0 |
@Override... |
| 6162 |
|
protected void showConsensusHistogram_actionPerformed(ActionEvent e) |
| 6163 |
|
{ |
| 6164 |
0 |
viewport.setShowConsensusHistogram(showConsensusHistogram.getState()); |
| 6165 |
0 |
alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); |
| 6166 |
|
} |
| 6167 |
|
|
| 6168 |
|
|
| 6169 |
|
|
| 6170 |
|
|
| 6171 |
|
@see |
| 6172 |
|
|
| 6173 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 6174 |
0 |
@Override... |
| 6175 |
|
protected void showSequenceLogo_actionPerformed(ActionEvent e) |
| 6176 |
|
{ |
| 6177 |
0 |
viewport.setShowSequenceLogo(showSequenceLogo.getState()); |
| 6178 |
0 |
alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); |
| 6179 |
|
} |
| 6180 |
|
|
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 6181 |
0 |
@Override... |
| 6182 |
|
protected void normaliseSequenceLogo_actionPerformed(ActionEvent e) |
| 6183 |
|
{ |
| 6184 |
0 |
showSequenceLogo.setState(true); |
| 6185 |
0 |
viewport.setShowSequenceLogo(true); |
| 6186 |
0 |
viewport.setNormaliseSequenceLogo(normaliseSequenceLogo.getState()); |
| 6187 |
0 |
alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); |
| 6188 |
|
} |
| 6189 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 6190 |
0 |
@Override... |
| 6191 |
|
protected void applyAutoAnnotationSettings_actionPerformed(ActionEvent e) |
| 6192 |
|
{ |
| 6193 |
0 |
alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); |
| 6194 |
|
} |
| 6195 |
|
|
| 6196 |
|
|
| 6197 |
|
|
| 6198 |
|
|
| 6199 |
|
@see |
| 6200 |
|
|
| 6201 |
|
|
| |
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 6202 |
0 |
@Override... |
| 6203 |
|
protected void makeGrpsFromSelection_actionPerformed(ActionEvent e) |
| 6204 |
|
{ |
| 6205 |
0 |
if (avc.makeGroupsFromSelection()) |
| 6206 |
|
{ |
| 6207 |
0 |
PaintRefresher.Refresh(this, viewport.getSequenceSetId()); |
| 6208 |
0 |
alignPanel.updateAnnotation(); |
| 6209 |
0 |
alignPanel.paintAlignment(true, |
| 6210 |
|
viewport.needToUpdateStructureViews()); |
| 6211 |
|
} |
| 6212 |
|
} |
| 6213 |
|
|
| |
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 6214 |
0 |
public void clearAlignmentSeqRep()... |
| 6215 |
|
{ |
| 6216 |
|
|
| 6217 |
0 |
if (viewport.getAlignment().hasSeqrep()) |
| 6218 |
|
{ |
| 6219 |
0 |
viewport.getAlignment().setSeqrep(null); |
| 6220 |
0 |
PaintRefresher.Refresh(this, viewport.getSequenceSetId()); |
| 6221 |
0 |
alignPanel.updateAnnotation(); |
| 6222 |
0 |
alignPanel.paintAlignment(true, true); |
| 6223 |
|
} |
| 6224 |
|
} |
| 6225 |
|
|
| |
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 3 |
Complexity Density: 0.75 |
|
| 6226 |
0 |
@Override... |
| 6227 |
|
protected void createGroup_actionPerformed(ActionEvent e) |
| 6228 |
|
{ |
| 6229 |
0 |
if (avc.createGroup()) |
| 6230 |
|
{ |
| 6231 |
0 |
if (applyAutoAnnotationSettings.isSelected()) |
| 6232 |
|
{ |
| 6233 |
0 |
alignPanel.updateAnnotation(true, false); |
| 6234 |
|
} |
| 6235 |
0 |
alignPanel.alignmentChanged(); |
| 6236 |
|
} |
| 6237 |
|
} |
| 6238 |
|
|
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
| 6239 |
0 |
@Override... |
| 6240 |
|
protected void unGroup_actionPerformed(ActionEvent e) |
| 6241 |
|
{ |
| 6242 |
0 |
if (avc.unGroup()) |
| 6243 |
|
{ |
| 6244 |
0 |
alignPanel.alignmentChanged(); |
| 6245 |
|
} |
| 6246 |
|
} |
| 6247 |
|
|
| 6248 |
|
|
| 6249 |
|
|
| 6250 |
|
|
| 6251 |
|
@param |
| 6252 |
|
|
| |
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 5 |
Complexity Density: 1.25 |
|
| 6253 |
0 |
public void setDisplayedView(AlignmentPanel alignmentPanel)... |
| 6254 |
|
{ |
| 6255 |
0 |
if (!viewport.getSequenceSetId() |
| 6256 |
|
.equals(alignmentPanel.av.getSequenceSetId())) |
| 6257 |
|
{ |
| 6258 |
0 |
throw new Error(MessageManager.getString( |
| 6259 |
|
"error.implementation_error_cannot_show_view_alignment_frame")); |
| 6260 |
|
} |
| 6261 |
0 |
if (tabbedPane != null && tabbedPane.getTabCount() > 0 && alignPanels |
| 6262 |
|
.indexOf(alignmentPanel) != tabbedPane.getSelectedIndex()) |
| 6263 |
|
{ |
| 6264 |
0 |
tabbedPane.setSelectedIndex(alignPanels.indexOf(alignmentPanel)); |
| 6265 |
|
} |
| 6266 |
|
} |
| 6267 |
|
|
| 6268 |
|
|
| 6269 |
|
|
| 6270 |
|
|
| 6271 |
|
@param |
| 6272 |
|
@param |
| 6273 |
|
|
| 6274 |
|
@param |
| 6275 |
|
|
| 6276 |
|
|
| |
|
| 78.9% |
Uncovered Elements: 4 (19) |
Complexity: 4 |
Complexity Density: 0.31 |
|
| 6277 |
328 |
@Override... |
| 6278 |
|
public void setAnnotationsVisibility(boolean visible, |
| 6279 |
|
boolean forSequences, boolean forAlignment) |
| 6280 |
|
{ |
| 6281 |
328 |
AlignmentAnnotation[] anns = alignPanel.getAlignment() |
| 6282 |
|
.getAlignmentAnnotation(); |
| 6283 |
328 |
if (anns == null) |
| 6284 |
|
{ |
| 6285 |
0 |
return; |
| 6286 |
|
} |
| 6287 |
328 |
for (AlignmentAnnotation aa : anns) |
| 6288 |
|
{ |
| 6289 |
|
|
| 6290 |
|
|
| 6291 |
|
|
| 6292 |
1338 |
if (aa.annotations == null) |
| 6293 |
|
{ |
| 6294 |
0 |
continue; |
| 6295 |
|
} |
| 6296 |
1338 |
boolean apply = (aa.sequenceRef == null && forAlignment) |
| 6297 |
|
|| (aa.sequenceRef != null && forSequences); |
| 6298 |
1338 |
if (apply) |
| 6299 |
|
{ |
| 6300 |
669 |
aa.visible = visible; |
| 6301 |
|
} |
| 6302 |
|
} |
| 6303 |
328 |
alignPanel.updateAnnotation(); |
| 6304 |
328 |
alignPanel.validateAnnotationDimensions(true); |
| 6305 |
|
|
| 6306 |
|
|
| 6307 |
328 |
alignPanel.fontChanged(); |
| 6308 |
328 |
alignPanel.alignmentChanged(); |
| 6309 |
|
} |
| 6310 |
|
|
| 6311 |
|
|
| 6312 |
|
|
| 6313 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 6314 |
0 |
@Override... |
| 6315 |
|
protected void sortAnnotations_actionPerformed() |
| 6316 |
|
{ |
| 6317 |
0 |
this.alignPanel.av.setSortAnnotationsBy(getAnnotationSortOrder()); |
| 6318 |
0 |
this.alignPanel.av |
| 6319 |
|
.setShowAutocalculatedAbove(isShowAutoCalculatedAbove()); |
| 6320 |
0 |
alignPanel.paintAlignment(false, false); |
| 6321 |
|
} |
| 6322 |
|
|
| 6323 |
|
|
| 6324 |
|
|
| 6325 |
|
@return |
| 6326 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 6327 |
252 |
public List<? extends AlignmentViewPanel> getAlignPanels()... |
| 6328 |
|
{ |
| 6329 |
|
|
| 6330 |
|
|
| 6331 |
252 |
return alignPanels; |
| 6332 |
|
} |
| 6333 |
|
|
| 6334 |
|
|
| 6335 |
|
|
| 6336 |
|
|
| 6337 |
|
|
| |
|
| 0% |
Uncovered Elements: 25 (25) |
Complexity: 4 |
Complexity Density: 0.21 |
|
| 6338 |
0 |
protected void viewAsCdna_actionPerformed()... |
| 6339 |
|
{ |
| 6340 |
|
|
| 6341 |
0 |
final AlignmentI alignment = getViewport().getAlignment(); |
| 6342 |
0 |
List<AlignedCodonFrame> mappings = alignment.getCodonFrames(); |
| 6343 |
0 |
if (mappings == null) |
| 6344 |
|
{ |
| 6345 |
0 |
return; |
| 6346 |
|
} |
| 6347 |
0 |
List<SequenceI> cdnaSeqs = new ArrayList<>(); |
| 6348 |
0 |
for (SequenceI aaSeq : alignment.getSequences()) |
| 6349 |
|
{ |
| 6350 |
0 |
for (AlignedCodonFrame acf : mappings) |
| 6351 |
|
{ |
| 6352 |
0 |
SequenceI dnaSeq = acf.getDnaForAaSeq(aaSeq.getDatasetSequence()); |
| 6353 |
0 |
if (dnaSeq != null) |
| 6354 |
|
{ |
| 6355 |
|
|
| 6356 |
|
|
| 6357 |
|
|
| 6358 |
|
|
| 6359 |
|
|
| 6360 |
0 |
final Sequence newSeq = new Sequence(dnaSeq); |
| 6361 |
0 |
newSeq.setDatasetSequence(dnaSeq); |
| 6362 |
0 |
cdnaSeqs.add(newSeq); |
| 6363 |
|
} |
| 6364 |
|
} |
| 6365 |
|
} |
| 6366 |
0 |
if (cdnaSeqs.size() == 0) |
| 6367 |
|
{ |
| 6368 |
|
|
| 6369 |
0 |
return; |
| 6370 |
|
} |
| 6371 |
0 |
AlignmentI cdna = new Alignment( |
| 6372 |
|
cdnaSeqs.toArray(new SequenceI[cdnaSeqs.size()])); |
| 6373 |
0 |
GAlignFrame alignFrame = new AlignFrame(cdna, AlignFrame.DEFAULT_WIDTH, |
| 6374 |
|
AlignFrame.DEFAULT_HEIGHT); |
| 6375 |
0 |
cdna.alignAs(alignment); |
| 6376 |
0 |
String newtitle = "cDNA " + MessageManager.getString("label.for") + " " |
| 6377 |
|
+ this.title; |
| 6378 |
0 |
Desktop.addInternalFrame(alignFrame, newtitle, AlignFrame.DEFAULT_WIDTH, |
| 6379 |
|
AlignFrame.DEFAULT_HEIGHT); |
| 6380 |
|
} |
| 6381 |
|
|
| 6382 |
|
|
| 6383 |
|
|
| 6384 |
|
|
| 6385 |
|
|
| 6386 |
|
@param |
| 6387 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 6388 |
0 |
@Override... |
| 6389 |
|
protected void showComplement_actionPerformed(boolean show) |
| 6390 |
|
{ |
| 6391 |
0 |
SplitContainerI sf = getSplitViewContainer(); |
| 6392 |
0 |
if (sf != null) |
| 6393 |
|
{ |
| 6394 |
0 |
sf.setComplementVisible(this, show); |
| 6395 |
|
} |
| 6396 |
|
} |
| 6397 |
|
|
| 6398 |
|
|
| 6399 |
|
|
| 6400 |
|
|
| 6401 |
|
|
| |
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.25 |
|
| 6402 |
0 |
@Override... |
| 6403 |
|
protected void showReverse_actionPerformed(boolean complement) |
| 6404 |
|
{ |
| 6405 |
0 |
AlignmentI al = null; |
| 6406 |
0 |
try |
| 6407 |
|
{ |
| 6408 |
0 |
Dna dna = new Dna(viewport, viewport.getViewAsVisibleContigs(true)); |
| 6409 |
0 |
al = dna.reverseCdna(complement); |
| 6410 |
0 |
viewport.addAlignment(al, ""); |
| 6411 |
0 |
addHistoryItem(new EditCommand( |
| 6412 |
|
MessageManager.getString("label.add_sequences"), Action.PASTE, |
| 6413 |
|
al.getSequencesArray(), 0, al.getWidth(), |
| 6414 |
|
viewport.getAlignment())); |
| 6415 |
|
} catch (Exception ex) |
| 6416 |
|
{ |
| 6417 |
0 |
jalview.bin.Console.errPrintln(ex.getMessage()); |
| 6418 |
0 |
return; |
| 6419 |
|
} |
| 6420 |
|
} |
| 6421 |
|
|
| 6422 |
|
|
| 6423 |
|
|
| 6424 |
|
|
| 6425 |
|
|
| 6426 |
|
|
| |
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 3 |
Complexity Density: 0.33 |
|
| 6427 |
0 |
@Override... |
| 6428 |
|
protected void runGroovy_actionPerformed() |
| 6429 |
|
{ |
| 6430 |
0 |
Jalview.getInstance().setCurrentAlignFrame(this); |
| 6431 |
0 |
groovy.console.ui.Console console = Desktop.getGroovyConsole(); |
| 6432 |
0 |
if (console != null) |
| 6433 |
|
{ |
| 6434 |
0 |
try |
| 6435 |
|
{ |
| 6436 |
0 |
console.setVariable(JalviewObjectI.currentAlFrameName, this); |
| 6437 |
0 |
console.runScript(); |
| 6438 |
|
} catch (Exception ex) |
| 6439 |
|
{ |
| 6440 |
0 |
jalview.bin.Console.errPrintln((ex.toString())); |
| 6441 |
0 |
JvOptionPane.showInternalMessageDialog(Desktop.desktop, |
| 6442 |
|
MessageManager.getString("label.couldnt_run_groovy_script"), |
| 6443 |
|
MessageManager.getString("label.groovy_support_failed"), |
| 6444 |
|
JvOptionPane.ERROR_MESSAGE); |
| 6445 |
|
} |
| 6446 |
|
} |
| 6447 |
|
else |
| 6448 |
|
{ |
| 6449 |
0 |
jalview.bin.Console |
| 6450 |
|
.errPrintln("Can't run Groovy script as console not found"); |
| 6451 |
|
} |
| 6452 |
|
} |
| 6453 |
|
|
| 6454 |
|
|
| 6455 |
|
|
| 6456 |
|
|
| 6457 |
|
|
| 6458 |
|
@param |
| 6459 |
|
@param |
| 6460 |
|
@return |
| 6461 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
| 6462 |
7 |
public boolean hideFeatureColumns(String featureType,... |
| 6463 |
|
boolean columnsContaining) |
| 6464 |
|
{ |
| 6465 |
7 |
boolean notForHiding = avc.markColumnsContainingFeatures( |
| 6466 |
|
columnsContaining, false, false, featureType); |
| 6467 |
7 |
if (notForHiding) |
| 6468 |
|
{ |
| 6469 |
5 |
if (avc.markColumnsContainingFeatures(!columnsContaining, false, |
| 6470 |
|
false, featureType)) |
| 6471 |
|
{ |
| 6472 |
4 |
getViewport().hideSelectedColumns(); |
| 6473 |
4 |
return true; |
| 6474 |
|
} |
| 6475 |
|
} |
| 6476 |
3 |
return false; |
| 6477 |
|
} |
| 6478 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 6479 |
0 |
@Override... |
| 6480 |
|
protected void selectHighlightedColumns_actionPerformed( |
| 6481 |
|
ActionEvent actionEvent) |
| 6482 |
|
{ |
| 6483 |
|
|
| 6484 |
0 |
avc.markHighlightedColumns( |
| 6485 |
|
(actionEvent.getModifiers() & ActionEvent.ALT_MASK) != 0, true, |
| 6486 |
|
(actionEvent.getModifiers() & (ActionEvent.META_MASK |
| 6487 |
|
| ActionEvent.CTRL_MASK)) != 0); |
| 6488 |
|
} |
| 6489 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 6490 |
0 |
@Override... |
| 6491 |
|
protected void copyHighlightedColumns_actionPerformed( |
| 6492 |
|
ActionEvent actionEvent) |
| 6493 |
|
{ |
| 6494 |
0 |
avc.copyHighlightedRegionsToClipboard(); |
| 6495 |
|
} |
| 6496 |
|
|
| 6497 |
|
|
| 6498 |
|
|
| 6499 |
|
|
| 6500 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
|
| 6501 |
476 |
public void buildColourMenu()... |
| 6502 |
|
{ |
| 6503 |
476 |
colourMenu.removeAll(); |
| 6504 |
|
|
| 6505 |
476 |
colourMenu.add(applyToAllGroups); |
| 6506 |
476 |
colourMenu.add(textColour); |
| 6507 |
476 |
colourMenu.addSeparator(); |
| 6508 |
|
|
| 6509 |
476 |
ButtonGroup bg = ColourMenuHelper.addMenuItems(colourMenu, this, |
| 6510 |
|
viewport.getAlignment(), false); |
| 6511 |
|
|
| 6512 |
476 |
colourMenu.add(annotationColour); |
| 6513 |
476 |
bg.add(annotationColour); |
| 6514 |
476 |
colourMenu.addSeparator(); |
| 6515 |
476 |
colourMenu.add(conservationMenuItem); |
| 6516 |
476 |
colourMenu.add(modifyConservation); |
| 6517 |
476 |
colourMenu.add(byConsensusSecondaryStructureMenuItem); |
| 6518 |
476 |
colourMenu.add(modifyConsensusSecondaryStructureThreshold); |
| 6519 |
476 |
colourMenu.add(abovePIDThreshold); |
| 6520 |
476 |
colourMenu.add(modifyPID); |
| 6521 |
|
|
| 6522 |
476 |
ColourSchemeI colourScheme = viewport.getGlobalColourScheme(); |
| 6523 |
476 |
ColourMenuHelper.setColourSelected(colourMenu, colourScheme); |
| 6524 |
|
} |
| 6525 |
|
|
| 6526 |
|
|
| 6527 |
|
|
| 6528 |
|
|
| 6529 |
|
|
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
| 6530 |
0 |
protected void openTreePcaDialog()... |
| 6531 |
|
{ |
| 6532 |
0 |
if (alignPanel.getCalculationDialog() == null) |
| 6533 |
|
{ |
| 6534 |
0 |
new CalculationChooser(AlignFrame.this); |
| 6535 |
|
} |
| 6536 |
|
} |
| 6537 |
|
|
| |
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 1 |
Complexity Density: 0.09 |
|
| 6538 |
0 |
@Override... |
| 6539 |
|
protected void loadVcf_actionPerformed() |
| 6540 |
|
{ |
| 6541 |
0 |
JalviewFileChooser chooser = new JalviewFileChooser( |
| 6542 |
|
Cache.getProperty("LAST_DIRECTORY")); |
| 6543 |
0 |
chooser.setFileView(new JalviewFileView()); |
| 6544 |
0 |
chooser.setDialogTitle(MessageManager.getString("label.load_vcf_file")); |
| 6545 |
0 |
chooser.setToolTipText(MessageManager.getString("label.load_vcf_file")); |
| 6546 |
0 |
final AlignFrame us = this; |
| 6547 |
0 |
chooser.setResponseHandler(0, () -> { |
| 6548 |
0 |
String choice = chooser.getSelectedFile().getPath(); |
| 6549 |
0 |
Cache.setProperty("LAST_DIRECTORY", choice); |
| 6550 |
0 |
SequenceI[] seqs = viewport.getAlignment().getSequencesArray(); |
| 6551 |
0 |
new VCFLoader(choice).loadVCF(seqs, us); |
| 6552 |
|
}); |
| 6553 |
0 |
chooser.showOpenDialog(null); |
| 6554 |
|
|
| 6555 |
|
} |
| 6556 |
|
|
| 6557 |
|
private Rectangle lastFeatureSettingsBounds = null; |
| 6558 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 6559 |
1 |
@Override... |
| 6560 |
|
public void setFeatureSettingsGeometry(Rectangle bounds) |
| 6561 |
|
{ |
| 6562 |
1 |
lastFeatureSettingsBounds = bounds; |
| 6563 |
|
} |
| 6564 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 6565 |
2 |
@Override... |
| 6566 |
|
public Rectangle getFeatureSettingsGeometry() |
| 6567 |
|
{ |
| 6568 |
2 |
return lastFeatureSettingsBounds; |
| 6569 |
|
} |
| 6570 |
|
|
| 6571 |
|
|
| 6572 |
|
|
| 6573 |
|
|
| 6574 |
|
|
| 6575 |
|
@param |
| 6576 |
|
@param |
| 6577 |
|
@param |
| 6578 |
|
|
| |
|
| 40% |
Uncovered Elements: 6 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
| 6579 |
164 |
public void showOrHideAnnotations(boolean showSSAnnotations,... |
| 6580 |
|
boolean showAnnotations, boolean hideTFrows) |
| 6581 |
|
{ |
| 6582 |
164 |
setAnnotationsVisibility(showSSAnnotations, true, false); |
| 6583 |
164 |
setAnnotationsVisibility(showAnnotations, false, true); |
| 6584 |
|
|
| 6585 |
|
|
| 6586 |
164 |
if (hideTFrows) |
| 6587 |
|
{ |
| 6588 |
|
|
| 6589 |
|
|
| 6590 |
0 |
List<String> hideThese = new ArrayList<>(); |
| 6591 |
0 |
hideThese.add("Temperature Factor"); |
| 6592 |
0 |
hideThese.add(AlphaFoldAnnotationRowBuilder.LABEL); |
| 6593 |
0 |
AlignmentUtils.showOrHideSequenceAnnotations( |
| 6594 |
|
getCurrentView().getAlignment(), hideThese, null, false, |
| 6595 |
|
false); |
| 6596 |
0 |
alignPanel.updateAnnotation(); |
| 6597 |
|
|
| 6598 |
|
} |
| 6599 |
|
} |
| 6600 |
|
|
| 6601 |
|
|
| 6602 |
|
|
| 6603 |
|
|
| 6604 |
|
|
| 6605 |
|
|
| 6606 |
|
@param |
| 6607 |
|
|
| 6608 |
|
|
| |
|
| 70.4% |
Uncovered Elements: 8 (27) |
Complexity: 4 |
Complexity Density: 0.19 |
|
| 6609 |
36 |
public void disableInput(boolean greyPanel, boolean coverStatusPanel)... |
| 6610 |
|
{ |
| 6611 |
|
|
| 6612 |
|
|
| 6613 |
|
|
| 6614 |
36 |
if (glassPane == null) |
| 6615 |
|
{ |
| 6616 |
36 |
JPanel glass; |
| 6617 |
36 |
if (greyPanel) |
| 6618 |
|
{ |
| 6619 |
36 |
glass = new JPanel() |
| 6620 |
|
{ |
| |
|
| 80% |
Uncovered Elements: 1 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 6621 |
51 |
@Override... |
| 6622 |
|
public void paintComponent(Graphics g) |
| 6623 |
|
{ |
| 6624 |
51 |
if (greyPanel) |
| 6625 |
|
{ |
| 6626 |
51 |
g.setColor(new Color(0, 0, 0, 48)); |
| 6627 |
51 |
g.fillRect(0, 0, this.getWidth(), this.getHeight() |
| 6628 |
|
- AlignFrame.this.getStatusPanel().getHeight()); |
| 6629 |
|
} |
| 6630 |
|
} |
| 6631 |
|
}; |
| 6632 |
|
} |
| 6633 |
|
else |
| 6634 |
|
{ |
| 6635 |
0 |
glass = new JPanel(); |
| 6636 |
|
} |
| 6637 |
|
|
| 6638 |
36 |
glass.addMouseListener(new MouseAdapter() |
| 6639 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 6640 |
0 |
@Override... |
| 6641 |
|
public void mousePressed(MouseEvent e) |
| 6642 |
|
{ |
| 6643 |
|
|
| 6644 |
0 |
e.consume(); |
| 6645 |
|
} |
| 6646 |
|
}); |
| 6647 |
36 |
glass.addKeyListener(new KeyListener() |
| 6648 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 6649 |
0 |
@Override... |
| 6650 |
|
public void keyTyped(KeyEvent e) |
| 6651 |
|
{ |
| 6652 |
0 |
e.consume(); |
| 6653 |
|
} |
| 6654 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 6655 |
0 |
@Override... |
| 6656 |
|
public void keyPressed(KeyEvent e) |
| 6657 |
|
{ |
| 6658 |
0 |
e.consume(); |
| 6659 |
|
} |
| 6660 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 6661 |
0 |
@Override... |
| 6662 |
|
public void keyReleased(KeyEvent e) |
| 6663 |
|
{ |
| 6664 |
0 |
e.consume(); |
| 6665 |
|
} |
| 6666 |
|
}); |
| 6667 |
36 |
glass.setOpaque(false); |
| 6668 |
36 |
glassPane = glass; |
| 6669 |
|
} |
| 6670 |
|
else |
| 6671 |
|
{ |
| 6672 |
0 |
int myHeight = coverStatusPanel ? getRootPane().getHeight() |
| 6673 |
|
: getRootPane().getHeight() - getStatusPanel().getHeight(); |
| 6674 |
0 |
int myWidth = getRootPane().getWidth(); |
| 6675 |
|
|
| 6676 |
0 |
glassPane.setSize(myWidth, myHeight); |
| 6677 |
|
} |
| 6678 |
|
|
| 6679 |
36 |
JRootPane root = getRootPane(); |
| 6680 |
36 |
savedRootGlassPane = root.getGlassPane(); |
| 6681 |
36 |
root.setGlassPane(glassPane); |
| 6682 |
36 |
savedRootGlassPane.setVisible(false); |
| 6683 |
36 |
glassPane.setVisible(true); |
| 6684 |
36 |
setResizable(false); |
| 6685 |
36 |
setMaximizable(false); |
| 6686 |
36 |
setIconifiable(false); |
| 6687 |
36 |
setClosable(false); |
| 6688 |
|
} |
| 6689 |
|
|
| 6690 |
|
private JPanel glassPane = null; |
| 6691 |
|
|
| 6692 |
|
private Component savedRootGlassPane = getRootPane().getGlassPane(); |
| 6693 |
|
|
| 6694 |
|
|
| 6695 |
|
|
| 6696 |
|
|
| 6697 |
|
|
| |
|
| 90% |
Uncovered Elements: 1 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
| 6698 |
36 |
public void enableInput()... |
| 6699 |
|
{ |
| 6700 |
36 |
setResizable(true); |
| 6701 |
36 |
setMaximizable(true); |
| 6702 |
36 |
setIconifiable(true); |
| 6703 |
36 |
setClosable(true); |
| 6704 |
36 |
getRootPane().setGlassPane(savedRootGlassPane); |
| 6705 |
36 |
savedRootGlassPane.setVisible(true); |
| 6706 |
36 |
if (glassPane != null) |
| 6707 |
|
{ |
| 6708 |
36 |
glassPane.setVisible(false); |
| 6709 |
|
} |
| 6710 |
|
} |
| 6711 |
|
} |
| 6712 |
|
|
| |
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 5 |
Complexity Density: 0.56 |
|
| 6713 |
|
class PrintThread extends Thread |
| 6714 |
|
{ |
| 6715 |
|
AlignmentPanel ap; |
| 6716 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 6717 |
0 |
public PrintThread(AlignmentPanel ap)... |
| 6718 |
|
{ |
| 6719 |
0 |
this.ap = ap; |
| 6720 |
|
} |
| 6721 |
|
|
| 6722 |
|
static PageFormat pf; |
| 6723 |
|
|
| |
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 4 |
Complexity Density: 0.5 |
|
| 6724 |
0 |
@Override... |
| 6725 |
|
public void run() |
| 6726 |
|
{ |
| 6727 |
0 |
PrinterJob printJob = PrinterJob.getPrinterJob(); |
| 6728 |
|
|
| 6729 |
0 |
if (pf != null) |
| 6730 |
|
{ |
| 6731 |
0 |
printJob.setPrintable(ap, pf); |
| 6732 |
|
} |
| 6733 |
|
else |
| 6734 |
|
{ |
| 6735 |
0 |
printJob.setPrintable(ap); |
| 6736 |
|
} |
| 6737 |
|
|
| 6738 |
0 |
if (printJob.printDialog()) |
| 6739 |
|
{ |
| 6740 |
0 |
try |
| 6741 |
|
{ |
| 6742 |
0 |
printJob.print(); |
| 6743 |
|
} catch (Exception PrintException) |
| 6744 |
|
{ |
| 6745 |
0 |
PrintException.printStackTrace(); |
| 6746 |
|
} |
| 6747 |
|
} |
| 6748 |
|
} |
| 6749 |
|
} |