예제 #1
0
        public static Monomer[] getNucleicMonomers(Group[] groups, int firstGroupIndex)
        {
            NucleicMonomer previous = null;
            int            count    = 0;

            for (int i = firstGroupIndex; i < groups.Length; ++i, ++count)
            {
                Group group = groups[i];
                if (!(group is NucleicMonomer))
                {
                    break;
                }
                NucleicMonomer current = (NucleicMonomer)group;
                if (current.polymer != null)
                {
                    break;
                }
                if (!current.isConnectedAfter(previous))
                {
                    break;
                }
                previous = current;
            }
            if (count == 0)
            {
                return(null);
            }
            Monomer[] monomers = new Monomer[count];
            for (int j = 0; j < count; ++j)
            {
                monomers[j] = (NucleicMonomer)groups[firstGroupIndex + j];
            }
            return(monomers);
        }
예제 #2
0
        public static new Monomer validateAndAllocate(Chain chain, string group3, int seqcode, int firstAtomIndex, int lastAtomIndex, int[] specialAtomIndexes, Atom[] atoms)
        {
            sbyte[] offsets = scanForOffsets(firstAtomIndex, specialAtomIndexes, interestingNucleicAtomIDs);

            if (offsets == null)
            {
                return(null);
            }
            NucleicMonomer nucleicMonomer = new NucleicMonomer(chain, group3, seqcode, firstAtomIndex, lastAtomIndex, offsets);

            return(nucleicMonomer);
        }
예제 #3
0
 public virtual void lookForHbonds(NucleicPolymer other, BitArray bsA, BitArray bsB)
 {
     //System.out.println("NucleicPolymer.lookForHbonds()");
     for (int i = monomerCount; --i >= 0;)
     {
         NucleicMonomer myNucleotide = (NucleicMonomer)monomers[i];
         if (!myNucleotide.Purine)
         {
             continue;
         }
         Atom           myN1           = myNucleotide.N1;
         Atom           bestN3         = null;
         float          minDist2       = 5 * 5;
         NucleicMonomer bestNucleotide = null;
         for (int j = other.monomerCount; --j >= 0;)
         {
             NucleicMonomer otherNucleotide = (NucleicMonomer)other.monomers[j];
             if (!otherNucleotide.Pyrimidine)
             {
                 continue;
             }
             Atom  otherN3 = otherNucleotide.N3;
             float dist2   = myN1.point3f.distanceSquared(otherN3.point3f);
             if (dist2 < minDist2)
             {
                 bestNucleotide = otherNucleotide;
                 bestN3         = otherN3;
                 minDist2       = dist2;
             }
         }
         if (bestN3 != null)
         {
             createHydrogenBond(myN1, bestN3, bsA, bsB);
             if (myNucleotide.Guanine)
             {
                 createHydrogenBond(myNucleotide.N2, bestNucleotide.O2, bsA, bsB);
                 createHydrogenBond(myNucleotide.O6, bestNucleotide.N4, bsA, bsB);
             }
             else
             {
                 createHydrogenBond(myNucleotide.N6, bestNucleotide.O4, bsA, bsB);
             }
         }
     }
 }
예제 #4
0
        ////////////////////////////////////////////////////////////////

        public override bool isConnectedAfter(Monomer possiblyPreviousMonomer)
        {
            if (possiblyPreviousMonomer == null)
            {
                return(true);
            }
            Atom myPhosphorusAtom = PhosphorusAtom;

            if (myPhosphorusAtom == null)
            {
                return(false);
            }
            if (!(possiblyPreviousMonomer is NucleicMonomer))
            {
                return(false);
            }
            NucleicMonomer other = (NucleicMonomer)possiblyPreviousMonomer;

            return(other.O3PrimeAtom.isBonded(myPhosphorusAtom));
        }
예제 #5
0
        private void distinguishAndPropogateGroup(int groupIndex, Chain chain, string group3,
                                                  int seqcode, int firstAtomIndex, int maxAtomIndex)
        {
            //    System.out.println("distinguish & propogate group:" +
            //                       " group3:" + group3 +
            //                       " seqcode:" + Group.getSeqcodeString(seqcode) +
            //                       " firstAtomIndex:" + firstAtomIndex +
            //                       " maxAtomIndex:" + maxAtomIndex);
            int distinguishingBits = 0;

            // clear previous specialAtomIndexes
            for (int i = JmolConstants.ATOMID_MAX; --i >= 0;)
            {
                specialAtomIndexes[i] = Int32.MinValue;
            }

            if (specialAtomIDs != null)
            {
                for (int i = maxAtomIndex; --i >= firstAtomIndex;)
                {
                    int specialAtomID = specialAtomIDs[i];
                    if (specialAtomID > 0)
                    {
                        if (specialAtomID < JmolConstants.ATOMID_DISTINGUISHING_ATOM_MAX)
                        {
                            distinguishingBits |= 1 << specialAtomID;
                        }
                        specialAtomIndexes[specialAtomID] = i;
                    }
                }
            }

            int lastAtomIndex = maxAtomIndex - 1;

            if (lastAtomIndex < firstAtomIndex)
            {
                throw new System.NullReferenceException();
            }

            Group group = null;

            //    System.out.println("distinguishingBits=" + distinguishingBits);
            if ((distinguishingBits & JmolConstants.ATOMID_PROTEIN_MASK) == JmolConstants.ATOMID_PROTEIN_MASK)
            {
                //      System.out.println("may be an AminoMonomer");
                group = AminoMonomer.validateAndAllocate(chain, group3, seqcode, firstAtomIndex, lastAtomIndex, specialAtomIndexes, atoms);
            }
            else if (distinguishingBits == JmolConstants.ATOMID_ALPHA_ONLY_MASK)
            {
                //      System.out.println("AlphaMonomer.validateAndAllocate");
                group = AlphaMonomer.validateAndAllocate(chain, group3, seqcode, firstAtomIndex, lastAtomIndex, specialAtomIndexes, atoms);
            }
            else if (((distinguishingBits & JmolConstants.ATOMID_NUCLEIC_MASK) == JmolConstants.ATOMID_NUCLEIC_MASK))
            {
                group = NucleicMonomer.validateAndAllocate(chain, group3, seqcode, firstAtomIndex, lastAtomIndex, specialAtomIndexes, atoms);
            }
            else if (distinguishingBits == JmolConstants.ATOMID_PHOSPHORUS_ONLY_MASK)
            {
                // System.out.println("PhosphorusMonomer.validateAndAllocate");
                group = PhosphorusMonomer.validateAndAllocate(chain, group3, seqcode, firstAtomIndex, lastAtomIndex, specialAtomIndexes, atoms);
            }
            if (group == null)
            {
                group = new Group(chain, group3, seqcode, firstAtomIndex, lastAtomIndex);
            }

            chain.addGroup(group);
            groups[groupIndex] = group;

            ////////////////////////////////////////////////////////////////
            for (int i = maxAtomIndex; --i >= firstAtomIndex;)
            {
                atoms[i].Group = group;
            }
        }
예제 #6
0
        public static new Monomer validateAndAllocate(Chain chain, string group3, int seqcode, int firstAtomIndex, int lastAtomIndex, int[] specialAtomIndexes, Atom[] atoms)
		{
			sbyte[] offsets = scanForOffsets(firstAtomIndex, specialAtomIndexes, interestingNucleicAtomIDs);
			
			if (offsets == null)
				return null;
			NucleicMonomer nucleicMonomer = new NucleicMonomer(chain, group3, seqcode, firstAtomIndex, lastAtomIndex, offsets);
			return nucleicMonomer;
		}