From: Miguel <mic...@us...> - 2004-05-18 09:22:42
|
Update of /cvsroot/jmol/Jmol/src/org/openscience/jmol/viewer/datamodel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11575/src/org/openscience/jmol/viewer/datamodel Modified Files: Group.java NucleotidePolymer.java Log Message: more debugging of nucleotide chain hbonds Index: Group.java =================================================================== RCS file: /cvsroot/jmol/Jmol/src/org/openscience/jmol/viewer/datamodel/Group.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- Group.java 18 May 2004 07:54:07 -0000 1.10 +++ Group.java 18 May 2004 09:22:22 -0000 1.11 @@ -362,9 +362,6 @@ nucleotideIndices[atomid - JmolConstants.ATOMID_NUCLEOTIDE_MIN] = atomIndex; - if (atomid == JmolConstants.ATOMID_N1) { - System.out.println("register " + this + " N1=" + atomIndex); - } } ++nucleicCount; } @@ -394,6 +391,21 @@ nucleicCount > 5); } + Atom getNucleotideAtomID(int atomid) { + if (atomid < JmolConstants.ATOMID_NUCLEOTIDE_MIN || + atomid >= JmolConstants.ATOMID_NUCLEOTIDE_MAX) { + System.out.println("getNucleotideAtomID out of bounds"); + return null; + } + int index = atomid - JmolConstants.ATOMID_NUCLEOTIDE_MIN; + Atom atom = getAtomIndex(nucleotideIndices[index]); + if (atom == null) + System.out.println("getNucleotideAtomID(" + atomid + ") -> null ?" + + " nucleotideIndices[" + index + "]=" + + nucleotideIndices[index]); + return atom; + } + Atom getAtomIndex(int atomIndex) { return (atomIndex < 0 ? null @@ -402,17 +414,14 @@ Atom getPurineN1() { Atom n1 = ((groupID >= 23 && groupID <= 28) - ? getAtomIndex(JmolConstants.ATOMID_N1 - - JmolConstants.ATOMID_NUCLEOTIDE_MIN) + ? getNucleotideAtomID(JmolConstants.ATOMID_N1) : null); - System.out.println("getPurineN1(" + this + ") -> " + n1); return n1; } Atom getPyrimidineN3() { return ((groupID >= 29 && groupID <= 34) - ? getAtomIndex(JmolConstants.ATOMID_N3 - - JmolConstants.ATOMID_NUCLEOTIDE_MIN) + ? getNucleotideAtomID(JmolConstants.ATOMID_N3) : null); } @@ -424,10 +433,16 @@ groupID >= 54 && groupID <= 56); } - Atom getAtomID(int specialAtomID) { - if (specialAtomID >= JmolConstants.ATOMID_NUCLEOTIDE_MIN && - specialAtomID < JmolConstants.ATOMID_NUCLEOTIDE_MAX) - return getAtomIndex(specialAtomID - JmolConstants.ATOMID_NUCLEOTIDE_MIN); - return null; + void dumpNucleotideIndices() { + System.out.println("dumpNucleotideIndices(" + this + "," + groupID + ")"); + if (nucleotideIndices == null) { + System.out.println(" nucleotideIndices=null"); + } else { + System.out.println(" "); + for (int i = 0; i < nucleotideIndices.length; ++i) + System.out.print(nucleotideIndices[i] + " "); + System.out.println("\n"); + } } + } Index: NucleotidePolymer.java =================================================================== RCS file: /cvsroot/jmol/Jmol/src/org/openscience/jmol/viewer/datamodel/NucleotidePolymer.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- NucleotidePolymer.java 18 May 2004 07:54:07 -0000 1.6 +++ NucleotidePolymer.java 18 May 2004 09:22:22 -0000 1.7 @@ -108,9 +108,10 @@ void lookForHbonds(NucleotidePolymer other) { for (int i = count; --i >= 0; ) { Group myNucleotide = groups[i]; + myNucleotide.dumpNucleotideIndices(); Atom myN1 = myNucleotide.getPurineN1(); if (myN1 != null) { - System.out.println("lookForHbonds myN1=" + myN1.atomIndex + " " + myN1); + // System.out.println("lookForHbonds myN1=" + myN1.atomIndex + " " + myN1); Atom bestN3 = null; float minDist2 = 5*5; Group otherNucleotide = null; @@ -127,20 +128,23 @@ } if (bestN3 != null) { if (myNucleotide.isGuanine()) { - Atom myN2 = myNucleotide.getAtomID(JmolConstants.ATOMID_N2); + Atom myN2 = + myNucleotide.getNucleotideAtomID(JmolConstants.ATOMID_N2); Atom otherO2 = - otherNucleotide.getAtomID(JmolConstants.ATOMID_O2); + otherNucleotide.getNucleotideAtomID(JmolConstants.ATOMID_O2); if (myN2 != null && otherO2 != null) createHydrogenBond(myN2, otherO2); - Atom myO6 = myNucleotide.getAtomID(JmolConstants.ATOMID_O6); + Atom myO6 = + myNucleotide.getNucleotideAtomID(JmolConstants.ATOMID_O6); Atom otherN4 = - otherNucleotide.getAtomID(JmolConstants.ATOMID_N4); + otherNucleotide.getNucleotideAtomID(JmolConstants.ATOMID_N4); if (myO6 != null && otherN4 != null) createHydrogenBond(myN2, otherO2); } else { - Atom myN6 = myNucleotide.getAtomID(JmolConstants.ATOMID_N6); + Atom myN6 = + myNucleotide.getNucleotideAtomID(JmolConstants.ATOMID_N6); Atom otherO4 = - otherNucleotide.getAtomID(JmolConstants.ATOMID_O4); + otherNucleotide.getNucleotideAtomID(JmolConstants.ATOMID_O4); if (myN6 != null && otherO4 != null) createHydrogenBond(myN6, otherO4); } |