def importStarChemicalShifts(ccpnProject, inputDir, guiRoot, allowPopups=1, minimalPrompts=0, verbose=1, **presets): print "JFD: now in importStarChemicalShifts" # formatCns = CnsFormat(ccpnProject, guiRoot, verbose=verbose, minimalPrompts=minimalPrompts, allowPopups=allowPopups, **presets) formatNmrStarFormat = NmrStarFormat(ccpnProject, guiRoot, verbose=verbose, minimalPrompts=minimalPrompts, allowPopups=allowPopups, **presets) ccpnShiftListOfList = [] # Actually just one but this is less time to code;-) globPattern = inputDir + '/*_21.str' fileList = glob(globPattern) nTdebug("From %s will read files: %s" % (globPattern, fileList)) for fn in fileList: fnBaseName = os.path.basename(fn).split('.')[0] shiftList = formatNmrStarFormat.readShifts(fn, minimalPrompts=minimalPrompts, verbose=verbose) if not shiftList: nTerror("Failed to read") return True shiftList.setName(fnBaseName) ccpnShiftListOfList.append(shiftList) # Find and print this shiftList in the CCPN data model. Just to check lookup. shiftList = ccpnProject.currentNmrProject.findFirstMeasurementList(className = 'ShiftList') print 'ShiftList: [%s]' % shiftList keywds = getDeepByKeysOrDefault(presets, {}, READ_SHIFTS, KEYWORDS) if keywds: nTmessage("In importStarChemicalShifts using keywds...") nTdebug(str(keywds)) shiftList = getDeepByKeys(ccpnShiftListOfList, 0) # no need to repeat nTdebug("First shiftList: %s" % shiftList) if shiftList == None: nTerror("Failed to get shiftList again.") return True # nmrConstraintStore = shiftList.nmrConstraintStore # structureGeneration = nmrConstraintStore.findFirstStructureGeneration() formatNmrStarFormat.linkResonances( forceDefaultChainMapping=1, # may be overwritten by using forceChainMappings. globalStereoAssign=1, setSingleProchiral=1, setSinglePossEquiv=1, # strucGen=structureGeneration, allowPopups=allowPopups, minimalPrompts=minimalPrompts, verbose=verbose, **keywds)
def importStarChemicalShifts(ccpnProject, inputDir, guiRoot, allowPopups=1, minimalPrompts=0, verbose=1, **presets): print "JFD: now in importStarChemicalShifts" # formatCns = CnsFormat(ccpnProject, guiRoot, verbose=verbose, minimalPrompts=minimalPrompts, allowPopups=allowPopups, **presets) formatNmrStarFormat = NmrStarFormat(ccpnProject, guiRoot, verbose=verbose, minimalPrompts=minimalPrompts, allowPopups=allowPopups, **presets) ccpnShiftListOfList = [] # Actually just one but this is less time to code;-) globPattern = inputDir + '/*_21.str' fileList = glob(globPattern) nTdebug("From %s will read files: %s" % (globPattern, fileList)) for fn in fileList: fnBaseName = os.path.basename(fn).split('.')[0] shiftList = formatNmrStarFormat.readShifts( fn, minimalPrompts=minimalPrompts, verbose=verbose) if not shiftList: nTerror("Failed to read") return True shiftList.setName(fnBaseName) ccpnShiftListOfList.append(shiftList) # Find and print this shiftList in the CCPN data model. Just to check lookup. shiftList = ccpnProject.currentNmrProject.findFirstMeasurementList( className='ShiftList') print 'ShiftList: [%s]' % shiftList keywds = getDeepByKeysOrDefault(presets, {}, READ_SHIFTS, KEYWORDS) if keywds: nTmessage("In importStarChemicalShifts using keywds...") nTdebug(str(keywds)) shiftList = getDeepByKeys(ccpnShiftListOfList, 0) # no need to repeat nTdebug("First shiftList: %s" % shiftList) if shiftList == None: nTerror("Failed to get shiftList again.") return True # nmrConstraintStore = shiftList.nmrConstraintStore # structureGeneration = nmrConstraintStore.findFirstStructureGeneration() formatNmrStarFormat.linkResonances( forceDefaultChainMapping= 1, # may be overwritten by using forceChainMappings. globalStereoAssign=1, setSingleProchiral=1, setSinglePossEquiv=1, # strucGen=structureGeneration, allowPopups=allowPopups, minimalPrompts=minimalPrompts, verbose=verbose, **keywds)