- }\r
-\r
- public void makeBond(myAtom at1, myAtom at2) {\r
- float[] start = new float[3];\r
- float[] end = new float[3];\r
-\r
- start[0] = at1.x;\r
- start[1] = at1.y;\r
- start[2] = at1.z;\r
-\r
- end[0] = at2.x;\r
- end[1] = at2.y;\r
- end[2] = at2.z;\r
-\r
- bonds.addElement(new Bond(start, end, at1,at2));\r
- }\r
-\r
- public void makeResidueList() {\r
- int count = 0;\r
- String seq = "";\r
- for (int i = 0; i < atoms.size(); i++) {\r
-\r
- myAtom tmp = (myAtom)atoms.elementAt(i);\r
- String resName = tmp.resName;\r
- int resNumber = tmp.resNumber;\r
- int res = resNumber;\r
-\r
- if (i ==0) {\r
- offset = resNumber;\r
- }\r
- Vector resAtoms = new Vector();\r
-\r
- resAtoms.addElement((myAtom)atoms.elementAt(i));\r
- i++;\r
- resNumber = ((myAtom)atoms.elementAt(i)).resNumber;\r
-\r
- //Add atoms to a vector while the residue number\r
- //remains the same\r
- while ((resNumber == res) && (i < atoms.size())) {\r
-\r
- resAtoms.addElement((myAtom)atoms.elementAt(i));\r
- i++;\r
- if (i < atoms.size()) {\r
- resNumber = ((myAtom)atoms.elementAt(i)).resNumber;\r
- } else {\r
- resNumber++;\r
- }\r
- }\r
-\r
- //We need this to keep in step with the outer for i = loop\r
- i--;\r
-\r
- //Make a new Residue object with the new atoms vector\r
- residues.addElement(new Residue(resAtoms, resNumber - 1,count));\r
- count++;\r
- Residue tmpres = (Residue)residues.lastElement();\r
- myAtom tmpat = (myAtom)tmpres.atoms.elementAt(0);\r
-\r
- // Keep totting up the sequence\r
- if (ResidueProperties.getAA3Hash().get(tmpat.resName) == null) {\r
- System.err.println("PDBReader:Null aa3Hash for " + tmpat.resName);\r
- } else {\r
- String tmpres2 =\r
- ResidueProperties.aa[((Integer)ResidueProperties.getAA3Hash().get(tmpat.resName)).intValue()];\r
- seq = seq + tmpres2;\r
- }\r
- // System.out.println(tmpat.resName + " " + tmpres2);\r
- }\r
- sequence = new Sequence("PDB_seq",seq,1,seq.length());\r
- System.out.println("PDB Sequence is :\nSequence = " + seq);\r
- System.out.println("No of residues = " +residues.size());\r
- }\r
-\r
- public void setChargeColours() {\r
- for (int i = 0; i < bonds.size(); i++) {\r
- try {\r
- Bond b = (Bond)bonds.elementAt(i);\r
-\r
- if (b.at1.resName.toUpperCase().equals("ASP") || b.at1.resName.toUpperCase().equals("GLU")) {\r
- b.startCol = Color.red;\r
- } else if (b.at1.resName.toUpperCase().equals("LYS") || b.at1.resName.toUpperCase().equals("ARG")) {\r
- b.startCol = Color.blue;\r
- } else if (b.at1.resName.toUpperCase().equals("CYS")) {\r
- b.startCol = Color.yellow;\r
- } else {\r
- int atno = ((Integer)ResidueProperties.getAA3Hash().get(b.at1.resName.toUpperCase())).intValue();\r
- b.startCol = Color.lightGray;\r
- }\r
- if (b.at2.resName.toUpperCase().equals("ASP") || b.at2.resName.toUpperCase().equals("GLU")) {\r
- b.endCol = Color.red;\r
- } else if (b.at2.resName.toUpperCase().equals("LYS") || b.at2.resName.toUpperCase().equals("ARG")) {\r
- b.endCol = Color.blue;\r
- } else if (b.at2.resName.toUpperCase().equals("CYS")) {\r
- b.endCol = Color.yellow;\r
- } else {\r
- int atno = ((Integer)ResidueProperties.getAA3Hash().get(b.at2.resName.toUpperCase())).intValue();\r
- b.endCol = Color.lightGray;\r
- }\r
- } catch (Exception e) {\r
- Bond b = (Bond)bonds.elementAt(i);\r
- b.startCol = Color.gray;\r
- b.endCol = Color.gray;\r
- }\r
- }\r
- }\r