X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fext%2Fjmol%2FJmolCommands.java;fp=src%2Fjalview%2Fext%2Fjmol%2FJmolCommands.java;h=6bf701004ffafb344ff363a12828385fb9fcbc6d;hb=f063821ed0be9c1581af74643a1aa5798731af65;hp=d5676c5246e20bb01c7e8a7e0fd79af336f64cdf;hpb=fd18e2c73cd015d4e38ad91da0e5d7532ff0ef42;p=jalview.git diff --git a/src/jalview/ext/jmol/JmolCommands.java b/src/jalview/ext/jmol/JmolCommands.java index d5676c5..6bf7010 100644 --- a/src/jalview/ext/jmol/JmolCommands.java +++ b/src/jalview/ext/jmol/JmolCommands.java @@ -20,16 +20,21 @@ */ package jalview.ext.jmol; +import jalview.api.AlignViewportI; +import jalview.api.AlignmentViewPanel; import jalview.api.FeatureRenderer; import jalview.api.SequenceRenderer; import jalview.datamodel.AlignmentI; +import jalview.datamodel.HiddenColumns; import jalview.datamodel.SequenceI; +import jalview.renderer.seqfeatures.FeatureColourFinder; import jalview.structure.StructureMapping; import jalview.structure.StructureMappingcommandSet; import jalview.structure.StructureSelectionManager; import java.awt.Color; import java.util.ArrayList; +import java.util.List; /** * Routines for generating Jmol commands for Jalview/Jmol binding another @@ -50,11 +55,15 @@ public class JmolCommands */ public static StructureMappingcommandSet[] getColourBySequenceCommand( StructureSelectionManager ssm, String[] files, - SequenceI[][] sequence, SequenceRenderer sr, FeatureRenderer fr, - AlignmentI alignment) + SequenceI[][] sequence, SequenceRenderer sr, + AlignmentViewPanel viewPanel) { - - ArrayList cset = new ArrayList(); + FeatureRenderer fr = viewPanel.getFeatureRenderer(); + FeatureColourFinder finder = new FeatureColourFinder(fr); + AlignViewportI viewport = viewPanel.getAlignViewport(); + HiddenColumns cs = viewport.getAlignment().getHiddenColumns(); + AlignmentI al = viewport.getAlignment(); + List cset = new ArrayList(); for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++) { @@ -74,9 +83,9 @@ public class JmolCommands for (int sp, m = 0; m < mapping.length; m++) { if (mapping[m].getSequence() == sequence[pdbfnum][s] - && (sp = alignment.findIndex(sequence[pdbfnum][s])) > -1) + && (sp = al.findIndex(sequence[pdbfnum][s])) > -1) { - SequenceI asp = alignment.getSequenceAt(sp); + SequenceI asp = al.getSequenceAt(sp); for (int r = 0; r < asp.getLength(); r++) { // no mapping to gaps in sequence @@ -93,27 +102,25 @@ public class JmolCommands lastPos = pos; - Color col = sr.getResidueBoxColour(sequence[pdbfnum][s], r); + Color col = sr.getResidueColour(sequence[pdbfnum][s], r, + finder); - if (fr != null) + /* + * shade hidden regions darker + */ + if (!cs.isVisible(r)) { - col = fr.findFeatureColour(col, sequence[pdbfnum][s], r); + col = Color.GRAY; } - String newSelcom = (mapping[m].getChain() != " " ? ":" - + mapping[m].getChain() : "") - + "/" - + (pdbfnum + 1) - + ".1" - + ";color[" - + col.getRed() - + "," - + col.getGreen() - + "," + + String newSelcom = (mapping[m].getChain() != " " + ? ":" + mapping[m].getChain() + : "") + "/" + (pdbfnum + 1) + ".1" + ";color[" + + col.getRed() + "," + col.getGreen() + "," + col.getBlue() + "]"; - if (command.length() > newSelcom.length() - && command.substring( - command.length() - newSelcom.length()) - .equals(newSelcom)) + if (command.length() > newSelcom.length() && command + .substring(command.length() - newSelcom.length()) + .equals(newSelcom)) { command = JmolCommands.condenseCommand(command, pos); continue;