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;
39 import java.util.Locale;
42 import org.slf4j.Logger;
43 import org.slf4j.LoggerFactory;
45 import ext.edu.ucsf.rbvi.strucviz2.StructureManager.ModelType;
47 public abstract class ChimUtils
50 private static Logger logger = LoggerFactory.getLogger(ChimUtils.class);
52 static int MAX_SUB_MODELS = 1000;
54 public static final HashMap<String, String> aaNames;
56 public static String RESIDUE_ATTR = "ChimeraResidue";
58 public static String RINALYZER_ATTR = "RINalyzerResidue";
60 public static String DEFAULT_STRUCTURE_KEY = "pdbFileName";
63 * Parse the model number returned by Chimera and return the int value
65 // invoked by the ChimeraModel constructor
66 // line = model id #0 type Molecule name 1ert
67 public static int[] parseModelNumber(String inputLine)
69 int hash = inputLine.indexOf('#');
70 int space = inputLine.indexOf(' ', hash);
71 int decimal = inputLine.substring(hash + 1, space).indexOf('.');
72 // model number is between hash+1 and space
74 int subModelNumber = 0;
79 subModelNumber = Integer
80 .parseInt(inputLine.substring(decimal + hash + 2, space));
81 space = decimal + hash + 1;
83 modelNumber = Integer.parseInt(inputLine.substring(hash + 1, space));
86 logger.warn("Unexpected return from Chimera: " + inputLine, e);
88 return new int[] { modelNumber, subModelNumber };
92 * Parse the model number returned by Chimera and return the int value
94 // invoked by openModel in ChimeraManager
95 // line: #1, chain A: hiv-1 protease
96 // line: Model 0 (filename)
97 public static int[] parseOpenedModelNumber(String inputLine)
99 int hash = inputLine.indexOf('#');
103 hash = inputLine.indexOf("Model");
108 space = inputLine.indexOf(' ', hash + 1);
112 space = inputLine.indexOf(',', hash);
115 int decimal = inputLine.substring(hash + 1, space).indexOf('.');
116 // model number is between hash+1 and space
117 int modelNumber = -1;
118 int subModelNumber = 0;
123 subModelNumber = Integer
124 .parseInt(inputLine.substring(decimal + hash + 2, space));
125 space = decimal + hash + 1;
127 modelNumber = Integer.parseInt(inputLine.substring(hash + 1, space));
128 } catch (Exception e)
130 logger.warn("Unexpected return from Chimera: " + inputLine, e);
132 return new int[] { modelNumber, subModelNumber };
136 * Parse the model identifier returned by Chimera and return the String value
138 // invoked by the ChimeraModel constructor
139 // line = model id #0 type Molecule name 1ert
140 public static String parseModelName(String inputLine)
142 int start = inputLine.indexOf("name ");
147 // Might get a quoted string (don't understand why, but there you have it)
148 if (inputLine.startsWith("\"", start + 5))
150 start += 6; // Skip over the first quote
151 int end = inputLine.lastIndexOf('"');
154 return inputLine.substring(start, end);
158 return inputLine.substring(start);
163 return inputLine.substring(start + 5);
167 public static Color parseModelColor(String inputLine)
171 int colorStart = inputLine.indexOf("color ");
172 String colorString = inputLine.substring(colorStart + 6);
173 String[] rgbStrings = colorString.split(",");
174 float[] rgbValues = new float[4];
175 for (int i = 0; i < rgbStrings.length; i++)
177 Float f = Float.valueOf(rgbStrings[i]);
178 rgbValues[i] = f.floatValue();
180 if (rgbStrings.length == 4)
182 return new Color(rgbValues[0], rgbValues[1], rgbValues[2],
187 return new Color(rgbValues[0], rgbValues[1], rgbValues[2]);
189 } catch (Exception ex)
191 logger.warn("Unexpected return from Chimera: " + inputLine, ex);
197 * Create the key to use for forming the model/submodel key into the modelHash
202 * the submodel number
203 * @return the model key as an Integer
205 public static Integer makeModelKey(int model, int subModel)
207 return Integer.valueOf(model * MAX_SUB_MODELS + subModel);
210 // invoked by the getResdiue (parseConnectivityReplies in
211 // CreateStructureNetworkTask)
212 // atomSpec = #0:1.A or #1:96.B@N
213 public static ChimeraModel getModel(String atomSpec,
214 ChimeraManager chimeraManager)
216 // System.out.println("getting model for "+atomSpec);
217 String[] split = atomSpec.split(":");
218 // No model specified....
219 if (split[0].length() == 0)
221 logger.info("Unexpected return from Chimera: " + atomSpec);
224 // System.out.println("model = "+split[0].substring(1));
229 String[] subSplit = split[0].substring(1).split("\\.");
230 if (subSplit.length > 0)
232 model = Integer.parseInt(subSplit[0]);
236 model = Integer.parseInt(split[0].substring(1));
239 if (subSplit.length > 1)
241 submodel = Integer.parseInt(subSplit[1]);
243 } catch (Exception e)
246 logger.warn("Unexpected return from Chimera: " + atomSpec, e);
248 return chimeraManager.getChimeraModel(model, submodel);
251 // invoked by the parseConnectivityReplies in CreateStructureNetworkTask
252 // atomSpec = #0:1.A or #1:96.B@N
253 public static ChimeraResidue getResidue(String atomSpec,
254 ChimeraManager chimeraManager)
256 // System.out.println("Getting residue from: "+atomSpec);
257 ChimeraModel model = getModel(atomSpec, chimeraManager); // Get the model
260 model = chimeraManager.getChimeraModel();
262 return getResidue(atomSpec, model);
265 // invoked by the getResdiue (parseConnectivityReplies in
266 // CreateStructureNetworkTask)
267 // atomSpec = #0:1.A or #1:96.B@N
268 public static ChimeraResidue getResidue(String atomSpec,
271 // System.out.println("Getting residue from: "+atomSpec);
272 String[] split = atomSpec.split(":|@");
274 // Split into residue and chain
275 String[] residueChain = split[1].split("\\.");
277 if (residueChain[0].length() == 0)
279 logger.info("Unexpected return from Chimera: " + atomSpec);
283 if (residueChain.length == 2 && residueChain[1].length() > 0)
285 ChimeraChain chain = model.getChain(residueChain[1]);
286 return chain.getResidue(residueChain[0]);
288 return model.getResidue("_", residueChain[0]);
291 public static ChimeraChain getChain(String atomSpec, ChimeraModel model)
293 String[] split = atomSpec.split(":|@");
295 // Split into residue and chain
296 String[] residueChain = split[1].split("\\.");
297 if (residueChain.length == 1)
299 logger.info("Unexpected return from Chimera: " + atomSpec);
302 return model.getChain(residueChain[1]);
305 public static String getAtomName(String atomSpec)
307 String[] split = atomSpec.split("@");
308 if (split.length > 1)
315 public static boolean isBackbone(String atom)
317 if (atom.equals("C") || atom.equals("CA") || atom.equals("N")
318 || atom.equals("O") || atom.equals("H"))
325 public static String getIntSubtype(String node, String atom)
327 String[] split = node.split("#| ");
329 if (split.length == 2)
331 resType = split[0].trim().toUpperCase(Locale.ROOT);
333 else if (split.length == 3)
335 resType = split[1].trim().toUpperCase(Locale.ROOT);
337 if (resType.equalsIgnoreCase("HOH") || resType.equalsIgnoreCase("WAT"))
341 else if (aaNames.containsKey(resType))
343 if (atom.equals("C") || atom.equals("CA") || atom.equals("N")
344 || atom.equals("O") || atom.equals("H"))
359 public static String[] getResKeyParts(String resKey)
361 // [pdbID[.modelNo]#][residueID][.chainID]
362 // pdbID := 4-character code | "URL" | "path"
363 String[] resKeyParts = new String[4];
364 String[] split = resKey.split("#");
365 String resChain = null;
366 // if no "#" then it is either only a pdb id or a residue or a chain
367 if (split.length == 1)
369 // pdb id without model
370 if (resKey.length() == 4 && resKey.indexOf("\\.") < 0)
372 parseModelID(resKey, resKeyParts);
375 else if (resKey.startsWith("\""))
377 parseModelID(resKey, resKeyParts);
379 // chain and residue or model and number
382 String[] splitSplit = resKey.split("\\.");
383 if (splitSplit.length == 1)
385 // only a chain or a residue
393 Integer.parseInt(splitSplit[1]);
394 parseModelID(resKey, resKeyParts);
395 } catch (NumberFormatException ex)
403 else if (split.length == 2)
405 // model and residue+chain
406 parseModelID(split[0], resKeyParts);
411 // model string with "#"
412 // TODO: [Optional] Are there more possibilities?
413 parseModelID(resKey.substring(0, resKey.lastIndexOf("#")),
415 resChain = resKey.substring(resKey.lastIndexOf("#") + 1,
418 if (resChain != null)
420 // System.out.println(resChain);
421 String[] resChainSplit = resChain.split("\\.");
422 if (resChainSplit.length == 1)
424 // TODO: [Optional] Find a better way to distinguish between chain and
426 // if only one character and not an int, probably a chain
427 if (resChainSplit[0].length() == 1)
431 Integer.parseInt(resChainSplit[0]);
432 resKeyParts[3] = resChainSplit[0];
433 } catch (NumberFormatException ex)
435 resKeyParts[2] = resChainSplit[0];
440 resKeyParts[3] = resChainSplit[0];
443 else if (resChainSplit.length == 2)
445 resKeyParts[2] = resChainSplit[0];
446 resKeyParts[3] = resChainSplit[1];
451 logger.info("Could not parse residue identifier: " + resKey);
454 // String print = "";
455 // for (int i = 0; i < resKeyParts.length; i++) {
456 // if (resKeyParts[i] == null) {
457 // print += i + ": null\t";
459 // print += i + ": " + resKeyParts[i] + ";";
462 // System.out.println(print);
466 public static void parseModelID(String modelID, String[] resKeyParts)
468 if (modelID.startsWith("\""))
470 if (modelID.endsWith("\""))
472 resKeyParts[0] = modelID.substring(1, modelID.length() - 1);
479 Integer.parseInt(modelID.substring(modelID.lastIndexOf("\"") + 2,
481 resKeyParts[0] = modelID.substring(0,
482 modelID.lastIndexOf("\"") - 1);
483 resKeyParts[1] = modelID.substring(modelID.lastIndexOf("\"") + 2,
485 } catch (NumberFormatException ex)
487 resKeyParts[0] = modelID.substring(1);
493 String[] modelIDNo = modelID.split("\\.");
494 if (modelIDNo.length == 1)
496 resKeyParts[0] = modelIDNo[0];
498 else if (modelIDNo.length == 2)
502 Integer.parseInt(modelIDNo[1]);
503 resKeyParts[0] = modelIDNo[0];
504 resKeyParts[1] = modelIDNo[1];
505 } catch (NumberFormatException ex)
507 resKeyParts[0] = modelID;
512 // length > 1, so we probably have a file name with "." in it
513 logger.info("Could not parse model identifier: " + modelID);
514 resKeyParts[0] = modelID;
520 * This method takes a Cytoscape attribute specification
521 * ([structure#][residue][.chainID]) and returns the lowest-level object
522 * referenced by the spec. For example, if the spec is "1tkk", this method
523 * will return a ChimeraModel. If the spec is ".A", it will return a
527 * the specification string
528 * @param chimeraManager
529 * the Chimera object we're currently using
530 * @return a ChimeraStructuralObject of the lowest type
532 public static ChimeraStructuralObject fromAttributeOld(String attrSpec,
533 ChimeraManager chimeraManager)
535 if (attrSpec == null || attrSpec.indexOf(',') > 0
536 || attrSpec.indexOf('-') > 0)
538 // No support for either lists or ranges
539 logger.warn("No support for identifier: " + attrSpec);
543 String residue = null;
547 ChimeraModel chimeraModel = null;
548 ChimeraChain chimeraChain = null;
549 ChimeraResidue chimeraResidue = null;
551 // System.out.println("Getting object from attribute: "+attrSpec);
554 String[] split = attrSpec.split("#");
555 String resChain = null;
556 if (split.length == 1)
561 else if (split.length == 2)
569 // model string with "#"
570 model = attrSpec.substring(0, attrSpec.lastIndexOf("#"));
571 resChain = attrSpec.substring(attrSpec.lastIndexOf("#") + 1,
574 if (resChain != null)
576 String[] resChainSplit = resChain.split("\\.");
577 if (resChainSplit.length == 1)
579 residue = resChainSplit[0];
581 else if (resChainSplit.length == 2)
583 residue = resChainSplit[0];
584 chain = resChainSplit[1];
589 logger.warn("No support for identifier: " + attrSpec);
593 // if (split.length == 1) {
595 // residue = split[0];
596 // } else if (split.length == 3) {
597 // // We have all three
599 // residue = split[1];
601 // } else if (split.length == 2 && attrSpec.indexOf('#') > 0) {
602 // // Model and Residue
604 // residue = split[1];
606 // // Residue and Chain
607 // residue = split[0];
611 // System.out.println("model = " + model + " chain = " + chain +
612 // " residue = " + residue);
615 List<ChimeraModel> models = chimeraManager.getChimeraModels(model,
616 ModelType.PDB_MODEL);
617 if (models.size() == 1)
619 chimeraModel = models.get(0);
625 chimeraModel = chimeraManager
626 .getChimeraModel(Integer.valueOf(model), 0);
627 } catch (NumberFormatException ex)
633 if (chimeraModel == null)
635 chimeraModel = chimeraManager.getChimeraModel();
637 // System.out.println("ChimeraModel = " + chimeraModel);
641 chimeraChain = chimeraModel.getChain(chain);
642 // System.out.println("ChimeraChain = " + chimeraChain);
646 if (chimeraChain != null)
648 chimeraResidue = chimeraChain.getResidue(residue);
652 chimeraResidue = chimeraModel.getResidue("_", residue);
654 // System.out.println("ChimeraResidue = " + chimeraResidue);
657 if (chimeraResidue != null)
659 return chimeraResidue;
662 if (chimeraChain != null)
667 if (chimeraModel != null)
672 } catch (Exception ex)
674 logger.warn("Could not parse residue identifier: " + attrSpec, ex);
679 public static ChimeraStructuralObject fromAttribute(String attrSpec,
680 ChimeraManager chimeraManager)
682 // TODO: Make sure it is OK to remove this: || attrSpec.indexOf('-') > 0
683 if (attrSpec == null || attrSpec.indexOf(',') > 0)
685 // No support for either lists or ranges
686 // System.out.println("No support for identifier: " + attrSpec);
687 logger.warn("No support for identifier: " + attrSpec);
690 String[] modelIDNoResChain = getResKeyParts(attrSpec);
692 ChimeraModel chimeraModel = null;
693 ChimeraChain chimeraChain = null;
694 ChimeraResidue chimeraResidue = null;
696 // System.out.println("Getting object from attribute: "+attrSpec);
699 if (modelIDNoResChain[0] != null)
701 String modelID = modelIDNoResChain[0];
702 List<ChimeraModel> models = chimeraManager.getChimeraModels(modelID,
703 ModelType.PDB_MODEL);
704 if (models.size() == 1)
705 { // usual case with only one model
706 chimeraModel = models.get(0);
708 else if (models.size() > 1 && modelIDNoResChain[1] != null)
710 // there are several submodels
713 int modelNo = Integer.valueOf(modelIDNoResChain[1]);
714 for (ChimeraModel model : models)
716 if (model.getSubModelNumber() == modelNo)
718 chimeraModel = model;
722 } catch (NumberFormatException ex)
729 // TODO: [Optional] What is this doing?
732 chimeraModel = chimeraManager
733 .getChimeraModel(Integer.valueOf(modelID), 0);
734 } catch (NumberFormatException ex)
740 if (chimeraModel == null)
742 // TODO: [Optional] Find a better way to handle this case
743 // If no model can be matched, continue
744 // System.out.println("No matching model could be find for " +
747 // chimeraModel = chimeraManager.getChimeraModel();
748 // logger.warn("No matching model could be find for " + attrSpec +
750 // + chimeraModel.toSpec());
752 // System.out.println("ChimeraModel = " + chimeraModel);
754 if (modelIDNoResChain[3] != null)
756 chimeraChain = chimeraModel.getChain(modelIDNoResChain[3]);
757 // System.out.println("ChimeraChain = " + chimeraChain);
759 if (modelIDNoResChain[2] != null)
761 String residue = modelIDNoResChain[2];
762 if (chimeraChain != null)
764 chimeraResidue = chimeraChain.getResidue(residue);
766 else if (chimeraModel.getChain("_") != null)
768 chimeraResidue = chimeraModel.getResidue("_", residue);
770 else if (chimeraModel.getChainCount() == 1)
772 chimeraResidue = chimeraModel.getResidue(
773 chimeraModel.getChainNames().iterator().next(), residue);
775 // System.out.println("ChimeraResidue = " + chimeraResidue);
778 if (chimeraResidue != null)
780 return chimeraResidue;
783 if (chimeraChain != null)
788 if (chimeraModel != null)
793 } catch (Exception ex)
795 // System.out.println("Could not parse chimera identifier: " +
796 // attrSpec+"("+ex.getMessage()+")");
797 logger.warn("Could not parse chimera identifier: " + attrSpec, ex);
803 * Search for structure references in the residue list
806 * the list of residues
807 * @return a concatenated list of structures encoded in the list
809 public static String findStructures(String residueList)
811 if (residueList == null)
815 String[] residues = residueList.split(",");
816 Map<String, String> structureNameMap = new HashMap<String, String>();
817 for (int i = 0; i < residues.length; i++)
819 String[] components = residues[i].split("#");
820 if (components.length > 1)
822 structureNameMap.put(components[0], components[1]);
825 if (structureNameMap.isEmpty())
830 String structure = null;
831 for (String struct : structureNameMap.keySet())
833 if (structure == null)
835 structure = new String();
839 structure = structure.concat(",");
841 structure = structure.concat(struct);
846 // invoked by openStructures in StructureManager
847 public static List<String> parseFuncRes(List<String> residueNames,
850 List<String> resRanges = new ArrayList<String>();
851 for (int i = 0; i < residueNames.size(); i++)
853 String residue = residueNames.get(i);
854 // Parse out the structure, if there is one
855 String[] components = residue.split("#");
856 if (components.length > 1 && !modelName.equals(components[0]))
860 else if (components.length > 1)
862 residue = components[1];
864 else if (components.length == 1)
866 residue = components[0];
868 // Check to see if we have a range-spec
869 String resRange = "";
870 if (residue == null || residue.equals("") || residue.length() == 0)
874 String[] range = residue.split("-", 2);
876 for (int res = 0; res < range.length; res++)
880 resRange = resRange.concat("-");
881 if (chain != null && range[res].indexOf('.') == -1)
883 range[res] = range[res].concat("." + chain);
887 if (res == 0 && range.length >= 2 && range[res].indexOf('.') > 0)
889 // This is a range spec with the leading residue containing a chain
891 String[] resChain = range[res].split("\\.");
893 range[res] = resChain[0];
895 // Fix weird SFLD syntax...
896 if (range[res].indexOf('|') > 0
897 && Character.isDigit(range[res].charAt(0)))
899 int offset = range[res].indexOf('|');
900 String str = range[res].substring(offset + 1)
901 + range[res].substring(0, offset);
905 // Convert to legal atom-spec
906 if (Character.isDigit(range[res].charAt(0)))
908 resRange = resRange.concat(range[res]);
910 else if (Character.isDigit(range[res].charAt(1)))
912 resRange = resRange.concat(range[res].substring(1));
914 else if (range[res].charAt(0) == '.')
916 // Do we have a chain spec?
917 resRange = resRange.concat(range[res]);
921 resRange = resRange.concat(range[res].substring(3));
924 if (!resRanges.contains(resRange))
926 resRanges.add(resRange);
934 aaNames = new HashMap<String, String>();
935 aaNames.put("ALA", "A Ala Alanine N[C@@H](C)C(O)=O");
936 aaNames.put("ARG", "R Arg Arginine N[C@@H](CCCNC(N)=N)C(O)=O");
937 aaNames.put("ASN", "N Asn Asparagine N[C@@H](CC(N)=O)C(O)=O");
938 aaNames.put("ASP", "D Asp Aspartic_acid N[C@@H](CC(O)=O)C(O)=O");
939 aaNames.put("CYS", "C Cys Cysteine N[C@@H](CS)C(O)=O");
940 aaNames.put("GLN", "Q Gln Glutamine N[C@H](C(O)=O)CCC(N)=O");
941 aaNames.put("GLU", "E Glu Glumatic_acid N[C@H](C(O)=O)CCC(O)=O");
942 aaNames.put("GLY", "G Gly Glycine NCC(O)=O");
943 aaNames.put("HIS", "H His Histidine N[C@@H](CC1=CN=CN1)C(O)=O");
944 aaNames.put("ILE", "I Ile Isoleucine N[C@]([C@H](C)CC)([H])C(O)=O");
945 aaNames.put("LEU", "L Leu Leucine N[C@](CC(C)C)([H])C(O)=O");
946 aaNames.put("LYS", "K Lys Lysine N[C@](CCCCN)([H])C(O)=O");
947 aaNames.put("DLY", "K Dly D-Lysine NCCCC[C@@H](N)C(O)=O");
948 aaNames.put("MET", "M Met Methionine N[C@](CCSC)([H])C(O)=O");
950 "F Phe Phenylalanine N[C@](CC1=CC=CC=C1)([H])C(O)=O");
951 aaNames.put("PRO", "P Pro Proline OC([C@@]1([H])NCCC1)=O");
952 aaNames.put("SER", "S Ser Serine OC[C@](C(O)=O)([H])N");
953 aaNames.put("THR", "T Thr Threonine O[C@H](C)[C@](C(O)=O)([H])N");
955 "W Trp Tryptophan N[C@@]([H])(CC1=CN([H])C2=C1C=CC=C2)C(O)=O");
956 aaNames.put("TYR", "Y Tyr Tyrosine N[C@@](C(O)=O)([H])CC1=CC=C(O)C=C1");
957 aaNames.put("VAL", "V Val Valine N[C@@](C(O)=O)([H])C(C)C");
958 aaNames.put("ASX", "B Asx Aspartic_acid_or_Asparagine");
959 aaNames.put("GLX", "Z Glx Glutamine_or_Glutamic_acid");
960 aaNames.put("XAA", "X Xaa Any_or_unknown_amino_acid");
961 aaNames.put("HOH", "HOH HOH Water [H]O[H]");
965 * Convert the amino acid type to a full name
968 * the residue type to convert
969 * @return the full name of the residue
971 public static String toFullName(String aaType)
973 if (!aaNames.containsKey(aaType))
977 String[] ids = aaNames.get(aaType).split(" ");
978 return ids[2].replace('_', ' ');
982 * Convert the amino acid type to a single letter
985 * the residue type to convert
986 * @return the single letter representation of the residue
988 public static String toSingleLetter(String aaType)
990 if (!aaNames.containsKey(aaType))
994 String[] ids = aaNames.get(aaType).split(" ");
999 * Convert the amino acid type to three letters
1002 * the residue type to convert
1003 * @return the three letter representation of the residue
1005 public static String toThreeLetter(String aaType)
1007 if (!aaNames.containsKey(aaType))
1011 String[] ids = aaNames.get(aaType).split(" ");
1016 * Convert the amino acid type to its SMILES string
1019 * the residue type to convert
1020 * @return the SMILES representation of the residue
1022 public static String toSMILES(String aaType)
1024 if (!aaNames.containsKey(aaType))
1028 String[] ids = aaNames.get(aaType).split(" ");
1036 public static String getAlignName(ChimeraStructuralObject chimObj)
1038 String name = chimObj.getChimeraModel().toString();
1039 if (chimObj instanceof ChimeraChain)
1041 name = ((ChimeraChain) chimObj).toString() + " [" + name + "]";