def predictWithRCFromPDB(pdbFile, refShifts, ringRatio, typeRCDist, atomNames, builtin): """ Reads an RNA molecule from PDB file and predict chemical shifts. # Parameters: pdbFile (str); the name of the PDB file refShifts (dict); the reference shifts for each atom to be predicted. ringRatio (float); A scale parameter to multiply the ring-current contributions by typeRCDist (String): Type of analysis to perform, 'rc' (ring current) or 'dist' (distances) # Returns: shifts (dict) the chemical shifts that were predicted. The reference ppm value of each atom is also updated with shift """ Molecule.removeAll() pdb = PDBFile() mol = molio.readPDB(pdbFile) #pdb.readCoordinates(pdbFile,-1,False, False) activeStructures = mol.getActiveStructures() avgOverStructures = False if not avgOverStructures: if len(activeStructures) > 0: repI = super.findRepresentative(mol) iStruct = repI[0] else: iStruct=0 structList=[iStruct] else: if len(activeStructures) > 0: structList = list(activeStructures) else: structList=[0] if builtin: shifts = rnapred.predictBuiltIn(mol, atomNames, typeRCDist, structList) else: if typeRCDist.lower() == 'rc': shifts = rnapred.predictRCShifts(mol, structList, refShifts, ringRatio, ringTypes) elif typeRCDist.lower() == 'dist': alphas = ringRatio shifts = rnapred.predictDistShifts(mol, rmax, structList, refShifts, alphas) return mol, shifts
def genRCTrainingMatrix(outFileName, pdbFiles, shiftSources, atomNames, ringMode, typeRCDist): """ Generate the training data from a list of pdbFiles and dotBracket values. Each file is predicted using the attribute method based on a specified dot-bracket string and the output is appended to the training matrix # Parameters: outFileName (str); The output file name. File is deleted if present already. pdbFiles (list); list of PDB Files to use shiftSources (list); list of sources for shifts. Either dot-bracket values (vienna string) or bmrb id to use for each pdb file atomNames (list): list of atom names ringMode typeRCDist (String): Type of analysis to perform, 'rc' (ring current) or 'dist' (distances) # Returns: _ (None); Training data is written to specified file """ try: os.remove(outFileName) except: pass with open(outFileName,'a') as f1: for pdbID,shiftSource in zip(pdbFiles,shiftSources): Molecule.removeAll() pdbFile = 'pdbfiles/'+pdbID+'.pdb' if not getPDBFile(pdbID): print 'skip',pdbFile continue print 'train',pdbFile pdb = PDBFile() mol = molio.readPDB(pdbFile) if shiftSource[0]=="." or shiftSource[0]=="(": rnapred.predictFromSequence(mol,shiftSource) else: setRefShiftsFromBMRB(shiftSource, {}) genRCMat(mol,atomNames,f1, ringMode, typeRCDist)