startIndex = pseudoMol.resIndex(startResFull) endIndex = pseudoMol.resIndex(endResFull) if (startIndex > endIndex): #make sure that the starting atom is before the ending atom #if it isn't, swap them (startResFull, endResFull) = (endResFull, startResFull) (startIndex, endIndex) = (endIndex, startIndex) (startAtom, endAtom) = (startAtom, endAtom) #make sure that the molecule using PDB3 naming (as oppsed to PDB2) #TODO: check all residues for PDB3 naming instead of just the first one in case the molecule uses a mix of PDB2 and PDB3 naming # this seems like an unlikely problem, but it can't hurt to double check if pseudoMol.checkPDB2FromIndex(startIndex): reportPDB2Error(startResFull) return False if (startIndex > 0 and startAtom.strip() in frozenset( ["P", "OP1", "OP2", "O5'", "C5'"]) and pseudoMol.connectedToPrevFromIndex(startIndex)): #if we're not at the first nucleotide and the user clicked on an atom belonging exclusively to the #starting suite of this residue, then start the minimization at the previous nucleotide startIndex -= 1 startResFull = pseudoMol.resNumFull(startIndex) if ((endIndex + 1) < pseudoMol.getNumNts() and endAtom.strip() == "O3'" and pseudoMol.connectedToNextFromIndex(endIndex)): #if we're not at the last nucleotide and the user clicked on an atom belonging exclusively to the #ending suite of this residue, then include the next residue in the minimization
if curResIsPhosOnly: resIndexToCheck = resIndex - 1 resNumFullToCheck = pseudoMol.resNumFull(resIndex - 1) else: resIndexToCheck = resIndex resNumFullToCheck = resNumFull #make sure that this nucleotide isn't mdofied resType = pseudoMol.resTypeFromIndex(resIndexToCheck) if resType not in STANDARD_BASES: reportModifiedNucError(resNumFullToCheck, resType) return False #make sure that the molecule (or at least the end of it we're going to be building on) uses PDB3 atom naming if pseudoMol.checkPDB2FromIndex(resIndexToCheck): reportPDB2Error(resNumFullToCheck) return False #the current residue must have a glycosidic bond baseType = pseudoMol.resTypeFromIndex(resIndexToCheck) if baseType == "A" or baseType == "G": glyN = "N9" else: #we already know that the base isn't modified because we checked above glyN = "N1" if pseudoMol.getAtomCoordsFromIndex("C1'", resIndexToCheck) is None: print "Nucleotide " + resNumFullToCheck + " does not have a C1' atom. Cannot extend chain." add_status_bar_text("Nucleotide " + resNumFullToCheck + " does not have a C1' atom. Cannot extend chain.") return False
if curResIsPhosOnly: resIndexToCheck = resIndex - 1 resNumFullToCheck = pseudoMol.resNumFull(resIndex - 1) else: resIndexToCheck = resIndex resNumFullToCheck = resNumFull #make sure that this nucleotide isn't mdofied resType = pseudoMol.resTypeFromIndex(resIndexToCheck) if resType not in STANDARD_BASES: reportModifiedNucError(resNumFullToCheck, resType) return False #make sure that the molecule (or at least the end of it we're going to be building on) uses PDB3 atom naming if pseudoMol.checkPDB2FromIndex(resIndexToCheck): reportPDB2Error(resNumFullToCheck) return False #the current residue must have a glycosidic bond baseType = pseudoMol.resTypeFromIndex(resIndexToCheck) if baseType == "A" or baseType== "G": glyN = "N9" else: #we already know that the base isn't modified because we checked above glyN = "N1" if pseudoMol.getAtomCoordsFromIndex("C1'", resIndexToCheck) is None: print "Nucleotide " + resNumFullToCheck + " does not have a C1' atom. Cannot extend chain." add_status_bar_text("Nucleotide " + resNumFullToCheck + " does not have a C1' atom. Cannot extend chain.") return False if pseudoMol.getAtomCoordsFromIndex(glyN, resIndexToCheck) is None:
startIndex = pseudoMol.resIndex(startResFull) endIndex = pseudoMol.resIndex(endResFull) if (startIndex > endIndex): #make sure that the starting atom is before the ending atom #if it isn't, swap them (startResFull, endResFull) = (endResFull, startResFull) (startIndex, endIndex) = (endIndex, startIndex) (startAtom, endAtom) = (startAtom, endAtom) #make sure that the molecule using PDB3 naming (as oppsed to PDB2) #TODO: check all residues for PDB3 naming instead of just the first one in case the molecule uses a mix of PDB2 and PDB3 naming # this seems like an unlikely problem, but it can't hurt to double check if pseudoMol.checkPDB2FromIndex(startIndex): reportPDB2Error(startResFull) return False if (startIndex > 0 and startAtom.strip() in frozenset(["P", "OP1", "OP2", "O5'", "C5'"]) and pseudoMol.connectedToPrevFromIndex(startIndex)): #if we're not at the first nucleotide and the user clicked on an atom belonging exclusively to the #starting suite of this residue, then start the minimization at the previous nucleotide startIndex -= 1 startResFull = pseudoMol.resNumFull(startIndex) if ((endIndex + 1) < pseudoMol.getNumNts() and endAtom.strip() == "O3'" and pseudoMol.connectedToNextFromIndex(endIndex)): #if we're not at the last nucleotide and the user clicked on an atom belonging exclusively to the