X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fgui%2FAlignFrame.java;h=433afbad90e7a1bc5a6e6eb304d9191b5f7f4424;hb=b2cedc8371f6624859f107581e6d84e841d4114b;hp=d08e1a36ccc0d490a8afbfbbc94387e0acd25cae;hpb=9359a2279fcaa47910e31805b967390bffd6a573;p=jalview.git diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index d08e1a3..433afba 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -32,6 +32,7 @@ import jalview.api.AlignViewControllerI; import jalview.api.AlignViewportI; import jalview.api.AlignmentViewPanel; import jalview.api.FeatureSettingsControllerI; +import jalview.api.FeatureSettingsI; import jalview.api.SplitContainerI; import jalview.api.ViewStyleI; import jalview.api.analysis.ScoreModelI; @@ -94,9 +95,11 @@ import jalview.schemes.ZappoColourScheme; import jalview.structure.StructureSelectionManager; import jalview.util.MessageManager; import jalview.viewmodel.AlignmentViewport; +import jalview.ws.SequenceFetcher; import jalview.ws.jws1.Discoverer; import jalview.ws.jws2.Jws2Discoverer; import jalview.ws.jws2.jabaws2.Jws2Instance; +import jalview.ws.seqfetcher.ASequenceFetcher; import jalview.ws.seqfetcher.DbSourceProxy; import java.awt.BorderLayout; @@ -131,7 +134,6 @@ import java.util.Deque; import java.util.Enumeration; import java.util.Hashtable; import java.util.List; -import java.util.Set; import java.util.Vector; import javax.swing.JCheckBoxMenuItem; @@ -828,6 +830,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, public void setGUINucleotide(boolean nucleotide) { showTranslation.setVisible(nucleotide); + showReverse.setVisible(nucleotide); + showReverseComplement.setVisible(nucleotide); conservationMenuItem.setEnabled(!nucleotide); modifyConservation.setEnabled(!nucleotide); showGroupConservation.setEnabled(!nucleotide); @@ -845,6 +849,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * operation that affects the data in the current view (selection changed, * etc) to update the menus to reflect the new state. */ + @Override public void setMenusForViewport() { setMenusFromViewport(viewport); @@ -902,7 +907,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, rnahelicesColour.setEnabled(av.getAlignment().hasRNAStructure()); rnahelicesColour .setSelected(av.getGlobalColourScheme() instanceof jalview.schemes.RNAHelicesColour); - setShowProductsEnabled(); + + showProducts.setEnabled(canShowProducts()); + updateEditMenuBar(); } @@ -958,7 +965,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void fetchSequence_actionPerformed(ActionEvent e) { - new SequenceFetcher(this); + new jalview.gui.SequenceFetcher(this); } @Override @@ -1368,7 +1375,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void bioJSMenuItem_actionPerformed(ActionEvent e) { - BioJsHTMLOutput bjs = new BioJsHTMLOutput(alignPanel); + BioJsHTMLOutput bjs = new BioJsHTMLOutput(alignPanel, this); bjs.exportJalviewAlignmentAsBioJsHtmlFile(); } @@ -1401,6 +1408,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, alignPanel.makeEPS(f); } + @Override public void createSVG(File f) { alignPanel.makeSVG(f); @@ -1574,6 +1582,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } } + @Override public void addHistoryItem(CommandI command) { if (command.getSize() > 0) @@ -1977,7 +1986,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, return; } - format = new IdentifyFile().Identify(str, "Paste"); + format = new IdentifyFile().identify(str, "Paste"); } catch (OutOfMemoryError er) { @@ -2415,7 +2424,6 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } } - /** * DOCUMENT ME! * @@ -2545,7 +2553,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, ColumnSelection colSel = viewport.getColumnSelection(); int column; - if (colSel.size() > 0) + if (!colSel.isEmpty()) { if (trimLeft) { @@ -2570,18 +2578,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, TrimRegionCommand trimRegion; if (trimLeft) { - trimRegion = new TrimRegionCommand("Remove Left", - TrimRegionCommand.TRIM_LEFT, seqs, column, - viewport.getAlignment(), viewport.getColumnSelection(), - viewport.getSelectionGroup()); + trimRegion = new TrimRegionCommand("Remove Left", true, seqs, + column, viewport.getAlignment()); viewport.setStartRes(0); } else { - trimRegion = new TrimRegionCommand("Remove Right", - TrimRegionCommand.TRIM_RIGHT, seqs, column, - viewport.getAlignment(), viewport.getColumnSelection(), - viewport.getSelectionGroup()); + trimRegion = new TrimRegionCommand("Remove Right", false, seqs, + column, viewport.getAlignment()); } statusBar.setText(MessageManager.formatMessage( @@ -2968,6 +2972,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { viewport.showAllHiddenColumns(); repaint(); + viewport.sendSelection(); } @Override @@ -3058,6 +3063,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, public void hideAllButSelection_actionPerformed(ActionEvent e) { toggleHiddenRegions(false, false); + viewport.sendSelection(); } /* @@ -3075,6 +3081,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, viewport.hideAllSelectedSeqs(); viewport.hideSelectedColumns(); alignPanel.paintAlignment(true); + viewport.sendSelection(); } /* @@ -3090,6 +3097,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, viewport.showAllHiddenColumns(); viewport.showAllHiddenSeqs(); alignPanel.paintAlignment(true); + viewport.sendSelection(); } @Override @@ -3097,6 +3105,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { viewport.hideSelectedColumns(); alignPanel.paintAlignment(true); + viewport.sendSelection(); } @Override @@ -3498,6 +3507,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * @param cs * DOCUMENT ME! */ + @Override public void changeColour(ColourSchemeI cs) { // TODO: pull up to controller method @@ -4647,67 +4657,27 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } } - /* - * public void vamsasStore_actionPerformed(ActionEvent e) { JalviewFileChooser - * chooser = new JalviewFileChooser(jalview.bin.Cache. - * getProperty("LAST_DIRECTORY")); - * - * chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle("Export - * to Vamsas file"); chooser.setToolTipText("Export"); - * - * int value = chooser.showSaveDialog(this); - * - * if (value == JalviewFileChooser.APPROVE_OPTION) { - * jalview.io.VamsasDatastore vs = new jalview.io.VamsasDatastore(viewport); - * //vs.store(chooser.getSelectedFile().getAbsolutePath() ); vs.storeJalview( - * chooser.getSelectedFile().getAbsolutePath(), this); } } - */ /** - * prototype of an automatically enabled/disabled analysis function + * Searches selected sequences for xRef products and builds the Show + * Cross-References menu (formerly called Show Products) * + * @return true if Show Cross-references menu should be enabled. */ - protected void setShowProductsEnabled() + public boolean canShowProducts() { SequenceI[] selection = viewport.getSequenceSelection(); - if (canShowProducts(selection, viewport.getSelectionGroup() != null, - viewport.getAlignment().getDataset())) - { - showProducts.setEnabled(true); - - } - else - { - showProducts.setEnabled(false); - } - } - - /** - * search selection for sequence xRef products and build the show products - * menu. - * - * @param selection - * @param dataset - * @return true if showProducts menu should be enabled. - */ - public boolean canShowProducts(SequenceI[] selection, - boolean isRegionSelection, Alignment dataset) - { + AlignmentI dataset = viewport.getAlignment().getDataset(); boolean showp = false; try { showProducts.removeAll(); final boolean dna = viewport.getAlignment().isNucleotide(); - final Alignment ds = dataset; String[] ptypes = (selection == null || selection.length == 0) ? null : CrossRef.findSequenceXrefTypes(dna, selection, dataset); - // Object[] prods = - // CrossRef.buildXProductsList(viewport.getAlignment().isNucleotide(), - // selection, dataset, true); - final SequenceI[] sel = selection; + for (int t = 0; ptypes != null && t < ptypes.length; t++) { showp = true; - final boolean isRegSel = isRegionSelection; final AlignFrame af = this; final String source = ptypes[t]; JMenuItem xtype = new JMenuItem(ptypes[t]); @@ -4717,9 +4687,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void actionPerformed(ActionEvent e) { - // TODO: new thread for this call with vis-delay - af.showProductsFor(af.viewport.getSequenceSelection(), - isRegSel, dna, source); + showProductsFor(af.viewport.getSequenceSelection(), dna, source); } }); @@ -4730,15 +4698,15 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } catch (Exception e) { jalview.bin.Cache.log - .warn("canTranslate threw an exception - please report to help@jalview.org", + .warn("canShowProducts threw an exception - please report to help@jalview.org", e); return false; } return showp; } - protected void showProductsFor(final SequenceI[] sel, - final boolean isRegSel, final boolean dna, final String source) + protected void showProductsFor(final SequenceI[] sel, final boolean dna, + final String source) { Runnable foo = new Runnable() { @@ -4752,27 +4720,35 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, new Object[] { source }), sttime); try { - // update our local dataset reference - Alignment ds = AlignFrame.this.getViewport().getAlignment() - .getDataset(); - Alignment prods = CrossRef - .findXrefSequences(sel, dna, source, ds); - if (prods != null) + /* + * 'peer' sequences are any to add to this alignment, for example + * alternative protein products for my protein's gene + */ + List addedPeers = new ArrayList(); + AlignmentI alignment = AlignFrame.this.getViewport() + .getAlignment(); + Alignment xrefs = CrossRef.findXrefSequences(sel, dna, source, + alignment, addedPeers); + if (xrefs != null) { - SequenceI[] sprods = new SequenceI[prods.getHeight()]; - for (int s = 0; s < sprods.length; s++) + /* + * figure out colour scheme if any to apply to features + */ + ASequenceFetcher sftch = new SequenceFetcher(); + List proxies = sftch.getSourceProxy(source); + FeatureSettingsI featureColourScheme = null; + for (DbSourceProxy proxy : proxies) { - sprods[s] = (prods.getSequenceAt(s)).deriveSequence(); - if (ds.getSequences() == null - || !ds.getSequences().contains( - sprods[s].getDatasetSequence())) + FeatureSettingsI preferredColours = proxy + .getFeatureColourScheme(); + if (preferredColours != null) { - ds.addSequence(sprods[s].getDatasetSequence()); + featureColourScheme = preferredColours; + break; } - sprods[s].updatePDBIds(); } - Alignment al = new Alignment(sprods); - al.setDataset(ds); + Alignment al = makeCrossReferencesAlignment( + alignment.getDataset(), xrefs); /* * Copy dna-to-protein mappings to new alignment @@ -4780,19 +4756,19 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // TODO 1: no mappings are set up for EMBL product // TODO 2: if they were, should add them to protein alignment, not // dna - Set cf = prods.getCodonFrames(); - for (AlignedCodonFrame acf : cf) - { - al.addCodonFrame(acf); - } - AlignFrame naf = new AlignFrame(al, DEFAULT_WIDTH, + // List cf = xrefs.getCodonFrames(); + // for (AlignedCodonFrame acf : cf) + // { + // al.addCodonFrame(acf); + // } + AlignFrame newFrame = new AlignFrame(al, DEFAULT_WIDTH, DEFAULT_HEIGHT); - String newtitle = "" + ((dna) ? "Proteins" : "Nucleotides") - + " for " + ((isRegSel) ? "selected region of " : "") - + getTitle(); - naf.setTitle(newtitle); + String newtitle = String.format("%s %s %s", + MessageManager.getString(dna ? "label.proteins" + : "label.nucleotides"), MessageManager + .getString("label.for"), getTitle()); + newFrame.setTitle(newtitle); - // temporary flag until SplitFrame is released boolean asSplitFrame = Cache.getDefault( Preferences.ENABLE_SPLIT_FRAME, true); if (asSplitFrame) @@ -4804,36 +4780,89 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, AlignmentI copyAlignment = null; final SequenceI[] sequenceSelection = AlignFrame.this.viewport .getSequenceSelection(); + List cf = xrefs.getCodonFrames(); if (dna) { - copyAlignment = AlignmentUtils.makeExonAlignment( - sequenceSelection, cf); + copyAlignment = AlignmentUtils.makeCdsAlignment( + sequenceSelection, cf, alignment); al.getCodonFrames().clear(); al.getCodonFrames().addAll(cf); - final StructureSelectionManager ssm = StructureSelectionManager - .getStructureSelectionManager(Desktop.instance); - ssm.registerMappings(cf); } else { copyAlignment = new Alignment(new Alignment( sequenceSelection)); + copyAlignment.getCodonFrames().addAll(cf); + } + copyAlignment.setGapCharacter(AlignFrame.this.viewport + .getGapCharacter()); + StructureSelectionManager ssm = StructureSelectionManager + .getStructureSelectionManager(Desktop.instance); + ssm.registerMappings(cf); + + /* + * add in any extra 'peer' sequences discovered + * (e.g. alternative protein products) + */ + for (SequenceI peer : addedPeers) + { + copyAlignment.addSequence(peer); } + + /* + * align protein to dna + */ + if (dna) + { + al.alignAs(copyAlignment); + } + else + { + copyAlignment.alignAs(al); + } + AlignFrame copyThis = new AlignFrame(copyAlignment, AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); copyThis.setTitle(AlignFrame.this.getTitle()); - // SplitFrame with dna above, protein below - SplitFrame sf = new SplitFrame(dna ? copyThis : naf, - dna ? naf : copyThis); - naf.setVisible(true); + + boolean showSequenceFeatures = viewport + .isShowSequenceFeatures(); + newFrame.setShowSeqFeatures(showSequenceFeatures); + copyThis.setShowSeqFeatures(showSequenceFeatures); + FeatureRenderer myFeatureStyling = alignPanel.getSeqPanel().seqCanvas + .getFeatureRenderer(); + + /* + * copy feature rendering settings to split frame + */ + newFrame.alignPanel.getSeqPanel().seqCanvas + .getFeatureRenderer().transferSettings( + myFeatureStyling); + copyThis.alignPanel.getSeqPanel().seqCanvas + .getFeatureRenderer().transferSettings( + myFeatureStyling); + + /* + * apply 'database source' feature configuration + * if any was found + */ + newFrame.getViewport() + .applyFeaturesStyle(featureColourScheme); + copyThis.getViewport() + .applyFeaturesStyle(featureColourScheme); + + SplitFrame sf = new SplitFrame(dna ? copyThis : newFrame, + dna ? newFrame : copyThis); + newFrame.setVisible(true); copyThis.setVisible(true); String linkedTitle = MessageManager .getString("label.linked_view_title"); Desktop.addInternalFrame(sf, linkedTitle, -1, -1); + sf.adjustDivider(); } else { - Desktop.addInternalFrame(naf, newtitle, DEFAULT_WIDTH, + Desktop.addInternalFrame(newFrame, newtitle, DEFAULT_WIDTH, DEFAULT_HEIGHT); } } @@ -4859,6 +4888,35 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, new Object[] { source }), sttime); } + /** + * Makes an alignment containing the given sequences; the sequences are + * added to the given alignment dataset, and the dataset is set on (shared + * by) the new alignment + * + * @param dataset + * @param seqs + * @return + */ + protected Alignment makeCrossReferencesAlignment(Alignment dataset, + Alignment seqs) + { + SequenceI[] sprods = new SequenceI[seqs.getHeight()]; + for (int s = 0; s < sprods.length; s++) + { + sprods[s] = (seqs.getSequenceAt(s)).deriveSequence(); + if (dataset.getSequences() == null + || !dataset.getSequences().contains( + sprods[s].getDatasetSequence())) + { + dataset.addSequence(sprods[s].getDatasetSequence()); + } + sprods[s].updatePDBIds(); + } + Alignment al = new Alignment(sprods); + al.setDataset(dataset); + return al; + } + }; Thread frunner = new Thread(foo); frunner.start(); @@ -5098,7 +5156,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, String type = null; try { - type = new IdentifyFile().Identify(file, protocol); + type = new IdentifyFile().identify(file, protocol); } catch (Exception ex) { type = null; @@ -5197,7 +5255,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, /** * Attempt to load a "dropped" file or URL string: First by testing whether - * it's and Annotation file, then a JNet file, and finally a features file. If + * it's an Annotation file, then a JNet file, and finally a features file. If * all are false then the user may have dropped an alignment file onto this * AlignFrame. * @@ -5211,7 +5269,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { if (protocol == null) { - protocol = jalview.io.FormatAdapter.checkProtocol(file); + protocol = FormatAdapter.checkProtocol(file); } // if the file isn't identified, or not positively identified as some // other filetype (PFAM is default unidentified alignment file type) then @@ -5272,7 +5330,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // try to parse it as a features file if (format == null) { - format = new IdentifyFile().Identify(file, protocol); + format = new IdentifyFile().identify(file, protocol); } if (format.equalsIgnoreCase("JnetFile")) { @@ -5288,42 +5346,17 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, viewport.setColumnSelection(cs); isAnnotation = true; } - else + else if (IdentifyFile.FeaturesFile.equals(format)) { - /* - * if (format.equalsIgnoreCase("PDB")) { - * - * String pdbfn = ""; // try to match up filename with sequence id - * try { if (protocol == jalview.io.FormatAdapter.FILE) { File fl = - * new File(file); pdbfn = fl.getName(); } else if (protocol == - * jalview.io.FormatAdapter.URL) { URL url = new URL(file); pdbfn = - * url.getFile(); } } catch (Exception e) { } ; if (assocSeq == - * null) { SequenceIdMatcher idm = new SequenceIdMatcher(viewport - * .getAlignment().getSequencesArray()); if (pdbfn.length() > 0) { - * // attempt to find a match in the alignment SequenceI mtch = - * idm.findIdMatch(pdbfn); int l = 0, c = pdbfn.indexOf("."); while - * (mtch == null && c != -1) { while ((c = pdbfn.indexOf(".", l)) > - * l) { l = c; } if (l > -1) { pdbfn = pdbfn.substring(0, l); } mtch - * = idm.findIdMatch(pdbfn); } if (mtch != null) { // try and - * associate // prompt ? PDBEntry pe = new AssociatePdbFileWithSeq() - * .associatePdbWithSeq(file, protocol, mtch, true); if (pe != null) - * { System.err.println("Associated file : " + file + " with " + - * mtch.getDisplayId(true)); alignPanel.paintAlignment(true); } } // - * TODO: maybe need to load as normal otherwise return; } } - */ - // try to parse it as a features file - boolean isGroupsFile = parseFeaturesFile(file, protocol); - // if it wasn't a features file then we just treat it as a general - // alignment file to load into the current view. - if (!isGroupsFile) - { - new FileLoader().LoadFile(viewport, file, protocol, format); - } - else + if (parseFeaturesFile(file, protocol)) { alignPanel.paintAlignment(true); } } + else + { + new FileLoader().LoadFile(viewport, file, protocol, format); + } } } if (isAnnotation) @@ -5345,7 +5378,6 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } catch (Exception x) { } - ; new OOMWarning( "loading data " + (protocol != null ? (protocol.equals(FormatAdapter.PASTE) ? "from clipboard." @@ -5532,8 +5564,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void run() { + boolean isNuclueotide = alignPanel.alignFrame.getViewport() + .getAlignment().isNucleotide(); new jalview.ws.DBRefFetcher(alignPanel.av - .getSequenceSelection(), alignPanel.alignFrame) + .getSequenceSelection(), alignPanel.alignFrame, null, + alignPanel.alignFrame.featureSettings, isNuclueotide) .fetchDBRefs(false); } }).start(); @@ -5548,7 +5583,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void run() { - final jalview.ws.SequenceFetcher sf = SequenceFetcher + final jalview.ws.SequenceFetcher sf = jalview.gui.SequenceFetcher .getSequenceFetcherSingleton(me); javax.swing.SwingUtilities.invokeLater(new Runnable() { @@ -5602,10 +5637,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void run() { + boolean isNuclueotide = alignPanel.alignFrame + .getViewport().getAlignment() + .isNucleotide(); new jalview.ws.DBRefFetcher(alignPanel.av .getSequenceSelection(), - alignPanel.alignFrame, dassource) - .fetchDBRefs(false); + alignPanel.alignFrame, dassource, + alignPanel.alignFrame.featureSettings, + isNuclueotide).fetchDBRefs(false); } }).start(); } @@ -5638,10 +5677,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void run() { + boolean isNuclueotide = alignPanel.alignFrame + .getViewport().getAlignment() + .isNucleotide(); new jalview.ws.DBRefFetcher(alignPanel.av .getSequenceSelection(), - alignPanel.alignFrame, dassource) - .fetchDBRefs(false); + alignPanel.alignFrame, dassource, + alignPanel.alignFrame.featureSettings, + isNuclueotide).fetchDBRefs(false); } }).start(); } @@ -5689,10 +5732,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void run() { + boolean isNuclueotide = alignPanel.alignFrame + .getViewport().getAlignment() + .isNucleotide(); new jalview.ws.DBRefFetcher(alignPanel.av .getSequenceSelection(), - alignPanel.alignFrame, dassrc) - .fetchDBRefs(false); + alignPanel.alignFrame, dassrc, + alignPanel.alignFrame.featureSettings, + isNuclueotide).fetchDBRefs(false); } }).start(); } @@ -5756,6 +5803,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, viewport.firePropertyChange("alignment", null, al); } + @Override public void setShowSeqFeatures(boolean b) { showSeqFeatures.setSelected(b); @@ -5982,7 +6030,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { // TODO no longer a menu action - refactor as required final AlignmentI alignment = getViewport().getAlignment(); - Set mappings = alignment.getCodonFrames(); + List mappings = alignment.getCodonFrames(); if (mappings == null) { return; @@ -6037,6 +6085,27 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, sf.setComplementVisible(this, show); } } + + /** + * Generate the reverse (optionally complemented) of the selected sequences, + * and add them to the alignment + */ + @Override + protected void showReverse_actionPerformed(boolean complement) + { + AlignmentI al = null; + try + { + Dna dna = new Dna(viewport, viewport.getViewAsVisibleContigs(true)); + + al = dna.reverseCdna(complement); + viewport.addAlignment(al, ""); + } catch (Exception ex) + { + System.err.println(ex.getMessage()); + return; + } + } } class PrintThread extends Thread