- openNewChimera(ap, new PDBEntry[]
- { pdbentry }, new SequenceI[][]
- { seq });
- }
-
- /**
- * Presents a dialog with the option to add an align a structure to an
- * existing Chimera view
- *
- * @param pdbId
- * @param view
- * @return YES, NO or CANCEL JOptionPane code
- */
- protected int chooseAlignStructureToViewer(String pdbId,
- ChimeraViewFrame view)
- {
- int option = JOptionPane.showInternalConfirmDialog(Desktop.desktop,
- MessageManager.formatMessage("label.add_pdbentry_to_view",
- new Object[]
- { pdbId, view.getTitle() }), MessageManager
- .getString("label.align_to_existing_structure_view"),
- JOptionPane.YES_NO_CANCEL_OPTION);
- return option;
- }
-
- /**
- * Presents a dialog with the option to add sequences to a viewer which
- * already has their structure open
- *
- * @param pdbId
- * @return YES, NO or CANCEL JOptionPane code
- */
- protected int chooseAddSequencesToViewer(String pdbId)
- {
- int option = JOptionPane.showInternalConfirmDialog(Desktop.desktop,
- MessageManager.formatMessage(
- "label.pdb_entry_is_already_displayed", new Object[]
- { pdbId }), MessageManager.formatMessage(
- "label.map_sequences_to_visible_window", new Object[]
- { pdbId }), JOptionPane.YES_NO_CANCEL_OPTION);
- return option;
- }
-
- /**
- * Adds mappings for the given sequences to an already opened PDB structure,
- * and updates any viewers that have the PDB file
- *
- * @param seq
- * @param chains
- * @param ap
- * @param pdbFilename
- */
- protected void addSequenceMappingsToStructure(SequenceI[] seq,
- String[] chains, final AlignmentPanel ap, String pdbFilename)
- {
- // TODO : Fix multiple seq to one chain issue here.
- /*
- * create the mappings
- */
- ap.getStructureSelectionManager().setMapping(seq, chains, pdbFilename,
- AppletFormatAdapter.FILE);
-
- /*
- * alert the FeatureRenderer to show new (PDB RESNUM) features
- */
- if (ap.getSeqPanel().seqCanvas.fr != null)
- {
- ap.getSeqPanel().seqCanvas.fr.featuresAdded();
- ap.paintAlignment(true);
- }
-
- /*
- * add the sequences to any other Chimera viewers for this pdb file
- */
- // JBPNOTE: this looks like a binding routine, rather than a gui routine
- for (JInternalFrame frame : Desktop.instance.getAllFrames())
- {
- if (frame instanceof ChimeraViewFrame)
- {
- ChimeraViewFrame chimeraView = ((ChimeraViewFrame) frame);
- for (int pe = 0; pe < chimeraView.jmb.getPdbCount(); pe++)
- {
- if (chimeraView.jmb.getPdbEntry(pe).getFile().equals(pdbFilename))
- {
- chimeraView.jmb.addSequence(pe, seq);
- chimeraView.addAlignmentPanel(ap);
- /*
- * add it to the set of alignments used for colouring structure by
- * sequence
- */
- chimeraView.useAlignmentPanelForColourbyseq(ap);
- chimeraView.buildActionMenu();
- ap.getStructureSelectionManager().sequenceColoursChanged(ap);
- break;
- }
- }
- }
- }