3 * Copyright (c) 2006 The Regents of the University of California.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions, and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above
12 * copyright notice, this list of conditions, and the following
13 * disclaimer in the documentation and/or other materials provided
14 * with the distribution.
15 * 3. Redistributions must acknowledge that this software was
16 * originally developed by the UCSF Computer Graphics Laboratory
17 * under support by the NIH National Center for Research Resources,
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
21 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
26 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
27 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
29 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 package ext.edu.ucsf.rbvi.strucviz2;
35 import java.awt.Color;
36 import java.util.ArrayList;
37 import java.util.HashMap;
38 import java.util.List;
41 import org.slf4j.Logger;
42 import org.slf4j.LoggerFactory;
44 import ext.edu.ucsf.rbvi.strucviz2.StructureManager.ModelType;
46 public abstract class ChimUtils
49 private static Logger logger = LoggerFactory.getLogger(ChimUtils.class);
51 static int MAX_SUB_MODELS = 1000;
53 public static final HashMap<String, String> aaNames;
55 public static String RESIDUE_ATTR = "ChimeraResidue";
57 public static String RINALYZER_ATTR = "RINalyzerResidue";
59 public static String DEFAULT_STRUCTURE_KEY = "pdbFileName";
62 * Parse the model number returned by Chimera and return the int value
64 // invoked by the ChimeraModel constructor
65 // line = model id #0 type Molecule name 1ert
66 public static int[] parseModelNumber(String inputLine)
68 int hash = inputLine.indexOf('#');
69 int space = inputLine.indexOf(' ', hash);
70 int decimal = inputLine.substring(hash + 1, space).indexOf('.');
71 // model number is between hash+1 and space
73 int subModelNumber = 0;
78 subModelNumber = Integer.parseInt(inputLine.substring(decimal
80 space = decimal + hash + 1;
82 modelNumber = Integer.parseInt(inputLine.substring(hash + 1, space));
85 logger.warn("Unexpected return from Chimera: " + inputLine, e);
87 return new int[] { modelNumber, subModelNumber };
91 * Parse the model number returned by Chimera and return the int value
93 // invoked by openModel in ChimeraManager
94 // line: #1, chain A: hiv-1 protease
95 // line: Model 0 (filename)
96 public static int[] parseOpenedModelNumber(String inputLine)
98 int hash = inputLine.indexOf('#');
102 hash = inputLine.indexOf("Model");
107 space = inputLine.indexOf(' ', hash + 1);
111 space = inputLine.indexOf(',', hash);
114 int decimal = inputLine.substring(hash + 1, space).indexOf('.');
115 // model number is between hash+1 and space
116 int modelNumber = -1;
117 int subModelNumber = 0;
122 subModelNumber = Integer.parseInt(inputLine.substring(decimal
124 space = decimal + hash + 1;
126 modelNumber = Integer.parseInt(inputLine.substring(hash + 1, space));
127 } catch (Exception e)
129 logger.warn("Unexpected return from Chimera: " + inputLine, e);
131 return new int[] { modelNumber, subModelNumber };
135 * Parse the model identifier returned by Chimera and return the String value
137 // invoked by the ChimeraModel constructor
138 // line = model id #0 type Molecule name 1ert
139 public static String parseModelName(String inputLine)
141 int start = inputLine.indexOf("name ");
146 // Might get a quoted string (don't understand why, but there you have it)
147 if (inputLine.startsWith("\"", start + 5))
149 start += 6; // Skip over the first quote
150 int end = inputLine.lastIndexOf('"');
153 return inputLine.substring(start, end);
157 return inputLine.substring(start);
162 return inputLine.substring(start + 5);
166 public static Color parseModelColor(String inputLine)
170 int colorStart = inputLine.indexOf("color ");
171 String colorString = inputLine.substring(colorStart + 6);
172 String[] rgbStrings = colorString.split(",");
173 float[] rgbValues = new float[4];
174 for (int i = 0; i < rgbStrings.length; i++)
176 Float f = new Float(rgbStrings[i]);
177 rgbValues[i] = f.floatValue();
179 if (rgbStrings.length == 4)
181 return new Color(rgbValues[0], rgbValues[1], rgbValues[2],
186 return new Color(rgbValues[0], rgbValues[1], rgbValues[2]);
188 } catch (Exception ex)
190 logger.warn("Unexpected return from Chimera: " + inputLine, ex);
196 * Create the key to use for forming the model/submodel key into the modelHash
201 * the submodel number
202 * @return the model key as an Integer
204 public static Integer makeModelKey(int model, int subModel)
206 return new Integer(model * MAX_SUB_MODELS + subModel);
209 // invoked by the getResdiue (parseConnectivityReplies in
210 // CreateStructureNetworkTask)
211 // atomSpec = #0:1.A or #1:96.B@N
212 public static ChimeraModel getModel(String atomSpec,
213 ChimeraManager chimeraManager)
215 // System.out.println("getting model for "+atomSpec);
216 String[] split = atomSpec.split(":");
217 // No model specified....
218 if (split[0].length() == 0)
220 logger.info("Unexpected return from Chimera: " + atomSpec);
223 // System.out.println("model = "+split[0].substring(1));
228 String[] subSplit = split[0].substring(1).split("\\.");
229 if (subSplit.length > 0)
231 model = Integer.parseInt(subSplit[0]);
235 model = Integer.parseInt(split[0].substring(1));
238 if (subSplit.length > 1)
240 submodel = Integer.parseInt(subSplit[1]);
242 } catch (Exception e)
245 logger.warn("Unexpected return from Chimera: " + atomSpec, e);
247 return chimeraManager.getChimeraModel(model, submodel);
250 // invoked by the parseConnectivityReplies in CreateStructureNetworkTask
251 // atomSpec = #0:1.A or #1:96.B@N
252 public static ChimeraResidue getResidue(String atomSpec,
253 ChimeraManager chimeraManager)
255 // System.out.println("Getting residue from: "+atomSpec);
256 ChimeraModel model = getModel(atomSpec, chimeraManager); // Get the model
259 model = chimeraManager.getChimeraModel();
261 return getResidue(atomSpec, model);
264 // invoked by the getResdiue (parseConnectivityReplies in
265 // CreateStructureNetworkTask)
266 // atomSpec = #0:1.A or #1:96.B@N
267 public static ChimeraResidue getResidue(String atomSpec,
270 // System.out.println("Getting residue from: "+atomSpec);
271 String[] split = atomSpec.split(":|@");
273 // Split into residue and chain
274 String[] residueChain = split[1].split("\\.");
276 if (residueChain[0].length() == 0)
278 logger.info("Unexpected return from Chimera: " + atomSpec);
282 if (residueChain.length == 2 && residueChain[1].length() > 0)
284 ChimeraChain chain = model.getChain(residueChain[1]);
285 return chain.getResidue(residueChain[0]);
287 return model.getResidue("_", residueChain[0]);
290 public static ChimeraChain getChain(String atomSpec, ChimeraModel model)
292 String[] split = atomSpec.split(":|@");
294 // Split into residue and chain
295 String[] residueChain = split[1].split("\\.");
296 if (residueChain.length == 1)
298 logger.info("Unexpected return from Chimera: " + atomSpec);
301 return model.getChain(residueChain[1]);
304 public static String getAtomName(String atomSpec)
306 String[] split = atomSpec.split("@");
307 if (split.length > 1)
314 public static boolean isBackbone(String atom)
316 if (atom.equals("C") || atom.equals("CA") || atom.equals("N")
317 || atom.equals("O") || atom.equals("H"))
324 public static String getIntSubtype(String node, String atom)
326 String[] split = node.split("#| ");
328 if (split.length == 2)
330 resType = split[0].trim().toUpperCase();
332 else if (split.length == 3)
334 resType = split[1].trim().toUpperCase();
336 if (resType.equalsIgnoreCase("HOH") || resType.equalsIgnoreCase("WAT"))
340 else if (aaNames.containsKey(resType))
342 if (atom.equals("C") || atom.equals("CA") || atom.equals("N")
343 || atom.equals("O") || atom.equals("H"))
358 public static String[] getResKeyParts(String resKey)
360 // [pdbID[.modelNo]#][residueID][.chainID]
361 // pdbID := 4-character code | "URL" | "path"
362 String[] resKeyParts = new String[4];
363 String[] split = resKey.split("#");
364 String resChain = null;
365 // if no "#" then it is either only a pdb id or a residue or a chain
366 if (split.length == 1)
368 // pdb id without model
369 if (resKey.length() == 4 && resKey.indexOf("\\.") < 0)
371 parseModelID(resKey, resKeyParts);
374 else if (resKey.startsWith("\""))
376 parseModelID(resKey, resKeyParts);
378 // chain and residue or model and number
381 String[] splitSplit = resKey.split("\\.");
382 if (splitSplit.length == 1)
384 // only a chain or a residue
392 Integer.parseInt(splitSplit[1]);
393 parseModelID(resKey, resKeyParts);
394 } catch (NumberFormatException ex)
402 else if (split.length == 2)
404 // model and residue+chain
405 parseModelID(split[0], resKeyParts);
410 // model string with "#"
411 // TODO: [Optional] Are there more possibilities?
412 parseModelID(resKey.substring(0, resKey.lastIndexOf("#")),
414 resChain = resKey.substring(resKey.lastIndexOf("#") + 1,
417 if (resChain != null)
419 // System.out.println(resChain);
420 String[] resChainSplit = resChain.split("\\.");
421 if (resChainSplit.length == 1)
423 // TODO: [Optional] Find a better way to distinguish between chain and
425 // if only one character and not an int, probably a chain
426 if (resChainSplit[0].length() == 1)
430 Integer.parseInt(resChainSplit[0]);
431 resKeyParts[3] = resChainSplit[0];
432 } catch (NumberFormatException ex)
434 resKeyParts[2] = resChainSplit[0];
439 resKeyParts[3] = resChainSplit[0];
442 else if (resChainSplit.length == 2)
444 resKeyParts[2] = resChainSplit[0];
445 resKeyParts[3] = resChainSplit[1];
450 logger.info("Could not parse residue identifier: " + resKey);
453 // String print = "";
454 // for (int i = 0; i < resKeyParts.length; i++) {
455 // if (resKeyParts[i] == null) {
456 // print += i + ": null\t";
458 // print += i + ": " + resKeyParts[i] + ";";
461 // System.out.println(print);
465 public static void parseModelID(String modelID, String[] resKeyParts)
467 if (modelID.startsWith("\""))
469 if (modelID.endsWith("\""))
471 resKeyParts[0] = modelID.substring(1, modelID.length() - 1);
478 Integer.parseInt(modelID.substring(modelID.lastIndexOf("\"") + 2,
480 resKeyParts[0] = modelID.substring(0,
481 modelID.lastIndexOf("\"") - 1);
482 resKeyParts[1] = modelID.substring(modelID.lastIndexOf("\"") + 2,
484 } catch (NumberFormatException ex)
486 resKeyParts[0] = modelID.substring(1);
492 String[] modelIDNo = modelID.split("\\.");
493 if (modelIDNo.length == 1)
495 resKeyParts[0] = modelIDNo[0];
497 else if (modelIDNo.length == 2)
501 Integer.parseInt(modelIDNo[1]);
502 resKeyParts[0] = modelIDNo[0];
503 resKeyParts[1] = modelIDNo[1];
504 } catch (NumberFormatException ex)
506 resKeyParts[0] = modelID;
511 // length > 1, so we probably have a file name with "." in it
512 logger.info("Could not parse model identifier: " + modelID);
513 resKeyParts[0] = modelID;
519 * This method takes a Cytoscape attribute specification
520 * ([structure#][residue][.chainID]) and returns the lowest-level object
521 * referenced by the spec. For example, if the spec is "1tkk", this method
522 * will return a ChimeraModel. If the spec is ".A", it will return a
526 * the specification string
527 * @param chimeraManager
528 * the Chimera object we're currently using
529 * @return a ChimeraStructuralObject of the lowest type
531 public static ChimeraStructuralObject fromAttributeOld(String attrSpec,
532 ChimeraManager chimeraManager)
534 if (attrSpec == null || attrSpec.indexOf(',') > 0
535 || attrSpec.indexOf('-') > 0)
537 // No support for either lists or ranges
538 logger.warn("No support for identifier: " + attrSpec);
542 String residue = null;
546 ChimeraModel chimeraModel = null;
547 ChimeraChain chimeraChain = null;
548 ChimeraResidue chimeraResidue = null;
550 // System.out.println("Getting object from attribute: "+attrSpec);
553 String[] split = attrSpec.split("#");
554 String resChain = null;
555 if (split.length == 1)
560 else if (split.length == 2)
568 // model string with "#"
569 model = attrSpec.substring(0, attrSpec.lastIndexOf("#"));
570 resChain = attrSpec.substring(attrSpec.lastIndexOf("#") + 1,
573 if (resChain != null)
575 String[] resChainSplit = resChain.split("\\.");
576 if (resChainSplit.length == 1)
578 residue = resChainSplit[0];
580 else if (resChainSplit.length == 2)
582 residue = resChainSplit[0];
583 chain = resChainSplit[1];
588 logger.warn("No support for identifier: " + attrSpec);
592 // if (split.length == 1) {
594 // residue = split[0];
595 // } else if (split.length == 3) {
596 // // We have all three
598 // residue = split[1];
600 // } else if (split.length == 2 && attrSpec.indexOf('#') > 0) {
601 // // Model and Residue
603 // residue = split[1];
605 // // Residue and Chain
606 // residue = split[0];
610 // System.out.println("model = " + model + " chain = " + chain +
611 // " residue = " + residue);
614 List<ChimeraModel> models = chimeraManager.getChimeraModels(model,
615 ModelType.PDB_MODEL);
616 if (models.size() == 1)
618 chimeraModel = models.get(0);
624 chimeraModel = chimeraManager.getChimeraModel(
625 Integer.valueOf(model), 0);
626 } catch (NumberFormatException ex)
632 if (chimeraModel == null)
634 chimeraModel = chimeraManager.getChimeraModel();
636 // System.out.println("ChimeraModel = " + chimeraModel);
640 chimeraChain = chimeraModel.getChain(chain);
641 // System.out.println("ChimeraChain = " + chimeraChain);
645 if (chimeraChain != null)
647 chimeraResidue = chimeraChain.getResidue(residue);
651 chimeraResidue = chimeraModel.getResidue("_", residue);
653 // System.out.println("ChimeraResidue = " + chimeraResidue);
656 if (chimeraResidue != null)
658 return chimeraResidue;
661 if (chimeraChain != null)
666 if (chimeraModel != null)
671 } catch (Exception ex)
673 logger.warn("Could not parse residue identifier: " + attrSpec, ex);
678 public static ChimeraStructuralObject fromAttribute(String attrSpec,
679 ChimeraManager chimeraManager)
681 // TODO: Make sure it is OK to remove this: || attrSpec.indexOf('-') > 0
682 if (attrSpec == null || attrSpec.indexOf(',') > 0)
684 // No support for either lists or ranges
685 // System.out.println("No support for identifier: " + attrSpec);
686 logger.warn("No support for identifier: " + attrSpec);
689 String[] modelIDNoResChain = getResKeyParts(attrSpec);
691 ChimeraModel chimeraModel = null;
692 ChimeraChain chimeraChain = null;
693 ChimeraResidue chimeraResidue = null;
695 // System.out.println("Getting object from attribute: "+attrSpec);
698 if (modelIDNoResChain[0] != null)
700 String modelID = modelIDNoResChain[0];
701 List<ChimeraModel> models = chimeraManager.getChimeraModels(
702 modelID, ModelType.PDB_MODEL);
703 if (models.size() == 1)
704 { // usual case with only one model
705 chimeraModel = models.get(0);
707 else if (models.size() > 1 && modelIDNoResChain[1] != null)
709 // there are several submodels
712 int modelNo = Integer.valueOf(modelIDNoResChain[1]);
713 for (ChimeraModel model : models)
715 if (model.getSubModelNumber() == modelNo)
717 chimeraModel = model;
721 } catch (NumberFormatException ex)
728 // TODO: [Optional] What is this doing?
731 chimeraModel = chimeraManager.getChimeraModel(
732 Integer.valueOf(modelID), 0);
733 } catch (NumberFormatException ex)
739 if (chimeraModel == null)
741 // TODO: [Optional] Find a better way to handle this case
742 // If no model can be matched, continue
743 // System.out.println("No matching model could be find for " +
746 // chimeraModel = chimeraManager.getChimeraModel();
747 // logger.warn("No matching model could be find for " + attrSpec +
749 // + chimeraModel.toSpec());
751 // System.out.println("ChimeraModel = " + chimeraModel);
753 if (modelIDNoResChain[3] != null)
755 chimeraChain = chimeraModel.getChain(modelIDNoResChain[3]);
756 // System.out.println("ChimeraChain = " + chimeraChain);
758 if (modelIDNoResChain[2] != null)
760 String residue = modelIDNoResChain[2];
761 if (chimeraChain != null)
763 chimeraResidue = chimeraChain.getResidue(residue);
765 else if (chimeraModel.getChain("_") != null)
767 chimeraResidue = chimeraModel.getResidue("_", residue);
769 else if (chimeraModel.getChainCount() == 1)
771 chimeraResidue = chimeraModel.getResidue(chimeraModel
772 .getChainNames().iterator().next(), residue);
774 // System.out.println("ChimeraResidue = " + chimeraResidue);
777 if (chimeraResidue != null)
779 return chimeraResidue;
782 if (chimeraChain != null)
787 if (chimeraModel != null)
792 } catch (Exception ex)
794 // System.out.println("Could not parse chimera identifier: " +
795 // attrSpec+"("+ex.getMessage()+")");
796 logger.warn("Could not parse chimera identifier: " + attrSpec, ex);
802 * Search for structure references in the residue list
805 * the list of residues
806 * @return a concatenated list of structures encoded in the list
808 public static String findStructures(String residueList)
810 if (residueList == null)
814 String[] residues = residueList.split(",");
815 Map<String, String> structureNameMap = new HashMap<String, String>();
816 for (int i = 0; i < residues.length; i++)
818 String[] components = residues[i].split("#");
819 if (components.length > 1)
821 structureNameMap.put(components[0], components[1]);
824 if (structureNameMap.isEmpty())
829 String structure = null;
830 for (String struct : structureNameMap.keySet())
832 if (structure == null)
834 structure = new String();
838 structure = structure.concat(",");
840 structure = structure.concat(struct);
845 // invoked by openStructures in StructureManager
846 public static List<String> parseFuncRes(List<String> residueNames,
849 List<String> resRanges = new ArrayList<String>();
850 for (int i = 0; i < residueNames.size(); i++)
852 String residue = residueNames.get(i);
853 // Parse out the structure, if there is one
854 String[] components = residue.split("#");
855 if (components.length > 1 && !modelName.equals(components[0]))
859 else if (components.length > 1)
861 residue = components[1];
863 else if (components.length == 1)
865 residue = components[0];
867 // Check to see if we have a range-spec
868 String resRange = "";
869 if (residue == null || residue.equals("") || residue.length() == 0)
873 String[] range = residue.split("-", 2);
875 for (int res = 0; res < range.length; res++)
879 resRange = resRange.concat("-");
880 if (chain != null && range[res].indexOf('.') == -1)
882 range[res] = range[res].concat("." + chain);
886 if (res == 0 && range.length >= 2 && range[res].indexOf('.') > 0)
888 // This is a range spec with the leading residue containing a chain
890 String[] resChain = range[res].split("\\.");
892 range[res] = resChain[0];
894 // Fix weird SFLD syntax...
895 if (range[res].indexOf('|') > 0
896 && Character.isDigit(range[res].charAt(0)))
898 int offset = range[res].indexOf('|');
899 String str = range[res].substring(offset + 1)
900 + range[res].substring(0, offset);
904 // Convert to legal atom-spec
905 if (Character.isDigit(range[res].charAt(0)))
907 resRange = resRange.concat(range[res]);
909 else if (Character.isDigit(range[res].charAt(1)))
911 resRange = resRange.concat(range[res].substring(1));
913 else if (range[res].charAt(0) == '.')
915 // Do we have a chain spec?
916 resRange = resRange.concat(range[res]);
920 resRange = resRange.concat(range[res].substring(3));
923 if (!resRanges.contains(resRange))
925 resRanges.add(resRange);
933 aaNames = new HashMap<String, String>();
934 aaNames.put("ALA", "A Ala Alanine N[C@@H](C)C(O)=O");
935 aaNames.put("ARG", "R Arg Arginine N[C@@H](CCCNC(N)=N)C(O)=O");
936 aaNames.put("ASN", "N Asn Asparagine N[C@@H](CC(N)=O)C(O)=O");
937 aaNames.put("ASP", "D Asp Aspartic_acid N[C@@H](CC(O)=O)C(O)=O");
938 aaNames.put("CYS", "C Cys Cysteine N[C@@H](CS)C(O)=O");
939 aaNames.put("GLN", "Q Gln Glutamine N[C@H](C(O)=O)CCC(N)=O");
940 aaNames.put("GLU", "E Glu Glumatic_acid N[C@H](C(O)=O)CCC(O)=O");
941 aaNames.put("GLY", "G Gly Glycine NCC(O)=O");
942 aaNames.put("HIS", "H His Histidine N[C@@H](CC1=CN=CN1)C(O)=O");
943 aaNames.put("ILE", "I Ile Isoleucine N[C@]([C@H](C)CC)([H])C(O)=O");
944 aaNames.put("LEU", "L Leu Leucine N[C@](CC(C)C)([H])C(O)=O");
945 aaNames.put("LYS", "K Lys Lysine N[C@](CCCCN)([H])C(O)=O");
946 aaNames.put("DLY", "K Dly D-Lysine NCCCC[C@@H](N)C(O)=O");
947 aaNames.put("MET", "M Met Methionine N[C@](CCSC)([H])C(O)=O");
948 aaNames.put("PHE", "F Phe Phenylalanine N[C@](CC1=CC=CC=C1)([H])C(O)=O");
949 aaNames.put("PRO", "P Pro Proline OC([C@@]1([H])NCCC1)=O");
950 aaNames.put("SER", "S Ser Serine OC[C@](C(O)=O)([H])N");
951 aaNames.put("THR", "T Thr Threonine O[C@H](C)[C@](C(O)=O)([H])N");
953 "W Trp Tryptophan N[C@@]([H])(CC1=CN([H])C2=C1C=CC=C2)C(O)=O");
954 aaNames.put("TYR", "Y Tyr Tyrosine N[C@@](C(O)=O)([H])CC1=CC=C(O)C=C1");
955 aaNames.put("VAL", "V Val Valine N[C@@](C(O)=O)([H])C(C)C");
956 aaNames.put("ASX", "B Asx Aspartic_acid_or_Asparagine");
957 aaNames.put("GLX", "Z Glx Glutamine_or_Glutamic_acid");
958 aaNames.put("XAA", "X Xaa Any_or_unknown_amino_acid");
959 aaNames.put("HOH", "HOH HOH Water [H]O[H]");
963 * Convert the amino acid type to a full name
966 * the residue type to convert
967 * @return the full name of the residue
969 public static String toFullName(String aaType)
971 if (!aaNames.containsKey(aaType))
975 String[] ids = aaNames.get(aaType).split(" ");
976 return ids[2].replace('_', ' ');
980 * Convert the amino acid type to a single letter
983 * the residue type to convert
984 * @return the single letter representation of the residue
986 public static String toSingleLetter(String aaType)
988 if (!aaNames.containsKey(aaType))
992 String[] ids = aaNames.get(aaType).split(" ");
997 * Convert the amino acid type to three letters
1000 * the residue type to convert
1001 * @return the three letter representation of the residue
1003 public static String toThreeLetter(String aaType)
1005 if (!aaNames.containsKey(aaType))
1009 String[] ids = aaNames.get(aaType).split(" ");
1014 * Convert the amino acid type to its SMILES string
1017 * the residue type to convert
1018 * @return the SMILES representation of the residue
1020 public static String toSMILES(String aaType)
1022 if (!aaNames.containsKey(aaType))
1026 String[] ids = aaNames.get(aaType).split(" ");
1034 public static String getAlignName(ChimeraStructuralObject chimObj)
1036 String name = chimObj.getChimeraModel().toString();
1037 if (chimObj instanceof ChimeraChain)
1039 name = ((ChimeraChain) chimObj).toString() + " [" + name + "]";