- }
-
- public void setChargeColours() {
- for (int i = 0; i < bonds.size(); i++) {
- try {
- Bond b = (Bond) bonds.elementAt(i);
-
- if (b.at1.resName.equalsIgnoreCase("ASP") ||
- b.at1.resName.equalsIgnoreCase("GLU")) {
- b.startCol = Color.red;
- } else if (b.at1.resName.equalsIgnoreCase("LYS") ||
- b.at1.resName.equalsIgnoreCase("ARG")) {
- b.startCol = Color.blue;
- } else if (b.at1.resName.equalsIgnoreCase("CYS")) {
- b.startCol = Color.yellow;
- } else {
- //int atno = ((Integer) ResidueProperties.getAA3Hash().get(b.at1.resName.toUpperCase())).intValue();
- b.startCol = Color.lightGray;
- }
-
- if (b.at2.resName.equalsIgnoreCase("ASP") ||
- b.at2.resName.equalsIgnoreCase("GLU")) {
- b.endCol = Color.red;
- } else if (b.at2.resName.equalsIgnoreCase("LYS") ||
- b.at2.resName.equalsIgnoreCase("ARG")) {
- b.endCol = Color.blue;
- } else if (b.at2.resName.equalsIgnoreCase("CYS")) {
- b.endCol = Color.yellow;
- } else {
- //int atno = ((Integer) ResidueProperties.getAA3Hash().get(b.at2.resName.toUpperCase())).intValue();
- b.endCol = Color.lightGray;
- }
- } catch (Exception e) {
- Bond b = (Bond) bonds.elementAt(i);
- b.startCol = Color.gray;
- b.endCol = Color.gray;
- }
+ }
+
+ // We need this to keep in step with the outer for i = loop
+ i--;
+
+ // Add inserted residues as features to the base residue
+ Atom currAtom = resAtoms.get(0);
+ if (currAtom.insCode != ' '
+ && !residues.isEmpty()
+ && residues.lastElement().atoms.get(0).resNumber == currAtom.resNumber)
+ {
+ SequenceFeature sf = new SequenceFeature("INSERTION",
+ currAtom.resName + ":" + currAtom.resNumIns + " " + pdbid
+ + id, "", offset + count - 1, offset + count - 1,
+ "PDB_INS");
+ resFeatures.addElement(sf);
+ residues.lastElement().atoms.addAll(resAtoms);
+ }
+ else
+ {
+
+ // Make a new Residue object with the new atoms vector
+ residues.addElement(new Residue(resAtoms, resNumber - 1, count));
+
+ Residue tmpres = residues.lastElement();
+ Atom tmpat = tmpres.atoms.get(0);
+ // Make A new SequenceFeature for the current residue numbering
+ SequenceFeature sf = new SequenceFeature(RESNUM_FEATURE, tmpat.resName
+ + ":" + tmpat.resNumIns + " " + pdbid + id, "", offset
+ + count, offset + count, pdbid);
+ resFeatures.addElement(sf);
+ resAnnotation.addElement(new Annotation(tmpat.tfactor));
+ // Keep totting up the sequence
+
+ if ((symbol = ResidueProperties.getAA3Hash().get(tmpat.resName)) == null)
+ {
+ String nucname = tmpat.resName.trim();
+ // use the aaIndex rather than call 'toLower' - which would take a bit
+ // more time.
+ deoxyn = nucname.length() == 2
+ && ResidueProperties.aaIndex[nucname.charAt(0)] == ResidueProperties.aaIndex['D'];
+ if (tmpat.name.equalsIgnoreCase("CA")
+ || ResidueProperties.nucleotideIndex[nucname
+ .charAt((deoxyn ? 1 : 0))] == -1)
+ {
+ char r = ResidueProperties
+ .getSingleCharacterCode(ResidueProperties
+ .getCanonicalAminoAcid(tmpat.resName));
+ seq.append(r == '0' ? 'X' : r);
+ // System.err.println("PDBReader:Null aa3Hash for " +
+ // tmpat.resName);
+ }
+ else
+ {
+ // nucleotide flag
+ nucleotide = true;
+ seq.append(nucname.charAt((deoxyn ? 1 : 0)));
+ }