2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
23 import jalview.api.AlignViewportI;
24 import jalview.api.AlignmentViewPanel;
25 import jalview.bin.Cache;
26 import jalview.datamodel.Alignment;
27 import jalview.datamodel.AlignmentI;
28 import jalview.datamodel.HiddenColumns;
29 import jalview.datamodel.PDBEntry;
30 import jalview.datamodel.SequenceI;
31 import jalview.gui.StructureViewer.ViewerType;
32 import jalview.gui.ViewSelectionMenu.ViewSetProvider;
33 import jalview.io.DataSourceType;
34 import jalview.io.JalviewFileChooser;
35 import jalview.io.JalviewFileView;
36 import jalview.jbgui.GStructureViewer;
37 import jalview.schemes.ColourSchemeI;
38 import jalview.schemes.ColourSchemes;
39 import jalview.structure.StructureMapping;
40 import jalview.structures.models.AAStructureBindingModel;
41 import jalview.util.MessageManager;
43 import java.awt.Color;
44 import java.awt.Component;
45 import java.awt.event.ActionEvent;
46 import java.awt.event.ActionListener;
47 import java.awt.event.ItemEvent;
48 import java.awt.event.ItemListener;
49 import java.io.BufferedReader;
51 import java.io.FileOutputStream;
52 import java.io.FileReader;
53 import java.io.IOException;
54 import java.io.PrintWriter;
55 import java.util.ArrayList;
56 import java.util.Collections;
57 import java.util.List;
58 import java.util.Vector;
60 import javax.swing.ButtonGroup;
61 import javax.swing.JCheckBoxMenuItem;
62 import javax.swing.JColorChooser;
63 import javax.swing.JMenu;
64 import javax.swing.JMenuItem;
65 import javax.swing.JRadioButtonMenuItem;
66 import javax.swing.event.MenuEvent;
67 import javax.swing.event.MenuListener;
70 * Base class with common functionality for JMol, Chimera or other structure
76 public abstract class StructureViewerBase extends GStructureViewer
77 implements Runnable, ViewSetProvider
80 * names for colour options (additional to Jalview colour schemes)
84 BySequence, ByChain, ChargeCysteine, ByViewer
88 * list of sequenceSet ids associated with the view
90 protected List<String> _aps = new ArrayList<>();
93 * list of alignment panels to use for superposition
95 protected Vector<AlignmentViewPanel> _alignwith = new Vector<>();
98 * list of alignment panels that are used for colouring structures by aligned
101 protected Vector<AlignmentViewPanel> _colourwith = new Vector<>();
103 private String viewId = null;
105 private AlignmentPanel ap;
107 protected boolean alignAddedStructures = false;
109 protected volatile boolean _started = false;
111 protected volatile boolean addingStructures = false;
113 protected Thread worker = null;
115 protected boolean allChainsSelected = false;
117 protected JMenu viewSelectionMenu;
120 * set after sequence colouring has been applied for this structure viewer.
121 * used to determine if the final sequence/structure mapping has been
124 protected volatile boolean seqColoursApplied = false;
127 * Default constructor
129 public StructureViewerBase()
135 * @return true if added structures should be aligned to existing one(s)
138 public boolean isAlignAddedStructures()
140 return alignAddedStructures;
146 * if added structures should be aligned to existing one(s)
149 public void setAlignAddedStructures(boolean alignAdded)
151 alignAddedStructures = alignAdded;
157 * @return true if this Jmol instance is linked with the given alignPanel
159 public boolean isLinkedWith(AlignmentPanel ap2)
161 return _aps.contains(ap2.av.getSequenceSetId());
164 public boolean isUsedforaligment(AlignmentPanel ap2)
167 return (_alignwith != null) && _alignwith.contains(ap2);
171 public boolean isUsedforcolourby(AlignmentViewPanel avp)
173 return (_colourwith != null) && _colourwith.contains(avp);
178 * @return TRUE if the view is NOT being coloured by the alignment colours.
180 public boolean isColouredByViewer()
182 return !getBinding().isColourBySequence();
185 public String getViewId()
189 viewId = System.currentTimeMillis() + "." + this.hashCode();
194 protected void setViewId(String viewId)
196 this.viewId = viewId;
199 public abstract String getStateInfo();
201 protected void buildActionMenu()
203 if (_alignwith == null)
205 _alignwith = new Vector<>();
207 if (_alignwith.size() == 0 && ap != null)
212 for (Component c : viewerActionMenu.getMenuComponents())
214 if (c != alignStructs)
216 viewerActionMenu.remove((JMenuItem) c);
221 public AlignmentPanel getAlignmentPanel()
226 protected void setAlignmentPanel(AlignmentPanel alp)
232 public AlignmentPanel[] getAllAlignmentPanels()
234 AlignmentPanel[] t, list = new AlignmentPanel[0];
235 for (String setid : _aps)
237 AlignmentPanel[] panels = PaintRefresher.getAssociatedPanels(setid);
240 t = new AlignmentPanel[list.length + panels.length];
241 System.arraycopy(list, 0, t, 0, list.length);
242 System.arraycopy(panels, 0, t, list.length, panels.length);
251 * set the primary alignmentPanel reference and add another alignPanel to the
252 * list of ones to use for colouring and aligning
256 public void addAlignmentPanel(AlignmentPanel nap)
258 if (getAlignmentPanel() == null)
260 setAlignmentPanel(nap);
262 if (!_aps.contains(nap.av.getSequenceSetId()))
264 _aps.add(nap.av.getSequenceSetId());
269 * remove any references held to the given alignment panel
273 public void removeAlignmentPanel(AlignmentPanel nap)
277 _alignwith.remove(nap);
278 _colourwith.remove(nap);
279 if (getAlignmentPanel() == nap)
281 setAlignmentPanel(null);
282 for (AlignmentPanel aps : getAllAlignmentPanels())
286 setAlignmentPanel(aps);
291 } catch (Exception ex)
294 if (getAlignmentPanel() != null)
300 public void useAlignmentPanelForSuperposition(AlignmentPanel nap)
302 addAlignmentPanel(nap);
303 if (!_alignwith.contains(nap))
309 public void excludeAlignmentPanelForSuperposition(AlignmentPanel nap)
311 if (_alignwith.contains(nap))
313 _alignwith.remove(nap);
317 public void useAlignmentPanelForColourbyseq(AlignmentPanel nap,
318 boolean enableColourBySeq)
320 useAlignmentPanelForColourbyseq(nap);
321 getBinding().setColourBySequence(enableColourBySeq);
322 seqColour.setSelected(enableColourBySeq);
323 viewerColour.setSelected(!enableColourBySeq);
326 public void useAlignmentPanelForColourbyseq(AlignmentPanel nap)
328 addAlignmentPanel(nap);
329 if (!_colourwith.contains(nap))
331 _colourwith.add(nap);
335 public void excludeAlignmentPanelForColourbyseq(AlignmentPanel nap)
337 if (_colourwith.contains(nap))
339 _colourwith.remove(nap);
343 public abstract ViewerType getViewerType();
345 protected abstract IProgressIndicator getIProgressIndicator();
348 * add a new structure (with associated sequences and chains) to this viewer,
349 * retrieving it if necessary first.
355 * if true, new structure(s) will be aligned using associated
359 protected void addStructure(final PDBEntry pdbentry,
360 final SequenceI[] seqs, final String[] chains,
361 final IProgressIndicator alignFrame)
363 if (pdbentry.getFile() == null)
365 if (worker != null && worker.isAlive())
367 // a retrieval is in progress, wait around and add ourselves to the
369 new Thread(new Runnable()
374 while (worker != null && worker.isAlive() && _started)
378 Thread.sleep(100 + ((int) Math.random() * 100));
380 } catch (Exception e)
384 // and call ourselves again.
385 addStructure(pdbentry, seqs, chains, alignFrame);
391 // otherwise, start adding the structure.
392 getBinding().addSequenceAndChain(new PDBEntry[] { pdbentry },
394 { seqs }, new String[][] { chains });
395 addingStructures = true;
397 worker = new Thread(this);
402 protected boolean hasPdbId(String pdbId)
404 return getBinding().hasPdbId(pdbId);
408 * Returns a list of any viewer of the instantiated type. The list is
409 * restricted to those linked to the given alignment panel if it is not null.
411 protected List<StructureViewerBase> getViewersFor(AlignmentPanel alp)
413 return Desktop.instance.getStructureViewers(alp, this.getClass());
417 public void addToExistingViewer(PDBEntry pdbentry, SequenceI[] seq,
418 String[] chains, final AlignmentViewPanel apanel, String pdbId)
421 * JAL-1742 exclude view with this structure already mapped (don't offer
422 * to align chain B to chain A of the same structure); code may defend
423 * against this possibility before we reach here
429 AlignmentPanel alignPanel = (AlignmentPanel) apanel; // Implementation error if this
431 useAlignmentPanelForSuperposition(alignPanel);
432 addStructure(pdbentry, seq, chains, alignPanel.alignFrame);
436 * Adds mappings for the given sequences to an already opened PDB structure,
437 * and updates any viewers that have the PDB file
444 public void addSequenceMappingsToStructure(SequenceI[] seq,
445 String[] chains, final AlignmentViewPanel alpanel,
448 AlignmentPanel apanel = (AlignmentPanel) alpanel;
450 // TODO : Fix multiple seq to one chain issue here.
452 * create the mappings
454 apanel.getStructureSelectionManager().setMapping(seq, chains,
455 pdbFilename, DataSourceType.FILE, getIProgressIndicator());
458 * alert the FeatureRenderer to show new (PDB RESNUM) features
460 if (apanel.getSeqPanel().seqCanvas.fr != null)
462 apanel.getSeqPanel().seqCanvas.fr.featuresAdded();
463 // note - we don't do a refresh for structure here because we do it
464 // explicitly for all panels later on
465 apanel.paintAlignment(true, false);
469 * add the sequences to any other viewers (of the same type) for this pdb
472 // JBPNOTE: this looks like a binding routine, rather than a gui routine
473 for (StructureViewerBase viewer : getViewersFor(null))
475 AAStructureBindingModel bindingModel = viewer.getBinding();
476 for (int pe = 0; pe < bindingModel.getPdbCount(); pe++)
478 if (bindingModel.getPdbEntry(pe).getFile().equals(pdbFilename))
480 bindingModel.addSequence(pe, seq);
481 viewer.addAlignmentPanel(apanel);
483 * add it to the set of alignments used for colouring structure by
486 viewer.useAlignmentPanelForColourbyseq(apanel);
487 viewer.buildActionMenu();
488 apanel.getStructureSelectionManager()
489 .sequenceColoursChanged(apanel);
497 public boolean addAlreadyLoadedFile(SequenceI[] seq, String[] chains,
498 final AlignmentViewPanel apanel, String pdbId)
500 String alreadyMapped = apanel.getStructureSelectionManager()
501 .alreadyMappedToFile(pdbId);
503 if (alreadyMapped == null)
508 addSequenceMappingsToStructure(seq, chains, apanel, alreadyMapped);
512 void setChainMenuItems(List<String> chainNames)
514 chainMenu.removeAll();
515 if (chainNames == null || chainNames.isEmpty())
521 * add the 'All' menu item
523 JMenuItem menuItem = new JMenuItem(
524 MessageManager.getString("label.all"));
525 menuItem.addActionListener(new ActionListener()
528 public void actionPerformed(ActionEvent evt)
530 allChainsSelected = true;
531 for (int i = 0; i < chainMenu.getItemCount(); i++)
533 if (chainMenu.getItem(i) instanceof JCheckBoxMenuItem)
535 ((JCheckBoxMenuItem) chainMenu.getItem(i)).setSelected(true);
538 showSelectedChains();
539 allChainsSelected = false;
542 chainMenu.add(menuItem);
545 * add a menu item for each structure and chain
547 Collections.sort(chainNames);
548 String lastSeqName = "";
549 for (String chain : chainNames)
551 String seqName = getSequenceNameForChain(chain);
556 int nameLength = seqName.length();
559 seqName = seqName.substring(0, 8) + "..."
560 + seqName.substring(nameLength - 8, nameLength);
563 if (!lastSeqName.equals(seqName))
565 text = text + " " + seqName;
567 lastSeqName = seqName;
568 menuItem = new JCheckBoxMenuItem(text, true);
569 menuItem.addItemListener(new ItemListener()
572 public void itemStateChanged(ItemEvent evt)
574 if (!allChainsSelected)
576 showSelectedChains();
581 chainMenu.add(menuItem);
586 * Answers the name of the sequence mapped to the given chain (formatted as
587 * pdbId:chainId, e.g. 1A70:A). Answers null if no mapped sequence is found. If
588 * more than one sequence is matched, just answers the name of the first one
594 private String getSequenceNameForChain(String chain)
596 String[] tokens = chain.split(":");
597 String pdbId = tokens[0];
598 String chainId = tokens[1];
599 List<StructureMapping> mappings = getBinding().getSsm()
600 .getMappingForChain(pdbId, chainId);
601 return mappings.isEmpty() ? null
602 : mappings.get(0).getSequence().getName();
606 * Action on selecting one of Jalview's registered colour schemes
609 public void changeColour_actionPerformed(String colourSchemeName)
611 AlignmentI al = getAlignmentPanel().av.getAlignment();
612 ColourSchemeI cs = ColourSchemes.getInstance()
613 .getColourScheme(colourSchemeName, getAlignmentPanel().av, al,
615 getBinding().setJalviewColourScheme(cs);
619 * Builds the colour menu
621 protected void buildColourMenu()
623 colourMenu.removeAll();
624 AlignmentI al = getAlignmentPanel().av.getAlignment();
627 * add colour by sequence, by chain, by charge and cysteine
629 colourMenu.add(seqColour);
630 colourMenu.add(chainColour);
631 colourMenu.add(chargeColour);
632 chargeColour.setEnabled(!al.isNucleotide());
635 * add all 'simple' (per-residue) colour schemes registered to Jalview
637 ButtonGroup itemGroup = ColourMenuHelper.addMenuItems(colourMenu, this,
641 * add 'colour by viewer' (menu item text is set in subclasses)
643 viewerColour.setSelected(false);
644 viewerColour.addActionListener(new ActionListener()
647 public void actionPerformed(ActionEvent actionEvent)
649 viewerColour_actionPerformed(actionEvent);
652 colourMenu.add(viewerColour);
655 * add 'set background colour'
657 JMenuItem backGround = new JMenuItem();
659 .setText(MessageManager.getString("action.background_colour"));
660 backGround.addActionListener(new ActionListener()
663 public void actionPerformed(ActionEvent actionEvent)
665 background_actionPerformed(actionEvent);
668 colourMenu.add(backGround);
671 * add colour buttons to a group so their selection is
672 * mutually exclusive (background colour is a separate option)
674 itemGroup.add(seqColour);
675 itemGroup.add(chainColour);
676 itemGroup.add(chargeColour);
677 itemGroup.add(viewerColour);
681 * Construct menu items
683 protected void initMenus()
685 AAStructureBindingModel binding = getBinding();
687 seqColour = new JRadioButtonMenuItem();
688 seqColour.setText(MessageManager.getString("action.by_sequence"));
689 seqColour.setName(ViewerColour.BySequence.name());
690 seqColour.setSelected(binding.isColourBySequence());
691 seqColour.addActionListener(new ActionListener()
694 public void actionPerformed(ActionEvent actionEvent)
696 seqColour_actionPerformed(actionEvent);
700 chainColour = new JRadioButtonMenuItem();
701 chainColour.setText(MessageManager.getString("action.by_chain"));
702 chainColour.setName(ViewerColour.ByChain.name());
703 chainColour.addActionListener(new ActionListener()
706 public void actionPerformed(ActionEvent actionEvent)
708 chainColour_actionPerformed(actionEvent);
712 chargeColour = new JRadioButtonMenuItem();
713 chargeColour.setText(MessageManager.getString("label.charge_cysteine"));
714 chargeColour.setName(ViewerColour.ChargeCysteine.name());
715 chargeColour.addActionListener(new ActionListener()
718 public void actionPerformed(ActionEvent actionEvent)
720 chargeColour_actionPerformed(actionEvent);
724 viewerColour = new JRadioButtonMenuItem();
725 // text is set in overrides of this method
726 viewerColour.setName(ViewerColour.ByViewer.name());
727 viewerColour.setSelected(!binding.isColourBySequence());
729 if (_colourwith == null)
731 _colourwith = new Vector<>();
733 if (_alignwith == null)
735 _alignwith = new Vector<>();
738 ViewSelectionMenu seqColourBy = new ViewSelectionMenu(
739 MessageManager.getString("label.colour_by"), this, _colourwith,
743 public void itemStateChanged(ItemEvent e)
745 if (!seqColour.isSelected())
751 // update the Chimera display now.
752 seqColour_actionPerformed(null);
756 viewMenu.add(seqColourBy);
758 showAlignmentOnly = new JCheckBoxMenuItem(
759 MessageManager.getString("label.show_alignment_only"));
760 showAlignmentOnly.addActionListener(new ActionListener()
763 public void actionPerformed(ActionEvent e)
765 hideHiddenRegions.setEnabled(showAlignmentOnly.isSelected());
766 getBinding().setShowAlignmentOnly(showAlignmentOnly.isSelected());
767 getBinding().showStructures(getAlignmentPanel().getAlignViewport(),
771 viewMenu.add(showAlignmentOnly);
773 hideHiddenRegions = new JCheckBoxMenuItem(
774 MessageManager.getString("label.hide_hidden_regions"));
775 hideHiddenRegions.setEnabled(false);
776 hideHiddenRegions.addActionListener(new ActionListener()
779 public void actionPerformed(ActionEvent e)
781 getBinding().setHideHiddenRegions(hideHiddenRegions.isSelected());
782 getBinding().showStructures(getAlignmentPanel().getAlignViewport(),
786 viewMenu.add(hideHiddenRegions);
787 viewMenu.add(fitToWindow);
789 final ItemListener handler = new ItemListener()
792 public void itemStateChanged(ItemEvent e)
794 alignStructs.setEnabled(!_alignwith.isEmpty());
795 alignStructs.setToolTipText(MessageManager.formatMessage(
796 "label.align_structures_using_linked_alignment_views",
800 viewSelectionMenu = new ViewSelectionMenu(
801 MessageManager.getString("label.superpose_with"), this,
802 _alignwith, handler);
803 handler.itemStateChanged(null);
804 viewerActionMenu.add(viewSelectionMenu, 0);
805 viewerActionMenu.addMenuListener(new MenuListener()
808 public void menuSelected(MenuEvent e)
810 handler.itemStateChanged(null);
814 public void menuDeselected(MenuEvent e)
819 public void menuCanceled(MenuEvent e)
828 * Sends commands to the structure viewer to superimpose structures based on
829 * currently associated alignments. May optionally return an error message for
833 protected String alignStructs_actionPerformed(ActionEvent actionEvent)
835 return alignStructs_withAllAlignPanels();
838 protected String alignStructs_withAllAlignPanels()
840 if (getAlignmentPanel() == null)
845 if (_alignwith.size() == 0)
847 _alignwith.add(getAlignmentPanel());
853 AlignmentI[] als = new Alignment[_alignwith.size()];
854 HiddenColumns[] alc = new HiddenColumns[_alignwith.size()];
855 int[] alm = new int[_alignwith.size()];
858 for (AlignmentViewPanel alignPanel : _alignwith)
860 AlignViewportI av = alignPanel.getAlignViewport();
861 als[a] = av.getAlignment();
863 alc[a++] = av.getAlignment().getHiddenColumns();
865 reply = getBinding().superposeStructures(als, alm, alc);
868 String text = MessageManager
869 .formatMessage("error.superposition_failed", reply);
870 statusBar.setText(text);
872 } catch (Exception e)
874 StringBuffer sp = new StringBuffer();
875 for (AlignmentViewPanel avp : _alignwith)
878 "'" + ((AlignmentPanel) avp).alignFrame.getTitle() + "' ");
880 Cache.log.info("Couldn't align structures with the " + sp.toString()
881 + "associated alignment panels.", e);
887 public void background_actionPerformed(ActionEvent actionEvent)
889 Color col = JColorChooser.showDialog(this,
890 MessageManager.getString("label.select_background_colour"),
894 getBinding().setBackgroundColour(col);
899 public void viewerColour_actionPerformed(ActionEvent actionEvent)
901 if (viewerColour.isSelected())
903 // disable automatic sequence colouring.
904 getBinding().setColourBySequence(false);
909 public void chainColour_actionPerformed(ActionEvent actionEvent)
911 chainColour.setSelected(true);
912 getBinding().colourByChain();
916 public void chargeColour_actionPerformed(ActionEvent actionEvent)
918 chargeColour.setSelected(true);
919 getBinding().colourByCharge();
923 public void seqColour_actionPerformed(ActionEvent actionEvent)
925 AAStructureBindingModel binding = getBinding();
926 binding.setColourBySequence(seqColour.isSelected());
927 if (_colourwith == null)
929 _colourwith = new Vector<>();
931 if (binding.isColourBySequence())
933 if (!binding.isLoadingFromArchive())
935 if (_colourwith.size() == 0 && getAlignmentPanel() != null)
937 // Make the currently displayed alignment panel the associated view
938 _colourwith.add(getAlignmentPanel().alignFrame.alignPanel);
941 // Set the colour using the current view for the associated alignframe
942 for (AlignmentViewPanel avp : _colourwith)
944 binding.updateStructureColours(avp);
946 seqColoursApplied = true;
951 public void pdbFile_actionPerformed(ActionEvent actionEvent)
953 JalviewFileChooser chooser = new JalviewFileChooser(
954 Cache.getProperty("LAST_DIRECTORY"));
956 chooser.setFileView(new JalviewFileView());
957 chooser.setDialogTitle(MessageManager.getString("label.save_pdb_file"));
958 chooser.setToolTipText(MessageManager.getString("action.save"));
960 int value = chooser.showSaveDialog(this);
962 if (value == JalviewFileChooser.APPROVE_OPTION)
964 BufferedReader in = null;
967 // TODO: cope with multiple PDB files in view
968 in = new BufferedReader(
969 new FileReader(getBinding().getStructureFiles()[0]));
970 File outFile = chooser.getSelectedFile();
972 PrintWriter out = new PrintWriter(new FileOutputStream(outFile));
974 while ((data = in.readLine()) != null)
976 if (!(data.indexOf("<PRE>") > -1 || data.indexOf("</PRE>") > -1))
982 } catch (Exception ex)
984 ex.printStackTrace();
992 } catch (IOException e)
1002 public void viewMapping_actionPerformed(ActionEvent actionEvent)
1004 CutAndPasteTransfer cap = new CutAndPasteTransfer();
1007 cap.appendText(getBinding().printMappings());
1008 } catch (OutOfMemoryError e)
1011 "composing sequence-structure alignments for display in text box.",
1016 Desktop.addInternalFrame(cap,
1017 MessageManager.getString("label.pdb_sequence_mapping"), 550,
1021 protected abstract String getViewerName();
1024 * Configures the title and menu items of the viewer panel.
1027 public void updateTitleAndMenus()
1029 AAStructureBindingModel binding = getBinding();
1030 if (binding.hasFileLoadingError())
1035 setChainMenuItems(binding.getChainNames());
1037 this.setTitle(binding.getViewerTitle(getViewerName(), true));
1040 * enable 'Superpose with' if more than one mapped structure
1042 viewSelectionMenu.setEnabled(false);
1043 if (getBinding().getStructureFiles().length > 1
1044 && getBinding().getSequence().length > 1)
1046 viewSelectionMenu.setEnabled(true);
1050 * Show action menu if it has any enabled items
1052 viewerActionMenu.setVisible(false);
1053 for (int i = 0; i < viewerActionMenu.getItemCount(); i++)
1055 if (viewerActionMenu.getItem(i).isEnabled())
1057 viewerActionMenu.setVisible(true);
1062 if (!binding.isLoadingFromArchive())
1064 seqColour_actionPerformed(null);
1069 public String toString()
1075 public boolean hasMapping()
1077 if (worker != null && (addingStructures || _started))
1081 if (getBinding() == null)
1083 if (_aps == null || _aps.size() == 0)
1085 // viewer has been closed, but we did at some point run.
1090 String[] pdbids = getBinding().getStructureFiles();
1096 for (String pdbid:pdbids) {
1097 StructureMapping sm[] = getBinding().getSsm().getMapping(pdbid);
1098 if (sm!=null && sm.length>0 && sm[0]!=null) {
1102 // only return true if there is a mapping for every structure file we have loaded
1103 if (p == 0 || p != pdbids.length)
1107 // and that coloring has been applied
1108 return seqColoursApplied;
1112 public void raiseViewer()
1118 public abstract AAStructureBindingModel getBinding();
1121 * Show only the selected chain(s) in the viewer
1123 protected void showSelectedChains()
1125 setSelectedChains();
1128 * refresh display without resizing - easier to see what changed
1130 getBinding().showStructures(getAlignmentPanel().getAlignViewport(),