From: <ha...@us...> - 2007-05-20 16:51:47
|
Revision: 7766 http://svn.sourceforge.net/jmol/?rev=7766&view=rev Author: hansonr Date: 2007-05-20 09:51:42 -0700 (Sun, 20 May 2007) Log Message: ----------- working Modified Paths: -------------- trunk/Jmol/src/org/jmol/shapebio/AlphaPolymer.java trunk/Jmol/src/org/jmol/shapebio/AminoPolymer.java trunk/Jmol/src/org/jmol/shapebio/BioPolymer.java trunk/Jmol/src/org/jmol/shapebio/Helix.java trunk/Jmol/src/org/jmol/shapebio/ProteinStructure.java trunk/Jmol/src/org/jmol/shapebio/Turn.java Added Paths: ----------- trunk/Jmol/src/org/jmol/shapebio/AlphaMonomer.java Removed Paths: ------------- trunk/Jmol/src/org/jmol/shapebio/AlphaMonomer.java Deleted: trunk/Jmol/src/org/jmol/shapebio/AlphaMonomer.java =================================================================== --- trunk/Jmol/src/org/jmol/shapebio/AlphaMonomer.java 2007-05-20 12:26:31 UTC (rev 7765) +++ trunk/Jmol/src/org/jmol/shapebio/AlphaMonomer.java 2007-05-20 16:51:42 UTC (rev 7766) @@ -1,142 +0,0 @@ -/* $RCSfile$ - * $Author: hansonr $ - * $Date: 2007-02-15 11:45:59 -0600 (Thu, 15 Feb 2007) $ - * $Revision: 6834 $ - * - * Copyright (C) 2003-2005 Miguel, Jmol Development, www.jmol.org - * - * Contact: mi...@jm... - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - */ -package org.jmol.shapebio; - -import javax.vecmath.Point3f; - -import org.jmol.modelset.Atom; -import org.jmol.modelset.Chain; -import org.jmol.viewer.JmolConstants; - -public class AlphaMonomer extends Monomer { - - final static byte[] alphaOffsets = { 0 }; - - static Monomer - validateAndAllocate(Chain chain, String group3, int seqcode, - int firstIndex, int lastIndex, - int[] specialAtomIndexes, Atom[] atoms) { - if (firstIndex != lastIndex || - specialAtomIndexes[JmolConstants.ATOMID_ALPHA_CARBON] != firstIndex) - return null; - return new AlphaMonomer(chain, group3, seqcode, - firstIndex, lastIndex, alphaOffsets); - } - - //////////////////////////////////////////////////////////////// - - AlphaMonomer(Chain chain, String group3, int seqcode, - int firstAtomIndex, int lastAtomIndex, - byte[] offsets) { - super(chain, group3, seqcode, - firstAtomIndex, lastAtomIndex, offsets); - } - - boolean isAlphaMonomer() { return true; } - - private ProteinStructure proteinStructure; - - ProteinStructure getProteinStructure() { return proteinStructure; } - - void setStructure(ProteinStructure proteinStructure) { - this.proteinStructure = proteinStructure; - } - - public byte getProteinStructureType() { - return proteinStructure == null ? JmolConstants.PROTEIN_STRUCTURE_NONE - : proteinStructure.type; - } - - public int getProteinStructureID() { - return proteinStructure != null ? proteinStructure.uniqueID : -1; - } - - public boolean isHelix() { - return proteinStructure != null && - proteinStructure.type == JmolConstants.PROTEIN_STRUCTURE_HELIX; - } - - public boolean isSheet() { - return proteinStructure != null && - proteinStructure.type == JmolConstants.PROTEIN_STRUCTURE_SHEET; - } - - /** - * - * @param iType - * @param monomerIndexCurrent a pointer to the current ProteinStructure - * @return a pointer to this ProteinStructure - */ - public int setProteinStructureType(byte iType, int monomerIndexCurrent) { - if (monomerIndexCurrent < 0) { - if (proteinStructure != null) { - int nAbandoned = proteinStructure.removeMonomer(monomerIndex); - if (nAbandoned > 0) - getBioPolymer().removeProteinStructure(monomerIndex + 1, nAbandoned); - } - switch (iType) { - case JmolConstants.PROTEIN_STRUCTURE_HELIX: - setStructure(new Helix((AlphaPolymer) bioPolymer, monomerIndex, 1)); - break; - case JmolConstants.PROTEIN_STRUCTURE_SHEET: - setStructure(new Sheet((AminoPolymer) bioPolymer, monomerIndex, 1)); - break; - case JmolConstants.PROTEIN_STRUCTURE_TURN: - setStructure(new Turn((AlphaPolymer) bioPolymer, monomerIndex, 1)); - break; - case JmolConstants.PROTEIN_STRUCTURE_NONE: - setStructure(null); - } - } else { - setStructure(getBioPolymer().getProteinStructure(monomerIndexCurrent)); - if (proteinStructure != null) - proteinStructure.addMonomer(monomerIndex); - } - return monomerIndex; - } - - final public Atom getAtom(byte specialAtomID) { - return (specialAtomID == JmolConstants.ATOMID_ALPHA_CARBON - ? getLeadAtom() - : null); - } - - final public Point3f getAtomPoint(byte specialAtomID) { - return (specialAtomID == JmolConstants.ATOMID_ALPHA_CARBON - ? getLeadAtomPoint() - : null); - } - - boolean isConnectedAfter(Monomer possiblyPreviousMonomer) { - if (possiblyPreviousMonomer == null) - return true; - if (! (possiblyPreviousMonomer instanceof AlphaMonomer)) - return false; - float distance = - getLeadAtomPoint().distance(possiblyPreviousMonomer.getLeadAtomPoint()); - // jan reichert in email to miguel on 10 May 2004 said 4.2 looked good - return distance <= 4.2f; - } - -} Added: trunk/Jmol/src/org/jmol/shapebio/AlphaMonomer.java =================================================================== --- trunk/Jmol/src/org/jmol/shapebio/AlphaMonomer.java (rev 0) +++ trunk/Jmol/src/org/jmol/shapebio/AlphaMonomer.java 2007-05-20 16:51:42 UTC (rev 7766) @@ -0,0 +1,142 @@ +/* $RCSfile$ + * $Author: hansonr $ + * $Date: 2007-02-15 11:45:59 -0600 (Thu, 15 Feb 2007) $ + * $Revision: 6834 $ + * + * Copyright (C) 2003-2005 Miguel, Jmol Development, www.jmol.org + * + * Contact: mi...@jm... + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.jmol.shapebio; + +import javax.vecmath.Point3f; + +import org.jmol.modelset.Atom; +import org.jmol.modelset.Chain; +import org.jmol.viewer.JmolConstants; + +public class AlphaMonomer extends Monomer { + + final static byte[] alphaOffsets = { 0 }; + + static Monomer + validateAndAllocate(Chain chain, String group3, int seqcode, + int firstIndex, int lastIndex, + int[] specialAtomIndexes, Atom[] atoms) { + if (firstIndex != lastIndex || + specialAtomIndexes[JmolConstants.ATOMID_ALPHA_CARBON] != firstIndex) + return null; + return new AlphaMonomer(chain, group3, seqcode, + firstIndex, lastIndex, alphaOffsets); + } + + //////////////////////////////////////////////////////////////// + + AlphaMonomer(Chain chain, String group3, int seqcode, + int firstAtomIndex, int lastAtomIndex, + byte[] offsets) { + super(chain, group3, seqcode, + firstAtomIndex, lastAtomIndex, offsets); + } + + boolean isAlphaMonomer() { return true; } + + private ProteinStructure proteinStructure; + + ProteinStructure getProteinStructure() { return proteinStructure; } + + void setStructure(ProteinStructure proteinStructure) { + this.proteinStructure = proteinStructure; + } + + public byte getProteinStructureType() { + return proteinStructure == null ? JmolConstants.PROTEIN_STRUCTURE_NONE + : proteinStructure.type; + } + + public int getProteinStructureID() { + return proteinStructure != null ? proteinStructure.uniqueID : -1; + } + + public boolean isHelix() { + return proteinStructure != null && + proteinStructure.type == JmolConstants.PROTEIN_STRUCTURE_HELIX; + } + + public boolean isSheet() { + return proteinStructure != null && + proteinStructure.type == JmolConstants.PROTEIN_STRUCTURE_SHEET; + } + + /** + * + * @param iType + * @param monomerIndexCurrent a pointer to the current ProteinStructure + * @return a pointer to this ProteinStructure + */ + public int setProteinStructureType(byte iType, int monomerIndexCurrent) { + if (monomerIndexCurrent < 0) { + if (proteinStructure != null) { + int nAbandoned = proteinStructure.removeMonomer(monomerIndex); + if (nAbandoned > 0) + getBioPolymer().removeProteinStructure(monomerIndex + 1, nAbandoned); + } + switch (iType) { + case JmolConstants.PROTEIN_STRUCTURE_HELIX: + setStructure(new Helix((AlphaPolymer) bioPolymer, monomerIndex, 1)); + break; + case JmolConstants.PROTEIN_STRUCTURE_SHEET: + setStructure(new Sheet((AminoPolymer) bioPolymer, monomerIndex, 1)); + break; + case JmolConstants.PROTEIN_STRUCTURE_TURN: + setStructure(new Turn((AlphaPolymer) bioPolymer, monomerIndex, 1)); + break; + case JmolConstants.PROTEIN_STRUCTURE_NONE: + setStructure(null); + } + } else { + setStructure(getBioPolymer().getProteinStructure(monomerIndexCurrent)); + if (proteinStructure != null) + proteinStructure.addMonomer(monomerIndex); + } + return monomerIndex; + } + + final public Atom getAtom(byte specialAtomID) { + return (specialAtomID == JmolConstants.ATOMID_ALPHA_CARBON + ? getLeadAtom() + : null); + } + + final public Point3f getAtomPoint(byte specialAtomID) { + return (specialAtomID == JmolConstants.ATOMID_ALPHA_CARBON + ? getLeadAtomPoint() + : null); + } + + boolean isConnectedAfter(Monomer possiblyPreviousMonomer) { + if (possiblyPreviousMonomer == null) + return true; + if (! (possiblyPreviousMonomer instanceof AlphaMonomer)) + return false; + float distance = + getLeadAtomPoint().distance(possiblyPreviousMonomer.getLeadAtomPoint()); + // jan reichert in email to miguel on 10 May 2004 said 4.2 looked good + return distance <= 4.2f; + } + +} Modified: trunk/Jmol/src/org/jmol/shapebio/AlphaPolymer.java =================================================================== --- trunk/Jmol/src/org/jmol/shapebio/AlphaPolymer.java 2007-05-20 12:26:31 UTC (rev 7765) +++ trunk/Jmol/src/org/jmol/shapebio/AlphaPolymer.java 2007-05-20 16:51:42 UTC (rev 7766) @@ -23,6 +23,13 @@ */ package org.jmol.shapebio; +import org.jmol.shapebio.AminoPolymer; +import org.jmol.shapebio.BioPolymer; +import org.jmol.shapebio.Helix; +import org.jmol.shapebio.Monomer; +import org.jmol.shapebio.ProteinStructure; +import org.jmol.shapebio.Sheet; +import org.jmol.shapebio.Turn; import org.jmol.util.Logger; import org.jmol.util.Measure; import org.jmol.viewer.JmolConstants; Modified: trunk/Jmol/src/org/jmol/shapebio/AminoPolymer.java =================================================================== --- trunk/Jmol/src/org/jmol/shapebio/AminoPolymer.java 2007-05-20 12:26:31 UTC (rev 7765) +++ trunk/Jmol/src/org/jmol/shapebio/AminoPolymer.java 2007-05-20 16:51:42 UTC (rev 7766) @@ -24,6 +24,7 @@ package org.jmol.shapebio; import org.jmol.modelset.Atom; +import org.jmol.shapebio.AlphaPolymer; import org.jmol.util.Logger; import org.jmol.util.Measure; import org.jmol.viewer.JmolConstants; Modified: trunk/Jmol/src/org/jmol/shapebio/BioPolymer.java =================================================================== --- trunk/Jmol/src/org/jmol/shapebio/BioPolymer.java 2007-05-20 12:26:31 UTC (rev 7765) +++ trunk/Jmol/src/org/jmol/shapebio/BioPolymer.java 2007-05-20 16:51:42 UTC (rev 7766) @@ -25,6 +25,7 @@ import org.jmol.modelset.Group; import org.jmol.modelset.Polymer; +import org.jmol.shapebio.AlphaPolymer; import org.jmol.shape.Closest; import org.jmol.util.BitSetUtil; import org.jmol.util.Logger; Modified: trunk/Jmol/src/org/jmol/shapebio/Helix.java =================================================================== --- trunk/Jmol/src/org/jmol/shapebio/Helix.java 2007-05-20 12:26:31 UTC (rev 7765) +++ trunk/Jmol/src/org/jmol/shapebio/Helix.java 2007-05-20 16:51:42 UTC (rev 7766) @@ -27,6 +27,7 @@ import javax.vecmath.Vector3f; import org.jmol.g3d.Graphics3D; +import org.jmol.shapebio.AlphaPolymer; import org.jmol.viewer.JmolConstants; class Helix extends ProteinStructure { Modified: trunk/Jmol/src/org/jmol/shapebio/ProteinStructure.java =================================================================== --- trunk/Jmol/src/org/jmol/shapebio/ProteinStructure.java 2007-05-20 12:26:31 UTC (rev 7765) +++ trunk/Jmol/src/org/jmol/shapebio/ProteinStructure.java 2007-05-20 16:51:42 UTC (rev 7766) @@ -26,6 +26,7 @@ import javax.vecmath.Point3f; import javax.vecmath.Vector3f; +import org.jmol.shapebio.AlphaPolymer; import org.jmol.util.Logger; import org.jmol.viewer.JmolConstants; Modified: trunk/Jmol/src/org/jmol/shapebio/Turn.java =================================================================== --- trunk/Jmol/src/org/jmol/shapebio/Turn.java 2007-05-20 12:26:31 UTC (rev 7765) +++ trunk/Jmol/src/org/jmol/shapebio/Turn.java 2007-05-20 16:51:42 UTC (rev 7766) @@ -23,6 +23,7 @@ */ package org.jmol.shapebio; +import org.jmol.shapebio.AlphaPolymer; import org.jmol.viewer.JmolConstants; public class Turn extends ProteinStructure { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |