endIndex -= 1 endResFull = pseudoMol.resNumFull(endIndex) #make sure that we're not now down to a single residue if startIndex >= endIndex: print "Cannot rotamerize this suite without a 3' phosphate." add_status_bar_text( "Cannot rotamerize this suite without a 3' phosphate.") return False #make sure that there are no insertion codes (since Coot's refine_zone can't handle these) #ideally, refine_zone will eventually get fixed and I can remove this check for curIndex in range(startIndex, endIndex + 2): #we need to check the last residue and the one after that, since createPartialChainObject will add on the 3' phosphate if pseudoMol.resNum(curIndex)[1] != "": reportInsCodeError(pseudoMol.resNumFull(curIndex)) return False #make sure that the user hasn't tried to rotamerize too many nucleotides #If they have, it's likely due to misclicking, so we don't want to force them to sit through rotamerizing hundreds of nucleotides numNucsToRotamerize = endIndex - startIndex + 1 if (MAX_NUCLEOTIDES_TO_ROTAMERIZE > 0) and (numNucsToRotamerize > MAX_NUCLEOTIDES_TO_ROTAMERIZE): print "Warning: Too many nucleotides to rotamerize." print " Trying to rotamerize", numNucsToRotamerize, "nucleotides and your current maximum is", MAX_NUCLEOTIDES_TO_ROTAMERIZE print " To increase the maximum, go to Calculate -> Scripting -> Python" print " and type rcrane.setRotamerizeMaxNucleotides(" + str( numNucsToRotamerize) + ")" print " or type rcrane.setRotamerizeMaxNucleotides(-1) to remove the limit." add_status_bar_text(
return False elif connectedToNext: extendDir = 5 elif connectedToPrev: extendDir = 3 else: #we're dealing with a single nt not containing a 3' phosphate #we need to decide direction based on the atom clicked extendDir = __decideDirectionFromAtom(atom, resNumFull) if not extendDir: return False #if we couldn't determine a direction from the atom, then cancel #make sure that the residue we're going to extend doesn't have an insertion code # (also check the next and previous residues) if pseudoMol.resNum(resIndex)[1] != "": reportInsCodeError(resNumFull) return False if connectedToNext and pseudoMol.resNum(resIndex + 1)[1] != "": reportInsCodeError(pseudoMol.resNumFull(resIndex + 1)) return False if connectedToPrev and pseudoMol.resNum(resIndex - 1)[1] != "": reportInsCodeError(pseudoMol.resNumFull(resIndex - 1)) return False #figure out which residue we should be checking for PDB2 naming and missing glycosidic bond atoms if curResIsPhosOnly: resIndexToCheck = resIndex - 1 resNumFullToCheck = pseudoMol.resNumFull(resIndex - 1) else: resIndexToCheck = resIndex resNumFullToCheck = resNumFull
elif connectedToNext: extendDir = 5 elif connectedToPrev: extendDir = 3 else: #we're dealing with a single nt not containing a 3' phosphate #we need to decide direction based on the atom clicked extendDir = __decideDirectionFromAtom(atom, resNumFull) if not extendDir: return False #if we couldn't determine a direction from the atom, then cancel #make sure that the residue we're going to extend doesn't have an insertion code # (also check the next and previous residues) if pseudoMol.resNum(resIndex)[1] != "": reportInsCodeError(resNumFull) return False if connectedToNext and pseudoMol.resNum(resIndex+1)[1] != "": reportInsCodeError(pseudoMol.resNumFull(resIndex+1)) return False if connectedToPrev and pseudoMol.resNum(resIndex-1)[1] != "": reportInsCodeError(pseudoMol.resNumFull(resIndex-1)) return False #figure out which residue we should be checking for PDB2 naming and missing glycosidic bond atoms if curResIsPhosOnly: resIndexToCheck = resIndex - 1 resNumFullToCheck = pseudoMol.resNumFull(resIndex - 1) else: resIndexToCheck = resIndex resNumFullToCheck = resNumFull
endIndex -= 1 endResFull = pseudoMol.resNumFull(endIndex) #make sure that we're not now down to a single residue if startIndex >= endIndex: print "Cannot rotamerize this suite without a 3' phosphate." add_status_bar_text("Cannot rotamerize this suite without a 3' phosphate.") return False #make sure that there are no insertion codes (since Coot's refine_zone can't handle these) #ideally, refine_zone will eventually get fixed and I can remove this check for curIndex in range(startIndex, endIndex+2): #we need to check the last residue and the one after that, since createPartialChainObject will add on the 3' phosphate if pseudoMol.resNum(curIndex)[1] != "": reportInsCodeError(pseudoMol.resNumFull(curIndex)) return False #make sure that the user hasn't tried to rotamerize too many nucleotides #If they have, it's likely due to misclicking, so we don't want to force them to sit through rotamerizing hundreds of nucleotides numNucsToRotamerize = endIndex - startIndex + 1 if (MAX_NUCLEOTIDES_TO_ROTAMERIZE > 0) and (numNucsToRotamerize > MAX_NUCLEOTIDES_TO_ROTAMERIZE): print "Warning: Too many nucleotides to rotamerize." print " Trying to rotamerize", numNucsToRotamerize, "nucleotides and your current maximum is", MAX_NUCLEOTIDES_TO_ROTAMERIZE print " To increase the maximum, go to Calculate -> Scripting -> Python" print " and type rcrane.setRotamerizeMaxNucleotides(" + str(numNucsToRotamerize) + ")" print " or type rcrane.setRotamerizeMaxNucleotides(-1) to remove the limit." add_status_bar_text("Warning: Too many nts to rotamerize. Trying to rotamerize " + str(numNucsToRotamerize) + " nts and your current max is " + str(MAX_NUCLEOTIDES_TO_ROTAMERIZE)) return False