def importXplorCoorAndRes(ccpnProject, inputDir, guiRoot, replaceCoordinates=1, replaceRestraints=1, allowPopups=1, minimalPrompts=0, verbose=1, **presets): if replaceCoordinates: status = importPseudoPdb(ccpnProject, inputDir, guiRoot, allowPopups=allowPopups, minimalPrompts=minimalPrompts, verbose=verbose, **presets) if status: nTerror("Failed importXplorCoorAndRes") return True if not replaceRestraints: return formatCns = CnsFormat(ccpnProject, guiRoot, verbose=verbose, minimalPrompts=minimalPrompts, allowPopups=allowPopups) ccpnConstraintListOfList = [] # Will overwrite the settings given to formatCns.linkResonances( below globPattern = inputDir + '/*_noe.tbl' fileList = glob(globPattern) nTdebug("From %s will read files: %s" % (globPattern, fileList)) # for fn in fileList[0:1]: # TODO: for fn in fileList: fnBaseName = os.path.basename(fn).split('.')[0] ccpnConstraintList = formatCns.readDistanceConstraints(fn, minimalPrompts=minimalPrompts, verbose=verbose) ccpnConstraintList.setName(fnBaseName) ccpnConstraintListOfList.append(ccpnConstraintList) if not ccpnConstraintList: nTerror("Failed to read") return True # globPattern = inputDir + '/*_hbond.tblXXXX' # TODO: globPattern = inputDir + '/*_hbond.tbl' fileList = glob(globPattern) nTdebug("From %s will read in files: %s" % (globPattern, fileList)) for fn in fileList: fnBaseName = os.path.basename(fn).split('.')[0] ccpnConstraintList = formatCns.readDistanceConstraints(fn, minimalPrompts=minimalPrompts, verbose=verbose) ccpnConstraintList.setName(fnBaseName) ccpnConstraintListOfList.append(ccpnConstraintList) # globPattern = inputDir + '/*_dihe.tblXXXX' # TODO: globPattern = inputDir + '/*_dihe.tbl' fileList = glob(globPattern) nTdebug("From %s will read in total files: %s" % (globPattern, fileList)) for fn in fileList: fnBaseName = os.path.basename(fn).split('.')[0] ccpnConstraintList = formatCns.readDihedralConstraints(fn, minimalPrompts=minimalPrompts, verbose=verbose) ccpnConstraintList.setName(fnBaseName) ccpnConstraintListOfList.append(ccpnConstraintList) keywds = getDeepByKeysOrDefault(presets, {}, LINK_RESONANCES, KEYWORDS) nTdebug("From getDeepByKeysOrDefault keywds: %s" % repr(keywds)) ccpnConstraintList = getDeepByKeys(ccpnConstraintListOfList, 0) # no need to repeat nTdebug("First ccpnConstraintList: %s" % ccpnConstraintList) if ccpnConstraintList != None: # for i, ccpnConstraintList in enumerate(ccpnConstraintListOfList): keywds = getDeepByKeysOrDefault(presets, {}, LINK_RESONANCES, KEYWORDS) nTdebug("From getDeepByKeysOrDefault keywds: %s" % repr(keywds)) nTdebug("ccpnConstraintList: %s" % ccpnConstraintList) nmrConstraintStore = ccpnConstraintList.nmrConstraintStore structureGeneration = nmrConstraintStore.findFirstStructureGeneration() formatCns.linkResonances( forceDefaultChainMapping=1, # may be overwritten by using forceChainMappings. globalStereoAssign=1, setSingleProchiral=1, setSinglePossEquiv=1, strucGen=structureGeneration, allowPopups=allowPopups, minimalPrompts=minimalPrompts, verbose=verbose, **keywds)
# # Run linkResonances (this will generate a lot of output to the shell) # # Many options are available - see ccpnmr.format.process.linkResonances # # The current options are the 'safest' to maintain the original information, # although bear in mind that here all atoms in the original list are # considered to be stereospecifically assigned # # Set forceDefaultChainMapping to 0 if you want to interactively link the # chains in the CCPN data model to the information from the constraint file # cnsFormat.linkResonances(forceDefaultChainMapping=1, globalStereoAssign=1, setSingleProchiral=1, setSinglePossEquiv=1, strucGen=structureGeneration) # # Save the CCPN project as XML files # ccpnProject.saveModified() # # Navigate the Data Model, get a list of atoms per constraint item # for distConstr in ccpnConstraintList.sortedConstraints():
# To make a molSystem object. chains = cnsObj.readSequence(cnsCoordFile) distConst = 'n15noesy.tbl' distConstFile = os.path.join(cnsDir, distConst) # To make a structureGeneration object. constList = cnsObj.readDistanceConstraints(distConstFile) nmrConstStore = constList.nmrConstraintStore strucGen = nmrConstStore.findFirstStructureGeneration() cnsObj.linkResonances(forceDefaultChainMapping=1, globalStereoAssign=1, setSingleProchiral=1, setSinglePossEquiv=1, strucGen=strucGen) # As usual, create the BMRB Entry object. entryStore = project.newNmrEntryStore(name=project.name) entry = entryStore.newEntry(name=project.name) # Get the molSystem object, and link to it. molSystem = project.sortedMolSystems()[0] entry.setMolSystem(molSystem) # Link the structureGeneration object so that the restraints # are part of the BMRB Entry object. entry.addStructureGeneration(strucGen)
# # Many options are available - see ccpnmr.format.process.linkResonances # # The current options are the 'safest' to maintain the original information, # although bear in mind that here all atoms in the original list are # considered to be stereospecifically assigned # # Set forceDefaultChainMapping to 0 if you want to interactively link the # chains in the CCPN data model to the information from the constraint file # cnsFormat.linkResonances( forceDefaultChainMapping = 1, globalStereoAssign = 1, setSingleProchiral = 1, setSinglePossEquiv = 1, strucGen = structureGeneration ) # # Save the CCPN project as XML files # ccpnProject.saveModified() # # Navigate the Data Model, get a list of atoms per constraint item #