コード例 #1
0
 nmrViewFormat.readSequence(sequenceFile, minimalPrompts = 1)
 
 #
 # Read in the chemical shifts (set minimalPrompts = 0 for more user interaction during this process)
 #
 
 chemShiftFile = os.path.join(dataDir,inputChemShiftFileName)
 nmrViewFormat.readShifts(chemShiftFile, minimalPrompts = 1)
 
 #
 # Create an NMR experiment. This is based on the NmrExpPrototype setup.
 #
 
 refExp = getRefExpFromOldExpType(ccpnProject,expTypeName)
 nmrExp = createExperiment(ccpnProject,expName,refExp)
 nmrDataSource = createPpmFreqDataSource(nmrExp,'test','processed',nmrExp.numDim)
 
 #
 # Read in a peak list (connected to the experiment that was just created)
 #
 
 peakListFile = os.path.join(dataDir,inputPeakListFileName)
 nmrViewFormat.readPeaks(peakListFile, dataSource = nmrDataSource,minimalPrompts = 1)
 
 #
 # Run linkresonances... before running this there is on the one hand the NMR
 # information (peaks, shifts) linked to the 'Resonance' objects, and on the
 # other hand the sequence information (molecules, chains, residues, atoms), but
 # they are not linked to each other.
 #
 # LinkResonances links up the NMR information to the atom information - so basically
コード例 #2
0
    # Should print 'H_H[N].NOESY'.
    print 'New experiment type name: [%s]' % refExp.name

    # Create a real NMR experiment from this object and link it to the
    # CCPN project.
    keywds = {'expName': 'noesyTest', 'refExperiment': refExp}
    nmrExp = createExperiment(project, **keywds)

    # Create a dataSource object (with the right number of dimensions etc.)
    # to hold peak list information.
    keywds2 = {
        'dsName': 'test',
        'dsType': 'processed',
        'numDim': nmrExp.numDim
    }
    nmrDataSource = createPpmFreqDataSource(nmrExp, **keywds2)

    # Read in a peak list connected to the experiment/dataSource that
    # was just created.
    nmrViewPeakLists = 'nmrView.xpk'
    nmrViewPeakListFile = os.path.join(nmrViewDir, nmrViewPeakLists)

    # Do the reading - this will throw up a Tkinter popup window.
    nmrViewObj.readPeaks(nmrViewPeakListFile,
                         dataSource=nmrDataSource,
                         minimalPrompts=1)

    # Find and print this peakList in the CCPN data model.
    peakLists = nmrDataSource.sortedPeakLists()
    print 'Peaklists: [%s]' % peakLists
コード例 #3
0
ファイル: Tool.py プロジェクト: fenglb/ccpnmr2.4
    def readPeakList(self, fileName, refExperimentOldName, spectrumName,
                     peakListDimOrder):

        if self.fileNameDict.has_key(fileName):
            self.peakList = self.fileNameDict[fileName]

        else:

            refExperiment = getRefExpFromOldExpType(self.ccpnProject,
                                                    refExperimentOldName)

            self.experiment = self.ccpnProject.currentNmrProject.findFirstExperiment(
                name=spectrumName, refExperiment=refExperiment)

            if not self.experiment:
                self.experiment = createExperiment(self.ccpnProject,
                                                   spectrumName, refExperiment)

            self.dataSource = self.experiment.findFirstDataSource(
                dataType='processed')

            if not self.dataSource:
                self.dataSource = createPpmFreqDataSource(
                    self.experiment, spectrumName, 'processed',
                    self.experiment.numDim)

            self.peakList = self.dataSource.findFirstPeakList(
                name=spectrumName)

            #
            # Determine the peak list relationship
            # In ccp data model setup assuming that:
            #   - first dim is acquisition
            #   - first hetero dim belongs to acquisition dim
            #

            protonDims = []
            heteroDims = []

            for dataDim in self.dataSource.sortedDataDims():

                if '1H' in dataDim.findFirstDataDimRef(
                ).expDimRef.isotopeCodes:

                    protonDims.append(dataDim.findFirstDataDimRef())

                else:

                    heteroDims.append(dataDim.findFirstDataDimRef())

            dataDimRefs = self.experiment.numDim * ['']

            for dim in range(0, len(peakListDimOrder)):

                peakListDim = returnInt(peakListDimOrder[dim])

                if peakListDim:

                    if dim >= 2:
                        dataDimRef = heteroDims[dim - 2]
                    else:
                        dataDimRef = protonDims[dim - 2]

                    dataDimRefs[peakListDim - 1] = dataDimRef

            self.peakLists = self.format.readPeaks(fileName,
                                                   dataSource=self.dataSource,
                                                   dataDimRefs=dataDimRefs,
                                                   specName=spectrumName,
                                                   peakList=self.peakList,
                                                   minimalPrompts=1)

        if self.experiment not in self.chemShiftList.experiments:
            self.chemShiftList.addExperiment(self.experiment)

        return self.peakLists
コード例 #4
0
    nmrViewChemShifts    = 'ppm.out'
    nmrViewChemShiftFile = os.path.join(nmrViewDir, nmrViewChemShifts)

    nmrViewObj.readShifts(nmrViewChemShiftFile, minimalPrompts = 1)

    refExpType = 'noesy_hsqc_HNH.hhn'
    refExp = getRefExpFromOldExpType(project, refExpType)
    nmrExp = createExperiment(project, 'noesyTest', refExp)

    # Find the molSystem object in the CCPN project.
    molSystem = project.sortedMolSystems()[0]

    # Make a link between the molSystem and the experiment objects.
    nmrExp.addMolSystem(molSystem)

    nmrDataSource = createPpmFreqDataSource(nmrExp, 'test', 'processed',
                                            nmrExp.numDim)

    nmrViewPeakLists    = 'nmrView.xpk'
    nmrViewPeakListFile = os.path.join(nmrViewDir, nmrViewPeakLists)

    nmrViewObj.readPeaks(nmrViewPeakListFile,
                         dataSource = nmrDataSource,
                         minimalPrompts = 1)

    nmrViewObj.linkResonances(setSingleProchiral = 0,
                              setSinglePossEquiv = 0,
                              minimalPrompts = 1)

    # New part of the code - need a BMRB Entry object for writing to
    # an NMR-STAR file.
    entryStore = project.newNmrEntryStore(name = project.name)