X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fjalview%2Fext%2Fjmol%2FJmolCommands.java;h=b38979b06227c8d7d34a902b3b3e2a69c89b5a8e;hb=9f7269a91e9d2fd7992c11939aa797446783ce61;hp=9d01eab7474ec0bd7b1ee1450b2c21c10c066f7a;hpb=6df7bd1b08d0a51e3f6955c17542c3007e40636a;p=jalview.git diff --git a/src/jalview/ext/jmol/JmolCommands.java b/src/jalview/ext/jmol/JmolCommands.java index 9d01eab..b38979b 100644 --- a/src/jalview/ext/jmol/JmolCommands.java +++ b/src/jalview/ext/jmol/JmolCommands.java @@ -1,3 +1,20 @@ +/******************************************************************************* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) + * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + *******************************************************************************/ /** * */ @@ -8,12 +25,12 @@ import jalview.api.SequenceRenderer; import jalview.datamodel.AlignmentI; import jalview.datamodel.SequenceI; import jalview.structure.StructureMapping; +import jalview.structure.StructureMappingcommandSet; import jalview.structure.StructureSelectionManager; import jalview.util.Comparison; import java.awt.Color; import java.util.ArrayList; - /** * Routines for generating Jmol commands for Jalview/Jmol binding * another cruisecontrol test. @@ -26,20 +43,24 @@ public class JmolCommands /** * Jmol utility which constructs the commands to colour chains by the given alignment + * @returns Object[] { Object[] { , * */ - public static String[] getColourBySequenceCommand(StructureSelectionManager ssm, String[] files, SequenceI[][] sequence, SequenceRenderer sr, FeatureRenderer fr, AlignmentI alignment) + public static StructureMappingcommandSet[] getColourBySequenceCommand(StructureSelectionManager ssm, String[] files, SequenceI[][] sequence, SequenceRenderer sr, FeatureRenderer fr, AlignmentI alignment) { - ArrayList str = new ArrayList(); - StringBuffer command = new StringBuffer(); - + + ArrayList cset = new ArrayList(); + for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++) { StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]); + StringBuffer command = new StringBuffer(); + StructureMappingcommandSet smc; + ArrayList str = new ArrayList(); if (mapping == null || mapping.length < 1) continue; - + int lastPos = -1; for (int s = 0; s < sequence[pdbfnum].length; s++) { @@ -100,13 +121,16 @@ public class JmolCommands } } } + { + // add final chunk + str.add(command.toString()); + command.setLength(0); + } + // Finally, add the command set ready to be returned. + cset.add(new StructureMappingcommandSet(JmolCommands.class,files[pdbfnum], str.toArray(new String[str.size()]))); + } - { - // add final chunk - str.add(command.toString()); - command.setLength(0); - } - return str.toArray(new String[str.size()]); + return cset.toArray(new StructureMappingcommandSet[cset.size()]); } public static StringBuffer condenseCommand(StringBuffer command, int pos)