+/*******************************************************************************
+ * 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 <http://www.gnu.org/licenses/>.
+ *******************************************************************************/
/**\r
* \r
*/\r
import jalview.datamodel.AlignmentI;\r
import jalview.datamodel.SequenceI;\r
import jalview.structure.StructureMapping;\r
+import jalview.structure.StructureMappingcommandSet;\r
import jalview.structure.StructureSelectionManager;\r
import jalview.util.Comparison;\r
\r
import java.awt.Color;\r
import java.util.ArrayList;\r
-\r
/**\r
* Routines for generating Jmol commands for Jalview/Jmol binding\r
* another cruisecontrol test.\r
\r
/**\r
* Jmol utility which constructs the commands to colour chains by the given alignment\r
+ * @returns Object[] { Object[] { <model being coloured>, \r
* \r
*/\r
- public static String[] getColourBySequenceCommand(StructureSelectionManager ssm, String[] files, SequenceI[][] sequence, SequenceRenderer sr, FeatureRenderer fr, AlignmentI alignment)\r
+ public static StructureMappingcommandSet[] getColourBySequenceCommand(StructureSelectionManager ssm, String[] files, SequenceI[][] sequence, SequenceRenderer sr, FeatureRenderer fr, AlignmentI alignment)\r
{\r
- ArrayList<String> str = new ArrayList<String>();\r
- StringBuffer command = new StringBuffer();\r
- \r
+ \r
+ ArrayList<StructureMappingcommandSet> cset = new ArrayList<StructureMappingcommandSet>();\r
+ \r
for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)\r
{\r
StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]);\r
+ StringBuffer command = new StringBuffer();\r
+ StructureMappingcommandSet smc;\r
+ ArrayList<String> str = new ArrayList<String>();\r
\r
if (mapping == null || mapping.length < 1)\r
continue;\r
- \r
+ \r
int lastPos = -1;\r
for (int s = 0; s < sequence[pdbfnum].length; s++)\r
{\r
}\r
}\r
}\r
+ {\r
+ // add final chunk\r
+ str.add(command.toString());\r
+ command.setLength(0);\r
+ }\r
+ // Finally, add the command set ready to be returned.\r
+ cset.add(new StructureMappingcommandSet(JmolCommands.class,files[pdbfnum], str.toArray(new String[str.size()])));\r
+\r
}\r
- {\r
- // add final chunk\r
- str.add(command.toString());\r
- command.setLength(0);\r
- }\r
- return str.toArray(new String[str.size()]);\r
+ return cset.toArray(new StructureMappingcommandSet[cset.size()]);\r
}\r
\r
public static StringBuffer condenseCommand(StringBuffer command, int pos)\r