private void formNucleotideBonds() { for (int modelInd=0; modelInd<structure.nrModels(); modelInd++){ for (Chain chain : structure.getChains(modelInd)) { List<Group> groups = chain.getSeqResGroups(); for (int i = 0; i < groups.size() - 1; i++) { if (!(groups.get(i) instanceof NucleotideImpl) || !(groups.get(i + 1) instanceof NucleotideImpl)) continue; NucleotideImpl tail = (NucleotideImpl) groups.get(i); NucleotideImpl head = (NucleotideImpl) groups.get(i + 1); // atoms with no residue number don't have atom information if (tail.getResidueNumber() == null || head.getResidueNumber() == null) { continue; } Atom phosphorous = head.getP(); Atom oThreePrime = tail.getO3Prime(); if (phosphorous == null || oThreePrime == null) { continue; } if (Calc.getDistance(phosphorous, oThreePrime) < MAX_NUCLEOTIDE_BOND_LENGTH) { new BondImpl(phosphorous, oThreePrime, 1); } } } } }
@Override public Object clone() { NucleotideImpl n = new NucleotideImpl(); n.setPDBFlag(has3D()); n.setResidueNumber(getResidueNumber()); n.setPDBName(getPDBName()); //clone atoms and bonds. cloneAtomsAndBonds(n); // copying the alt loc groups if present, otherwise they stay null if (getAltLocs()!=null && !getAltLocs().isEmpty()) { for (Group altLocGroup:this.getAltLocs()) { Group nAltLocGroup = (Group)altLocGroup.clone(); n.addAltLoc(nAltLocGroup); } } if (chemComp!=null) n.setChemComp(chemComp); return n; } }