X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fjalview%2Fext%2Fjmol%2FJalviewJmolBinding.java;h=b4586ca8465c3b3571dedc2bb4c68e03d2be28a0;hb=7d6bf4ac01167499c0f4e07de63edcdd72a6d595;hp=7a394f78bc76ed0f61aefc142155b1cca1998a7c;hpb=4d22ba3918844213aaf4c3f58da43f93146159d4;p=jalview.git diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java index 7a394f7..b4586ca 100644 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.java @@ -20,14 +20,13 @@ */ package jalview.ext.jmol; -import jalview.api.AlignmentViewPanel; import jalview.api.FeatureRenderer; import jalview.api.SequenceRenderer; import jalview.datamodel.AlignmentI; import jalview.datamodel.ColumnSelection; import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceI; -import jalview.io.AppletFormatAdapter; +import jalview.io.DataSourceType; import jalview.io.StructureFile; import jalview.schemes.ColourSchemeI; import jalview.schemes.ResidueProperties; @@ -76,8 +75,6 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel Hashtable chainFile; - public String fileLoadingError; - /* * the default or current model displayed if the model cannot be identified * from the selection message @@ -98,7 +95,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel public JalviewJmolBinding(StructureSelectionManager ssm, PDBEntry[] pdbentry, SequenceI[][] sequenceIs, - String protocol) + DataSourceType protocol) { super(ssm, pdbentry, sequenceIs, protocol); /* @@ -241,6 +238,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel * @param _hiddenCols * an array of corresponding hidden columns for each alignment */ + @Override public void superposeStructures(AlignmentI[] _alignment, int[] _refStructure, ColumnSelection[] _hiddenCols) { @@ -487,35 +485,15 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel } /** - * colour any structures associated with sequences in the given alignment - * using the getFeatureRenderer() and getSequenceRenderer() renderers but only - * if colourBySequence is enabled. + * Sends a set of colour commands to the structure viewer + * + * @param colourBySequenceCommands */ - public void colourBySequence(AlignmentViewPanel alignmentv) + @Override + protected void colourBySequence( + StructureMappingcommandSet[] colourBySequenceCommands) { - boolean showFeatures = alignmentv.getAlignViewport() - .isShowSequenceFeatures(); - if (!colourBySequence || !isLoadingFinished()) - { - return; - } - if (getSsm() == null) - { - return; - } - String[] files = getPdbFile(); - - SequenceRenderer sr = getSequenceRenderer(alignmentv); - - FeatureRenderer fr = null; - if (showFeatures) - { - fr = getFeatureRenderer(alignmentv); - } - AlignmentI alignment = alignmentv.getAlignment(); - - for (jalview.structure.StructureMappingcommandSet cpdbbyseq : getColourBySequenceCommands( - files, sr, fr, alignment)) + for (StructureMappingcommandSet cpdbbyseq : colourBySequenceCommands) { for (String cbyseq : cpdbbyseq.commands) { @@ -531,6 +509,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel * @param alignment * @return */ + @Override protected StructureMappingcommandSet[] getColourBySequenceCommands( String[] files, SequenceRenderer sr, FeatureRenderer fr, AlignmentI alignment) @@ -598,17 +577,6 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel } /** - * returns the current featureRenderer that should be used to colour the - * structures - * - * @param alignment - * - * @return - */ - public abstract FeatureRenderer getFeatureRenderer( - AlignmentViewPanel alignment); - - /** * instruct the Jalview binding to update the pdbentries vector if necessary * prior to matching the jmol view's contents to the list of structure files * Jalview knows about. @@ -717,16 +685,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel return null; } - /** - * returns the current sequenceRenderer that should be used to colour the - * structures - * - * @param alignment - * - * @return - */ - public abstract SequenceRenderer getSequenceRenderer( - AlignmentViewPanel alignment); + // /////////////////////////////// // JmolStatusListener @@ -1148,7 +1107,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel // see JAL-623 - need method of matching pasted data up { pdb = getSsm().setMapping(getSequence()[pe], getChains()[pe], - pdbfile, AppletFormatAdapter.PASTE); + pdbfile, DataSourceType.PASTE); getPdbEntry(modelnum).setFile("INLINE" + pdb.getId()); matches = true; foundEntry = true; @@ -1166,12 +1125,12 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel // needs // to be tested. See mantis bug // https://mantis.lifesci.dundee.ac.uk/view.php?id=36605 - String protocol = AppletFormatAdapter.URL; + DataSourceType protocol = DataSourceType.URL; try { if (fl.exists()) { - protocol = AppletFormatAdapter.FILE; + protocol = DataSourceType.FILE; } } catch (Exception e) { @@ -1286,6 +1245,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel } + @Override public void setJalviewColourScheme(ColourSchemeI cs) { colourBySequence = false; @@ -1300,10 +1260,12 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel command.append("select *;color white;"); List residueSet = ResidueProperties.getResidues(isNucleotide(), false); - for (String res : residueSet) + for (String resName : residueSet) { - Color col = cs.findColour(res.charAt(0)); - command.append("select " + res + ";color[" + col.getRed() + "," + char res = resName.length() == 3 ? ResidueProperties + .getSingleCharacterCode(resName) : resName.charAt(0); + Color col = cs.findColour(res); + command.append("select " + resName + ";color[" + col.getRed() + "," + col.getGreen() + "," + col.getBlue() + "];"); } @@ -1400,6 +1362,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel protected org.jmol.api.JmolAppConsoleInterface console = null; + @Override public void setBackgroundColour(java.awt.Color col) { jmolHistory(false);