From: jprocter Date: Tue, 29 Jun 2010 16:22:02 +0000 (+0000) Subject: new ajax api methods for linking existing jmol viewers with sequences in an alignframe X-Git-Tag: Release_2_6~154 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=c68ebaddf1925d9458aab5f2fea6e6f3240b3b99;p=jalview.git new ajax api methods for linking existing jmol viewers with sequences in an alignframe --- diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index 0aefe9b..ccf7c06 100755 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -24,7 +24,10 @@ import java.util.*; import java.awt.*; import java.awt.event.*; +import org.jmol.api.JmolViewer; + import jalview.analysis.*; +import jalview.api.SequenceStructureBinding; import jalview.bin.JalviewLite; import jalview.commands.*; import jalview.datamodel.*; @@ -3180,4 +3183,22 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, DEFAULT_HEIGHT); } } + + public SequenceStructureBinding addJmolInstance(JmolViewer viewer, String[] sequenceIds) + { + SequenceI[] seqs=null; + if (sequenceIds==null || sequenceIds.length==0) + { + seqs = viewport.getAlignment().getSequencesArray(); + } else { + // resolve seqs for sequenceIds. + } + if (// viewer is not mapped) + true){ + AppletJmol jmv = new AppletJmol(viewer, alignPanel, seqs); + return jmv; + } + return null; + + } } diff --git a/src/jalview/bin/JalviewLite.java b/src/jalview/bin/JalviewLite.java index 153d4df..338b319 100755 --- a/src/jalview/bin/JalviewLite.java +++ b/src/jalview/bin/JalviewLite.java @@ -25,6 +25,7 @@ import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; +import jalview.api.SequenceStructureBinding; import jalview.appletgui.*; import jalview.datamodel.*; import jalview.io.*; @@ -1310,30 +1311,34 @@ public class JalviewLite extends Applet * @param alFrame * @param pdbFile - pdbFile URI as given via applet's parameters or by addPdb * @param viewer - * @return true if instance was bound corectly. + * @return binding for viewer * TODO: consider making an exception structure for indicating when binding fails */ - public boolean addJmolInstance(AlignFrame alFrame, String pdbFile, org.jmol.api.JmolViewer viewer) + public SequenceStructureBinding addJmolInstance(AlignFrame alFrame, String pdbFile, org.jmol.api.JmolViewer viewer) { System.err.println("addJmolInstance not yet implemented."); /** */ + return null; + } + /** + * bind structures in a viewer to any matching sequences in an alignFrame (use seuqenceIds to limit scope of search to specific sequences) + * @param alFrame + * @param viewer + * @param sequenceIds + * @return + */ + public SequenceStructureBinding addJmolInstance(AlignFrame alFrame, org.jmol.api.JmolViewer viewer, String sequenceIds) + { if (viewer!=null) { -/* viewer.getFrameCount - } - String alreadyMapped = StructureSelectionManager - .getStructureSelectionManager().alreadyMappedToFile( - pdbentry.getId()); -MCview.PDBfile reader = null; -if (alreadyMapped != null) -{ -reader = StructureSelectionManager.getStructureSelectionManager() - .setMapping(seq, chains, pdbentry.getFile(), protocol); - - } */ + if (sequenceIds!=null && sequenceIds.length()>0) + { + return alFrame.addJmolInstance(viewer, separatorListToArray(sequenceIds)); + } else { + return alFrame.addJmolInstance(viewer, null); + } } - return false; + return null; } - }