Hi Ben,
Well this turned out to be easier than I thought. Only two files have to
be updated, but you can ONLY do this if you have the latest release
(1.0.15 for the FC, 1.0.12 for Analysis).
So copy attached files over the existing (make a backup first, you never
know):
python/ccpnmr/format/converters/XEasyFormat.py
python/ccpnmr/format/general/Constants.py
And you should be able to select 'volume' or 'height' when exporting an
XEASY/CYANA peak list.
Wim
#!/usr/bin/python
"""
======================COPYRIGHT/LICENSE START==========================
XEasyFormat.py: Contains functions specific to XEasy conversions.
Copyright (C) 2005 Wim Vranken (European Bioinformatics Institute)
=======================================================================
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
A copy of this license can be found in ../../../../license/LGPL.license
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
======================COPYRIGHT/LICENSE END============================
for further information, please contact :
- CCPN website (http://www.ccpn.ac.uk/)
- MSD website (http://www.ebi.ac.uk/msd/)
- contact Wim Vranken ([log in to unmask])
=======================================================================
If you are using this software for academic purposes, we suggest
quoting the following references:
===========================REFERENCE START=============================
R. Fogh, J. Ionides, E. Ulrich, W. Boucher, W. Vranken, J.P. Linge, M.
Habeck, W. Rieping, T.N. Bhat, J. Westbrook, K. Henrick, G. Gilliland,
H. Berman, J. Thornton, M. Nilges, J. Markley and E. Laue (2002). The
CCPN project: An interim report on a data model for the NMR community
(Progress report). Nature Struct. Biol. 9, 416-418.
Wim F. Vranken, Wayne Boucher, Tim J. Stevens, Rasmus
H. Fogh, Anne Pajon, Miguel Llinas, Eldon L. Ulrich, John L. Markley, John
Ionides and Ernest D. Laue (2005). The CCPN Data Model for NMR Spectroscopy:
Development of a Software Pipeline. Proteins 59, 687 - 696.
===========================REFERENCE END===============================
"""
import traceback, copy
from ccpnmr.format.converters.DataFormat import DataFormat, IOkeywords
from ccp.general.Util import setUniqueAppData
from memops.universal.Util import returnInt
from ccpnmr.format.general.Util import getApplResNames
from ccpnmr.format.general.Constants import volume_kw, peakNum_kw
import memops.api.Implementation as Implementation
import ccp.api.molecule.ChemComp as ChemComp
import ccp.api.nmr.Nmr as Nmr
#
# Add some information to IOkeywords...
#
IOkeywords = copy.deepcopy(IOkeywords)
IOkeywords['readPeaks']['cyanaFormat'] = (None,False,'Read as CYANA format (with multiple assignments).')
IOkeywords['writePeaks']['cyanaFormat'] = (None,False,'Write as CYANA format (with multiple assignments).')
IOkeywords['writePeaks']['integrationMethod'] = ('volume',False,'Type of integration method to use in output file.')
IOkeywords['writeShifts']['cyana21Naming'] = (False,False,'Use CYANA 2.1 atom names.')
IOkeywords['readShiftsAndPeaks']['peakAssignmentFile'] = (None,False,'Peak assignment file.')
IOkeywords['readShiftsAndPeaks']['cyanaFormat'] = (None,False,'Read as CYANA format (with multiple assignments).')
class XEasyFormat(DataFormat):
def setFormat(self):
self.format = 'xeasy'
self.IOkeywords = IOkeywords
self.shiftListKeyword = 'shiftList'
self.atomSerialKeyword = 'atomSerial'
def setGenericImports(self):
self.getSequence = self.getSequenceGeneric
self.createSequenceFile = self.createSequenceFileGeneric
#self.getPeaks = self.getPeaksGeneric
self.createPeakFile = self.createPeakFileGeneric
self.getMeasurements = self.getMeasurementsGeneric
self.createMeasurementFile = self.createMeasurementFileGeneric
#
# Deviations from generic import stuff
#
def createMeasurementFileFormatSpecific(self):
#
# This is specific for XEasy only! Is only necessary if resonances were 'compressed'
#
self.atomSerialDict = {}
# TODO: spinsystems!!
def getPeaks(self):
if self.verbose == 1:
print "Reading peak list from %s file %s" % (self.formatLabel,self.fileName)
# TODO HERE: have to figure out what to do if project file read...
# TODO: Xeasy peak colour, userCode do not fit right now.
# Assuming only one peaklist per file
self.peakFile = self.PeakFileClass(self.fileName)
self.peakFile.read(cyanaFormat = self.cyanaFormat)
def createPeakFileFormatSpecific(self):
self.peakFile.setSpectrumInfo(self.fileName,self.numPeakDim)
self.writeKeywds['cyanaFormat'] = self.cyanaFormat
def getPeakAssignments(self):
if self.verbose == 1:
print "Reading peak assignments from %s file %s" % (self.formatLabel,self.fileName)
# TODO HERE: have to figure out what to do if project file read...
# TODO: Xeasy peak colour, userCode do not fit right now.
# Assuming only one peaklist per file
self.peakAssignmentsFile = self.peakAssignmentFileClass(self.fileName)
self.peakAssignmentsFile.read()
def createPeakAssignmentFile(self):
if self.verbose == 1:
print "Writing peak assignments to %s file %s" % (self.formatLabel,self.fileName)
self.peakAssignmentsFile = self.peakAssignmentFileClass(self.fileName)
self.peakAssignmentsFile.setDimensions(self.numDim)
# TODO TODO get this sorted correctly!! Will probably fall over
# if information from other formats used.
# Select relevant dimensions for XEasy .assign file
# ONLY last two selected (this is a hack - only two
# should be passed in/used for XEasy)
#
for dataDimRefIndex in self.dimMapping[-2:]:
self.peakAssignmentsFile.assignmentsDim.append(dataDimRefIndex)
#
# Functions different to default functions in DataFormat
#
def createSequence(self):
self.sequenceFile.sequences.append(self.sequenceIO.XEasySequence(molName = self.chain.molecule.name))
self.sequence = self.sequenceFile.sequences[-1]
def setSequenceFileElements(self):
self.sequence.elements.append(self.sequenceIO.XEasySequenceElement(self.seqCode,self.residue.molResidue.chemCompHead.ccpCode))
def forceSpecificNamingSystem(self):
if hasattr(self,'cyana21Naming') and self.cyana21Naming:
self.forceNamingSystem = self.getFormatNamingSystem(format = 'cyana', version = '2.1')
def createShift(self,resonance,chemShift):
#
# For xeasy also use chemShift to create atomSerial application data.
#
# Warning: if there is already an atomSerial available for this resonance
# it will be overwritten!!
#
applData = resonance.findFirstApplicationData(application = self.format, keyword = self.atomSerialKeyword)
if not applData:
Implementation.AppDataInt(resonance,application = self.format, keyword = self.atomSerialKeyword, value = chemShift.atomSerial)
else:
applData.value = chemShift.atomSerial
#
# Create shift linked to resonance
#
return Nmr.Shift(self.measurementList, value = chemShift.value, error = chemShift.valueError, resonance = resonance)
def setPeakIntensity(self):
self.intMethod = self.peakFile.translateIntMethod(self.format,self.rawPeak.intCode)
# PeakIntensity attributes
if self.intMethod != 'Not integrated':
peakInt = Nmr.PeakIntensity(self.peak,value = self.rawPeak.volume, method = self.methods[self.format][self.intMethod])
peakInt.error = self.rawPeak.volumeError
# Assuming that always volume for xeasy (all integration)
peakInt.intensityType = volume_kw
def setPeakDim(self):
dataDimRef = self.dataDimRefs[self.rawPeakDimIndex]
self.peakDim = self.peak.findFirstPeakDim(dim = dataDimRef.dataDim.dim)
self.peakDim.dataDimRef = dataDimRef
self.peakDim.value = self.rawPeak.ppm[self.rawPeakDimIndex]
def createResonanceNamesDict(self,resonances):
#
# For XEasy am using atomSerials instead of resNames for matching...
#
self.assignKeyword = self.atomSerialKeyword
if self.resonanceMatching:
self.resonanceNames = getApplResNames(self.format, resonances, keyword = self.assignKeyword)
else:
self.resonanceNames = {}
if self.resonanceNames == {}:
self.messageReporter.showWarning("Warning","No atom serial numbers available for xeasy peak assignment linking - assignments cannot be transferred",self.guiParent)
def setPeakExtras(self):
if self.cyanaFormat and self.rawPeak.ambiguousAssign:
#
# Make peakContribs for this one...
#
numContribs = len(self.rawPeak.ambiguousAssign) + 1
for i in range(numContribs):
self.peakContribs.append(Nmr.PeakContrib(self.peak))
def getPeakResNames(self):
#
# Assignments put in application data as numbers (need .prot file for atom linking)
# Warning: Keyword here is 'atomSerial'
#
if self.rawPeak.assign[self.rawPeakDimIndex] != None:
resName = self.rawPeak.assign[self.rawPeakDimIndex]
#
# Ignore peaks with atomSerial 0
#
if resName == 0:
self.resNames = []
else:
self.resNames = [resName]
if self.cyanaFormat and self.rawPeak.ambiguousAssign:
for ambAssignment in self.rawPeak.ambiguousAssign:
resName = ambAssignment[self.rawPeakDimIndex]
if resName == 0:
self.resNames.append(None)
else:
self.resNames.append(resName)
else:
self.resNames = []
def peakListAssignmentCheck(self,peakLists):
#
# Check whether shift file was written... if not then do it!
#
checkResonances = []
for peakList in peakLists:
for peak in peakList.sortedPeaks():
for peakDim in peak.sortedPeakDims():
for peakDimContrib in peakDim.peakDimContribs:
if isinstance(peakDimContrib,Nmr.PeakDimContrib):
resonance = peakDimContrib.resonance
if resonance not in checkResonances:
checkResonances.append(resonance)
atomSerialsFound = 0
for resonance in checkResonances:
if self.getResonanceAtomSerial(resonance,verbose = 0):
atomSerialsFound += 1
if checkResonances:
percentageFound = float(atomSerialsFound) * 100 / len(checkResonances)
else:
percentageFound = 100
continueWriting = True
if not self.minimalPrompts and percentageFound < 90:
continueWriting = self.messageReporter.showYesNo("Write shift list","Only %.1f percent of the resonances has an atom serial - assignments cannot be transferred before a shift list is written. Do you want to continue?" % percentageFound)
return continueWriting
def setPeakFilePeakExtras(self):
# TODO: Xeasy peak colour, userCode do not fit right now.
self.colour = 1 # TODO: application data?
self.userCode = "T" # TODO: application data?
self.assign = [] # Can only do this if atomSerial assigned...
self.ambiguousAssign = [] # Can only do this if atomSerial assigned and cyanaFormat option selected.
self.ppm = []
def setPeakFilePeakIntensity(self):
self.volume = 0.0
self.volumeError = 0.0
self.intCode = '-'
if self.peak.peakIntensities != ():
intensity = self.peak.findFirstPeakIntensity(intensityType = self.integrationMethod)
if intensity:
self.volume = intensity.value
if intensity.error != None:
self.volumeError = intensity.error
else:
self.volumeError = 0.0
intMethod = intensity.method.procedure
#
# XEasy specific codes...
# Now assuming 'automatic' as default if a volume is available
#
self.intCode = self.peakFile.translateIntMethod('ccpn',intMethod)
def getAtomSerial(self,resToAtom):
atomSerial = 0
if resToAtom:
if resToAtom.useAtomSetName:
atomName = resToAtom.atomSetName
else:
atomName = resToAtom.atomName
atomSerialDictKey = (resToAtom.chain,resToAtom.seqId,atomName)
if self.atomSerialDict.has_key(atomSerialDictKey):
atomSerial = self.atomSerialDict[atomSerialDictKey]
else:
self.addWarning("Key %s not found in self.atomSerialDict." % str(atomSerialDictKey))
return atomSerial
def setPeakFilePeakDimInfo(self):
self.ppm.append(self.peakDim.getValue())
atomSerial = 0
#
# Transfer assignment for compressresonances - only works if cs list written earlier!
#
assignLen = len(self.peakAssignmentList)
if hasattr(self,'atomSerialDict') and assignLen >= 1:
peakDimIndex = list(self.peak.sortedPeakDims()).index(self.peakDim)
if self.cyanaFormat or assignLen == 1:
resToAtom = self.peakAssignmentList[0][peakDimIndex]
atomSerial = self.getAtomSerial(resToAtom)
#
# Do ambiguous ones if possible.
#
if not self.cyanaFormat:
self.addWarning("Multiple assignments for XEasy peak. Have to write .assign file.")
else:
for i in range(1,assignLen):
resToAtom = self.peakAssignmentList[i][peakDimIndex]
otherAtomSerial = self.getAtomSerial(resToAtom)
if len(self.ambiguousAssign) < assignLen - 1:
self.ambiguousAssign.append([])
self.ambiguousAssign[i-1].append(otherAtomSerial)
self.assign.append(atomSerial)
def peakAssignmentsSetAssignmentInfo(self):
# TODO: redundant - could use self.peakAssignmentsList!!!
# Get all assignments
#
self.assignCombinations = []
peakDims = list(self.peak.sortedPeakDims())
for peakContrib in self.peak.sortedPeakContribs():
peakDimContribs = self.numDim * [None]
#
# Get all peakDimContribs connected to this peakContrib
# and organize them according to peakDim
#
for peakDimContrib in peakContrib.peakDimContribs:
if isinstance(peakDimContrib,Nmr.PeakDimContribN):
print " Warning: cannot handle multiple resonances for one peakDim contribution. Ignored."
else:
peakDimIndex = peakDims.index(peakDimContrib.peakDim)
peakAssignmentIndex = self.dataDimRefs.index(self.peak.sortedPeakDims()[peakDimIndex].dataDimRef)
atomSerial = self.getResonanceAtomSerial(peakDimContrib.resonance)
if not peakDimContribs[peakAssignmentIndex]:
peakDimContribs[peakAssignmentIndex] = []
peakDimContribs[peakAssignmentIndex].append(atomSerial)
#
# Now loop over the peakDimContribs and make all possible combinations
#
self.setAssignCombinations(peakDimContribs,0,[])
def peakAssignmentsCreate(self):
if self.assignCombinations != []:
appData = self.peak.findFirstApplicationData(application = self.format, keyword = peakNum_kw)
if appData:
peakNum = appData.value
else:
peakNum = self.peak.serial
peakAssignment = self.peakAssignmentsIO.XEasyPeakAssignment(self.peakAssignmentsFile,peakNum)
#
# set the assignCombinations
#
for assignCombination in self.assignCombinations:
combi = [assignCombination[self.peakAssignmentsFile.assignmentsDim[0]],assignCombination[self.peakAssignmentsFile.assignmentsDim[1]]]
peakAssignment.assignCombinations.append(combi)
self.peakAssignmentsFile.peakAssignments.append(peakAssignment)
def setAssignCombinations(self,peakDimContribs,peakAssignmentIndex,currentContrib):
"""
Recursive def. Loops over all possible combinations for peakDimContribs
and sets them in self.assignCombinations in the order of the FORMAT
peak assignment file!!!
"""
if len(peakDimContribs) == peakAssignmentIndex:
self.assignCombinations.append(currentContrib)
else:
if peakDimContribs[peakAssignmentIndex]:
for atomSerial in peakDimContribs[peakAssignmentIndex]:
self.setAssignCombinations(peakDimContribs,peakAssignmentIndex + 1, currentContrib + [atomSerial])
else:
self.setAssignCombinations(peakDimContribs,peakAssignmentIndex + 1, currentContrib + [0])
def getResonanceAtomSerial(self,resonance,verbose = 1):
atomSerial = 0
#
# First look if there's an atomSerial from a cs list that was written
#
applData = resonance.findFirstApplicationData(application = self.format, keyword = self.shiftListKeyword)
if not applData:
#
# Then look if there's original (read in from XEasy file) numbers
#
applData = resonance.findFirstApplicationData(application = self.format, keyword = self.atomSerialKeyword)
if not applData:
if verbose:
self.addWarning("No atomSerial for XEasy peak %d. Try writing XEasy shift file first." % self.peak.serial)
else:
atomSerial = applData.value
return atomSerial
def createPeakFilePeak(self):
self.peakFile.peaks.append(self.peaksIO.XEasyPeak(self.peakNum,self.ppm,self.colour,self.userCode,self.volume,self.volumeError,self.intCode,self.assign))
if self.cyanaFormat:
self.peakFile.peaks[-1].ambiguousAssign = self.ambiguousAssign[:]
def setPeakFileInfo(self):
#
# Get isotopecode info
#
for dimIndex in range(0,len(self.dataDimRefs)):
expDimRef = self.dataDimRefs[dimIndex].expDimRef
self.peakFile.dimCodes[dimIndex] = expDimRef.isotopeCodes[0]
def orderByAtomNames(self,residueResonanceToAtomList):
#
# Only use compressResonances if useOriginalResNames NOT on!!
#
if self.compressResonances and not self.useOriginalResNames:
self.compressResidueResonanceToAtomList(residueResonanceToAtomList)
#
# Order according to applData 'atomOrder' linked to XEasy chemAtomSysNames
#
chemAtomOrder = {}
#
# Use 'middle', 'neutral' chemComp for reference info
#
chemComp = self.residue.molResidue.chemComp
chemCompVar = chemComp.findFirstChemCompVar(linking = 'middle', descriptor = 'neutral')
if not chemCompVar:
chemCompVar = chemComp.findFirstChemCompVar(linking = 'middle', isDefaultVar = True)
if not chemCompVar:
print " ERROR: no chemCompVar found for XEasy - might be non-standard residue."
return
chemAtomSysNames = chemCompVar.findAllChemAtomSysNames(namingSystem = self.namingSystem)
for chemAtomSysName in chemAtomSysNames:
chemAtomOrSet = chemComp.findFirstChemAtom(name = chemAtomSysName.atomName)
if not chemAtomOrSet:
chemAtomOrSet = chemComp.findFirstChemAtomSet(name = chemAtomSysName.atomName)
if not chemAtomOrSet:
continue
applData = chemAtomSysName.findFirstApplicationData(application= self.format, keyword="atomOrder")
# TODO THIS IS A SLIGHT HACK TO AVOID UNNECESSARY PRINTOUTS
if not applData:
if chemAtomSysName.sysName not in ['HN','O','H']:
print " Warning: no XEASY serial number for %s, sysName %s" % (self.residue.ccpCode,chemAtomSysName.sysName)
continue
serialOrder = applData.value
chemAtomOrder[serialOrder] = chemAtomSysName.sysName
#
# Already set the atomNamesDict...
#
if self.useOriginalResNames:
for resonanceToAtom in residueResonanceToAtomList:
if chemAtomSysName.sysName == resonanceToAtom.atomName:
self.atomNamesDict[chemAtomSysName.sysName] = resonanceToAtom
break
else:
atomFound = 0
for resonanceToAtom in residueResonanceToAtomList:
if chemAtomSysName.sysName == resonanceToAtom.atomName:
self.atomNamesDict[chemAtomSysName.sysName] = resonanceToAtom
atomFound = 1
break
if not atomFound:
#
# Could be resonanceToAtom present for IUPAC name (e.g. CD* for CD1, CD2)
#
if isinstance(chemAtomOrSet,ChemComp.ChemAtom):
chemAtomSet = chemAtomOrSet.chemAtomSet
if chemAtomSet:
for resonanceToAtom in residueResonanceToAtomList:
if chemAtomSet.name == resonanceToAtom.atomName:
self.atomNamesDict[chemAtomSysName.sysName] = resonanceToAtom
break
#
# Make sure atomNames are in XEasy order...
#
atomsIndexList = chemAtomOrder.keys()
atomsIndexList.sort()
for atomIndex in atomsIndexList:
self.atomNamesList.append(chemAtomOrder[atomIndex])
def setChemShiftFileValue(self):
#
# Warning: chainCode is not actually used here...
#
value = 999.000
error = 0.000
if self.atomNamesDict.has_key(self.atomName):
resonanceToAtom = self.atomNamesDict[self.atomName]
chemShift = self.origAtomMeasurements[resonanceToAtom]
value = chemShift.value
error = chemShift.error
if self.atomMeasurements.has_key(resonanceToAtom):
del(self.atomMeasurements[resonanceToAtom])
#
# Set serial number as application data for resonance
# TODO: this is now only done when writing cs file: otherwise
# serials don't have meaning anyway!!!
#
setUniqueAppData('AppDataInt',chemShift.resonance,self.format,self.shiftListKeyword,self.atomSerial)
self.measurementFile.chemShifts.append(
self.rawMeasurementClass(self.measurementFile,
self.atomSerial,
value,
error,
self.atomName,
self.seqCode))
self.atomSerialDict[(self.chain,self.residue.seqId,self.atomName)] = self.atomSerial
# TODO: also have to include spin system related info:
# see 'xeasySpinSysAtoms' for XEasy!!!
def setPeakDimOrder(self):
self.peakDimOrder = {
1: [0],
2: [1,0],
3: [1,2,0],
4: [1,2,3,0],
5: [1,2,3,4,0],
6: [1,2,3,4,5,0]
}
def getPresetChainMapping(self,chainList):
return self.getSingleChainFormatPresetChainMapping(chainList)
#!/usr/bin/python
"""
======================COPYRIGHT/LICENSE START==========================
Constants.py: Useful constants for scripts in ccpnmr/format and subdirectories
Copyright (C) 2005 Wim Vranken (European Bioinformatics Institute)
=======================================================================
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
A copy of this license can be found in ../../../../license/LGPL.license
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
======================COPYRIGHT/LICENSE END============================
for further information, please contact :
- CCPN website (http://www.ccpn.ac.uk/)
- MSD website (http://www.ebi.ac.uk/msd/)
- contact Wim Vranken ([log in to unmask])
=======================================================================
If you are using this software for academic purposes, we suggest
quoting the following references:
===========================REFERENCE START=============================
R. Fogh, J. Ionides, E. Ulrich, W. Boucher, W. Vranken, J.P. Linge, M.
Habeck, W. Rieping, T.N. Bhat, J. Westbrook, K. Henrick, G. Gilliland,
H. Berman, J. Thornton, M. Nilges, J. Markley and E. Laue (2002). The
CCPN project: An interim report on a data model for the NMR community
(Progress report). Nature Struct. Biol. 9, 416-418.
Wim F. Vranken, Wayne Boucher, Tim J. Stevens, Rasmus
H. Fogh, Anne Pajon, Miguel Llinas, Eldon L. Ulrich, John L. Markley, John
Ionides and Ernest D. Laue (2005). The CCPN Data Model for NMR Spectroscopy:
Development of a Software Pipeline. Proteins 59, 687 - 696.
===========================REFERENCE END===============================
"""
from ccp.format.general.Constants import defaultMolCode
from ccp.general.Constants import code1LetterToCcpCodeDict
import os
########################
# Variable definitions #
########################
tagSep = '.'
newline = os.linesep
stereoText = " (stereo)"
#
# For constraints
#
distanceConstraintDefaultLowerLimit = 1.80
#
# For chemical shifts: if a value already exists for a given
# chemical shift list and trying to set a new one, then the the
# new value is ignored in the scripts (can still force setting
# this)
#
chemShiftAllowedDiff = 0.01
#######################
# Keyword definitions #
#######################
ccpNmr_kw = 'ccpNmr'
isAriaInput_kw = 'isAriaInput'
isAriaOutput_kw = 'isAriaOutput'
originalFormat_kw = 'originalFormat'
peakNum_kw = 'peakNum'
assign_kw = 'assign'
volume_kw = 'volume'
height_kw = 'height'
ccpNmrMapping_kw = 'ccpNmrMapping'
importGeneral_kw = 'importGeneral'
newResonances_kw = 'newResonances'
atomSerial_kw = 'atomSerial'
secStrucInfo_kw = 'secStrucInfo'
dateTimeStamp_kw = 'dateTimeStamp'
ioCycleTag_kw = 'ioCycleTag'
seqAssignTag_kw = 'seqAssign'
#####################################################
# Definition of some frequency conversion constants #
#####################################################
INDIRECT_FREQ_CONV = {'1H': 100,
'2H': 15.3506088,
'13C': 25.1449530,
'15N': 10.1329118,
'31P': 40.4808636}
commonNmrActiveIsotopes = {'H': 1,
'C': 13,
'N': 15,
'P': 31}
##########################################################
# Conversion of raw format attribute names to CCPN names #
##########################################################
rawToCcpnAttrNameDict = { 'point': 'position',
'pointDev': 'positionError',
'ppm': 'value',
'ppmDev': 'valueError'}
########################################
# Definition of chemical shift classes #
########################################
chemShiftClasses = {
'protein': {
'N': {
'15N backbone': [['N'], []],
'15N sidechain': [[], ['N']]
},
'C': {
'13C CO': [['C'], []],
'13C CA': [['CA'],[]],
'13C CB': [['CB'],[]],
'13C sidechain': [[], ['C','CA','CB']]
},
'H': {
'1H HN': [['H'], []],
'1H HA': [['HA','HA2','HA3'],[]],
'1H sidechain (all)': [[], ['H','HA','HA2','HA3']]
}
}
}
"""
###################################################################
# Definition of default descriptors for some standard amino acids #
###################################################################
defaultChemCompVarDescr = {
'protein': {
'ARG': 'prot:HH12',
'ASP': 'deprot:HD2',
'CYS': 'prot:HG',
'GLU': 'deprot:HE2',
'HIS': 'prot:HD1;deprot:HE2',
'LYS': 'prot:HZ3',
'SER': 'prot:HG',
'THR': 'prot:HG1',
'TRP': 'prot:HE1',
'TYR': 'prot:HH'}
}
"""
###########################################################
# Definitions of all format lowercase and uppercase names #
###########################################################
allFormatsDict = {'ansig': 'Ansig',
'aria': 'Aria',
'auremol': 'Auremol',
'autoAssign': 'AutoAssign',
'azara': 'Azara',
'bruker': 'Bruker',
'charmm': 'Charmm',
'cns': 'Cns',
'csi': 'Csi',
'concoord': 'Concoord',
'cyana': 'Cyana',
'discover': 'Discover',
'dyana': 'Dyana',
'fasta': 'Fasta',
'felix': 'Felix',
'generic': 'Generic',
'module': 'Module',
'mol': 'Mol',
'mol2': 'Mol2',
'molmol': 'Molmol',
'monte': 'Monte',
'nmrDraw': 'NmrDraw',
'nmrPipe': 'NmrPipe',
'nmrStar': 'NmrStar',
'nmrView': 'NmrView',
'pdb': 'Pdb',
'pipp': 'Pipp',
'pistachio': 'Pistachio',
'pronto': 'Pronto',
'pseudoPdb': 'PseudoPdb',
'regine': 'Regine',
'sparky': 'Sparky',
'talos': 'Talos',
'varian': 'Varian',
'xeasy': 'XEasy'}
formatNamingDict = {('ansig',None): 'XPLOR',
('auremol',None): 'IUPAC', # TODO: is this correct?
('autoAssign',None): 'IUPAC', # Is not relevant
('aria',None): 'IUPAC', # IS this correct?
('charmm',None): 'XPLOR',
('cns',None): 'XPLOR',
('csi',None): 'IUPAC',
('concoord',None): 'XPLOR',
('cyana',None): 'DIANA', # This is the default naming system...
('cyana','2.0'): 'DIANA',
('cyana','2.1'): 'CYANA2.1',
('diana',None): 'DIANA',
('discover',None): 'MSI',
('dyana',None): 'DIANA',
('module',None): 'DIANA',
('molmol',None): 'MOLMOL',
('nmrDraw',None): 'IUPAC',# TODO: is this correct??!
('nmrStar',None): 'AQUA', # TODO: this might not be correct for non-constraint lists...
('nmrView',None): 'XPLOR',
('pdb',None): 'PDB',
('pipp',None): 'XPLOR',
('pseudoPdb',None): 'PDB',
('sparky',None): 'DIANA',
('talos',None): 'XPLOR',
('xeasy',None): 'DIANA'}
# TODO: to get a full list have to do some more work... but this will do for now
namingSystems = []
for namingSystem in formatNamingDict.values():
if not namingSystem in namingSystems:
namingSystems.append(namingSystem)
namingSystems.sort()
formatComponents = {
'single': [
['Sequence','sequence'],
['Chemical compounds','chemComps'],
['Coordinates','coordinates'],
['Chemical shifts','shifts'],
['Peaks','peaks'],
['Peak assignments','peakAssignments'],
['Dihedral constraints','dihedralConstraints'],
['Distance constraints','distanceConstraints'],
['H-bond constraints','hBondConstraints'],
['Rdc constraints','rdcConstraints'],
['Acquisition parameters','acqPars'],
['Processing parameters','processingPars'],
['Processing scripts','processingScript'],
['People and citations','peopleAndCitations'],
['Project file','project']
],
'combined': [
['Chemical shifts and peaks','shiftsAndPeaks']
]
}
# Used in export windows to determine what 'chainCode' info (e.g.
# segID for CNS) is necessary.
exportChainCodeDict = {'ansig': 'molecule name',
'auremol': 'molecule label',
'charmm': 'segID',
'cns': 'segID',
'concoord': 'segid',
'fasta': 'molecule name',
'nmrStar': 'Entity assembly (chain)',
'pdb': 'Chain ID'}
############################
# Input/output definitions #
############################
IoSetupList = [
['sequence',
'readSequence',
'writeSequence',
{'ansig': ['ansig.seq',1,1, [],[]],
'auremol': ['auremol.seq',1,0, [],[]],
'autoAssign': ['table.aat',1,0, [],[]],
'charmm': ['charmm.crd',1,0, [],[]],
'cns': ['cnsOrXplor.pdb',1,0, [],[]],
'csi': ['data.csi',1,0, [],[]],
'dyana': ['dyana.seq',1,1, [],[]],
'cyana': ['cyana.seq',1,1, [['SelectionList','version','Cyana version:',['2.0','2.1'],None]],
[['SelectionList','version','Cyana version:',['2.0','2.1'],None]]],
'fasta': ['fasta.seq',1,1, [],[]],
'mol2': ['compound.mol2',1,0, [],[]],
'molmol': ['molmol.pdb',1,0, [],[]],
'monte': ['monte.seq',1,1, [],[]],
'nmrStar': ['nmrStar.str',1,0, [],[]],
'nmrView': ['nmrView.seq',1,1, [],[]],
'pdb': ['code.pdb',1,0, [],[]],
'pistachio': ['molecule.csa',1,0, [],[]],
'pronto': ['ss.report',1,0, [],[]],
'pseudoPdb': ['code.pdb',1,0, [],[]],
'sparky': ['sparky.seq',1,1, [],[]],
'talos': ['project.tab',1,0, [],[]],
'xeasy': ['xeasy.seq',1,1, [],[]]},
[['FileButton','fileName','Sequence file to import:','Select file',None],
['CheckButton','minimalPrompts','Minimal interaction:',0,None]],
[['MultiSelectionList','chains','Select chains to export:','project.sortedMolSystems().chains',None],
['FileButton','fileName','Name of export sequence file:','Select export file',None],
['CheckButton','useOriginalData','Use original data:',0,None],
['CheckButton','resetMapping','Reset chain mapping:',1,None],
['CheckButton','minimalPrompts','Minimal interaction:',0,None]],
None,
None],
['chemComps',
'readChemComps',
'',
{'mol': ['chemComp.mol',1,0, [],[]],
'mol2': ['chemComp.mol2',1,0, [],[]],
'pdb': ['code.pdb',1,0, [],[]]},
[['FileButton','fileName','File with chemical compound definition to import:','Select file',None],
['CheckButton','minimalPrompts','Minimal interaction:',0,None]],
[],
None,
None],
['coordinates',
'readCoordinates',
'writeCoordinates',
{'auremol': ['auremol.pdb',1,1, [],[]],
'charmm': ['charmm.crd',1,1, [],[]],
'cns': ['cnsOrXplor.pdb',1,1, [],[]],
'dyana': ['dyana.cor',1,1, [],[]],
'cyana': ['cyana.cor',1,1, [['SelectionList','version','Cyana version:',['2.0','2.1'],None]],
[['SelectionList','version','Cyana version:',['2.0','2.1'],None]]],
'molmol': ['molmol.pdb',1,1, [],[]],
'pdb': ['code.pdb',1,1, [],[]],
'pseudoPdb': ['code.pdb',1,1, [['SelectionList','forceNamingSystem','Atom naming system:',namingSystems,None],
['CheckButton','swapFirstNumberAtom','Swap initial number in atom names:',0,None]],
[['SelectionList','forceNamingSystem','Atom naming system:',namingSystems,None]]]},
[['FileButton','fileName','Coordinates file to import:','Select file',None],
['SelectionListWithNone','strucGen','Use existing structure generation:','project.currentNmrProject.structureGenerations',None],
['IntEntry','maxNum','Maximum number of models to read:',9999,None],
['CheckButton','linkAtoms','Link unrecognized atoms:',1,None],
['CheckButton','resetMapping','Reset chain mapping:',0,None],
['CheckButton','matchToAtomNames','Match to internal atom names:',0,None],
['CheckButton','minimalPrompts','Minimal interaction:',0,None]],
[['MultiSelectionList','structures','Select structures to export:','project.molSystems.structures',None],
['FileButton','fileName','Name of export coordinate file:','Select export file',None],
['CheckButton','useOriginalData','Use original data:',0,None],
['CheckButton','resetMapping','Reset chain mapping:',0,None],
['CheckButton','minimalPrompts','Minimal interaction:',0,None]],
None,
None],
['shifts',
'readShifts',
'writeShifts',
{'auremol': ['auremol.meta',1,0, [],[]],
'autoAssign':['autoassign.output',1,0, [['CheckButton','getSeqFlag','Import sequence from file:',0,None]],
[]],
'cns': ['file.ppm',1,1, [],[]],
'csi': ['data.csi',1,1, [],[]],
'cyana': ['',
'XEasy format',
'XEasy format',
[],[]],
'monte': ['monte.cs',1,0, [],[]],
'nmrStar': ['nmrStar.str',1,0, [],[]],
'nmrView': ['ppm.out',1,1, [],[]],
'pipp': ['pipp.shifts',1,0, [['CheckButton','getSeqFlag','Import sequence from file:',0,None]],
[]],
'pistachio':['molecule.csa',1,0, [],[]],
'pronto': ['ss.report',1,0, [],[]],
'sparky': ['sparky.ppm',1,0, [],[]],
'talos': ['project.tab',1,0, [],[]],
'xeasy': ['xeasy.prot',1,1, [],
[['CheckButton','cyana21Naming','Use CYANA 2.1 atom names:',0,None]]]},
[['FileButton','fileName','Chemical shift file to import:','Select file',None],
['CheckButton','resonanceMatching','Match existing resonances:',1,None],
['CheckButton','minimalPrompts','Minimal interaction:',0,None]],
[['SelectionList','measurementList','Select shift list to export:',"project.currentNmrProject.findAllMeasurementLists(className = 'ShiftList')",None],
['FileButton','fileName','Name of export chemical shift file:','Select export file',None],
['MultiSelectionList','chains','Use only chains:','project.sortedMolSystems().chains',None],
['CheckButton','useOriginalResNames','Use original resonance names',0,None],
['CheckButton','compressResonances','Compress names in output',1,None],
['CheckButton','useOriginalData','Use original data:',0,None],
['CheckButton','resetMapping','Reset chain mapping:',0,None],
['CheckButton','minimalPrompts','Minimal interaction:',0,None]],
None,
None],
['peaks',
'readPeaks',
'writePeaks',
{'ansig': ['ansig.xpk',1,1, [],[['MultiSelectionList','peakLists','Select peak lists to export:',"project.currentNmrProject.sortedExperiments().dataSources.peakLists",None]]],
'autoAssign':['autoAssign.pks',1,1, [],[]],
'cyana': ['',
'XEasy format with CyanaFormat option',
'XEasy format with CyanaFormat option',
[],[]],
'felix': ['peaks.txt',1,0, [],[]],
'nmrDraw': ['nmrDraw.tbl',1,1, [['CheckButton','usePointsInfo','Import width info as points:',0,None]],
[]],
'nmrView': ['nmrView.xpk',1,1, [['StringEntry','assignTagSep','Assignment separator:',' ',{'width': 1}],
['FileButton','processingParsFile','Spectrum parameter file:','Select file (optional)',{'component': 'processingPars'}]],
[['CheckButton','writeMissingPeaks','Write missing peaks:',1,None],
['StringEntry','assignTagSep','Assignment separator:',' ',{'width': 1}]]],
'pipp': ['pipp.pck',1,0, [],[]],
'pronto': ['pronto.xpk',1,0, [],[]],
'sparky': ['sparky.peaks',1,1, [],[]],
'xeasy': ['xeasy.peaks',1,1, [['CheckButton','cyanaFormat','Read as CYANA format:',0,None]],
[['CheckButton','cyanaFormat','Write as CYANA format:',0,None],
['SelectionList','integrationMethod','Peak integration method:',['volume','height'],None]]]},
[['FileButton','fileName','Peak list file to import:','Select file',None],
['SelectionListWithNone','dataSource','Use existing dataSource:','project.currentNmrProject.experiments.dataSources',None],
['SelectionListWithNone','peakList','Overwrite existing peaklist:','project.currentNmrProject.experiments.dataSources.peakLists',None],
['CheckButton','resonanceMatching','Match existing resonances:',1,None],
['CheckButton','minimalPrompts','Minimal interaction:',0,None]],
[['SelectionList','peakLists','Select peak list to export:',"project.currentNmrProject.experiments.dataSources.peakLists",None],
['FileButton','fileName','Name of export peak list file:','Select export file',None],
['CheckButton','useOriginalResNames','Use original resonance names:',0,None],
['CheckButton','compressResonances','Compress names in output:',1,None],
['CheckButton','writeAssignments','Include peak assignments in output:',1,None],
['CheckButton','useOriginalNumbers','Use original peak numbers:',1,None],
['CheckButton','useOriginalData','Use original data:',0,None],
['CheckButton','resetMapping','Reset chain mapping:',0,None],
['CheckButton','minimalPrompts','Minimal interaction:',0,None]],
None,
None],
['peakAssignments',
'readPeakAssignments',
'writePeakAssignments',
{'xeasy': ['xeasy.assign',1,1, [],[]]},
[['FileButton','fileName','Peak assignment file to import:','Select file',None],
['SelectionListWithNone','peakList','Assignments for peaklist:','project.currentNmrProject.experiments.dataSources.peakLists',None],
['CheckButton','addMode','Add to existing assignments:',1,None],
['CheckButton','overwriteMode','Overwrite existing assignments:',0,None],
['CheckButton','resonanceMatching','Match existing resonances:',1,None],
['CheckButton','minimalPrompts','Minimal interaction:',0,None]],
[['SelectionList','peakList','Select peak list to export:',"project.currentNmrProject.eperiments.dataSources.peakLists",None],
['FileButton','fileName','Name of export peak assignments file:','Select export file',None],
['CheckButton','useOriginalResNames','Use original resonance names',0,None],
['CheckButton','useOriginalData','Use original data:',0,None],
['CheckButton','resetMapping','Reset chain mapping:',0,None],
['CheckButton','minimalPrompts','Minimal interaction:',0,None]],
None,
None],
['distanceConstraints',
'readDistanceConstraints',
'writeDistanceConstraints',
{'cns': ['distances.tbl',1,1, [],[['CheckButton','oneLinePerItem','Use one line per constraint item:',0,None]]],
'concoord':['distances.restr',1,1, [],[]],
'discover':['distances.restr',1,0, [],[]],
'dyana': ['distances.upl',1,1, [['FileButton','lowerLimitFile','Lower limit file:','Select file (optional)',None]],
[['FileButton','lowerLimitFile','Lower limit file:','Select file (optional)',None]]],
'cyana': ['distances.upl',1,1, [['FileButton','lowerLimitFile','Lower limit file:','Select file (optional)',None],
['SelectionList','version','Cyana version:',['2.0','2.1'],None]],
[['FileButton','lowerLimitFile','Lower limit file:','Select file (optional)',None],
['SelectionList','version','Cyana version:',['2.0','2.1'],None]]],
'nmrStar': ['nmrStar.str',1,0, [],[]]},
[['FileButton','fileName','Distance constraints file to import:','Select file',None],
['SelectionListWithNone','strucGen','Add to structure generation:','project.currentNmrProject.structureGenerations',None],
['SelectionListWithNone','constraintList','Add to constraint list:',"project.currentNmrProject.structureGenerations.nmrConstraintStore.findAllConstraintLists(className = 'DistanceConstraintList')",None],
['CheckButton','resonanceMatching','Match existing resonances:',1,None],
['CheckButton','minimalPrompts','Minimal interaction:',0,None]],
[['SelectionList','constraintList','Select distance constraint list to export:',"project.currentNmrProject.nmrConstraintStores.findAllConstraintLists(className = 'DistanceConstraintList')",None],
['FileButton','fileName','Name of export distance constraints file:','Select export file',None],
['CheckButton','useOriginalResNames','Use original resonance names:',0,None],
['CheckButton','compressResonances','Compress names in output:',1,None],
['CheckButton','useOriginalData','Use original data:',0,None],
['CheckButton','resetMapping','Reset chain mapping:',0,None],
['CheckButton','minimalPrompts','Minimal interaction:',0,None]],
None,
None],
['hBondConstraints',
'readHBondConstraints',
'writeHBondConstraints',
{'cns': ['hbonds.tbl',1,1, [],[['CheckButton','oneLinePerItem','Use one line per constraint item:',0,None]]],
'discover':['distances.restr',1,0, [],[]],
'dyana': ['hbonds.upl',1,1, [['FileButton','lowerLimitFile','Lower limit file:','Select file (optional)',None]],
[['FileButton','lowerLimitFile','Lower limit file:','Select file (optional)',None]]],
'cyana': ['hbonds.upl',1,1, [['FileButton','lowerLimitFile','Lower limit file:','Select file (optional)',None],
['SelectionList','version','Cyana version:',['2.0','2.1'],None]],
[['FileButton','lowerLimitFile','Lower limit file:','Select file (optional)',None],
['SelectionList','version','Cyana version:',['2.0','2.1'],None]]],
'nmrStar': ['nmrStar.str',1,0, [],[]]},
[['FileButton','fileName','H-bond constraints file to import:','Select file',None],
['SelectionListWithNone','strucGen','Add to structure generation:','project.currentNmrProject.structureGenerations',None],
['SelectionListWithNone','constraintList','Add to constraint list:',"project.currentNmrProject.structureGenerations.nmrConstraintStore.findAllConstraintLists(className = 'HBondConstraintList')",None],
['CheckButton','resonanceMatching','Match existing resonances:',1,None],
['CheckButton','minimalPrompts','Minimal interaction:',0,None]],
[['SelectionList','constraintList','Select H-bond constraint list to export:',"project.currentNmrProject.nmrConstraintStores.findAllConstraintLists(className = 'HBondConstraintList')",None],
['FileButton','fileName','Name of export H-bond constraints file:','Select export file',None],
['CheckButton','useOriginalResNames','Use original resonance names:',0,None],
['CheckButton','compressResonances','Compress names in output:',1,None],
['CheckButton','useOriginalData','Use original data:',0,None],
['CheckButton','resetMapping','Reset chain mapping:',0,None],
['CheckButton','minimalPrompts','Minimal interaction:',0,None]],
None,
None],
['dihedralConstraints',
'readDihedralConstraints',
'writeDihedralConstraints',
{'cns': ['dihedrals.tbl',1,1, [],[]],
'discover':['dihedrals.restr',1,0, [],[]],
'dyana': ['dihedrals.aco',1,1, [],[]],
'cyana': ['dihedrals.aco',1,1, [['SelectionList','version','Cyana version:',['2.0','2.1'],None]],
[['SelectionList','version','Cyana version:',['2.0','2.1'],None]]],
'nmrStar': ['nmrStar.str',1,0, [],[]],
'talos': ['dihedral.tab',1,0, [['MultiSelectionList','validClasses','Classes for valid constraint:',['Good','New','Warn','None'],None],
['IntEntry','validCount','Count variable lower limit for valid constraint:',0,None]],
[]]},
[['FileButton','fileName','Dihedral constraints file to import:','Select file',None],
['SelectionListWithNone','strucGen','Add to structure generation:','project.currentNmrProject.structureGenerations',None],
['SelectionListWithNone','constraintList','Add to constraint list:',"project.currentNmrProject.structureGenerations.nmrConstraintStore.findAllConstraintLists(className = 'DihedralConstraintList')",None],
['CheckButton','resonanceMatching','Match existing resonances:',1,None],
['CheckButton','minimalPrompts','Minimal interaction:',0,None]],
[['SelectionList','constraintList','Select dihedral constraint list to export:',"project.currentNmrProject.nmrConstraintStores.findAllConstraintLists(className = 'DihedralConstraintList')",None],
['FileButton','fileName','Name of export dihedral constraints file:','Select export file',None],
['CheckButton','useOriginalResNames','Use original resonance names:',0,None],
['CheckButton','compressResonances','Compress names in output:',1,None],
['CheckButton','useOriginalData','Use original data:',0,None],
['CheckButton','resetMapping','Reset chain mapping:',0,None],
['CheckButton','minimalPrompts','Minimal interaction:',0,None]],
None,
None],
['rdcConstraints',
'readRdcConstraints',
'writeRdcConstraints',
{'cns': ['rdc.tbl',1,1, [],
[['IntEntry','refFrameResId','The residue code for the reference frame:',999,None],
['StringEntry','refFrameSegId','The segment Id for the reference frame:',defaultMolCode,{'width': 1}]]],
'dyana': ['rdcs',1,1, [],[]],
'cyana': ['rdcs',1,1, [['SelectionList','version','Cyana version:',['2.0','2.1'],None]],
[['SelectionList','version','Cyana version:',['2.0','2.1'],None]]],
'module': ['rdcs.mod',1,1, [],[]],
'nmrStar': ['nmrStar.str',1,0, [],[]]},
[['FileButton','fileName','Rdc constraints file to import:','Select file',None],
['SelectionListWithNone','strucGen','Add to structure generation:','project.currentNmrProject.structureGenerations',None],
['SelectionListWithNone','constraintList','Add to constraint list:',"project.currentNmrProject.structureGenerations.nmrConstraintStore.findAllConstraintLists(className = 'RdcConstraintList')",None],
['CheckButton','resonanceMatching','Match existing resonances:',1,None],
['CheckButton','minimalPrompts','Minimal interaction:',0,None]],
[['SelectionList','constraintList','Select RDC constraint list to export:',"project.currentNmrProject.nmrConstraintStores.findAllConstraintLists(className = 'RdcConstraintList')",None],
['FileButton','fileName','Name of export RDC constraints file:','Select export file',None],
['CheckButton','useOriginalResNames','Use original resonance names:',0,None],
['CheckButton','compressResonances','Compress names in output:',1,None],
['CheckButton','useOriginalData','Use original data:',0,None],
['CheckButton','resetMapping','Reset chain mapping:',0,None],
['CheckButton','minimalPrompts','Minimal interaction:',0,None]],
None,
None],
['acqPars',
'readAcqPars',
'writeAcqPars',
{'bruker': ['acqus',1,0, [['CheckButton','switchRefDimInfo','Switch acqu2s/3s info:',1,None]],
[]],
'varian': ['procpar',1,0, [],[]]},
[['FileButton','fileName','Acquisition parameters file to import:','Select file',None],
['SelectionListWithNone','experiment','Use experiment:','project.currentNmrProject.experiments',None],
['SelectionListWithNone','fidDataSource','Use FID dataSource:',"project.currentNmrProject.experiments.findAllDataSources(dataType = 'FID')",None],
['SelectionListWithNone','freqDataSource','Use FREQ dataSource:',"project.currentNmrProject.experiments.findAllDataSources(dataType = 'processed')",None],
['CheckButton','minimalPrompts','Minimal interaction:',0,None]],
[],
None,
["AcqProcParsEditPopup(self.guiParent, experiment = formatObject.experiment, newFidDataSources = ('nmrPipe','azara'))"]],
['processingPars',
'readProcPars',
'writeProcPars',
{'azara': ['',1,1, [],[]],
'bruker': ['',1,0, [],[]],
'nmrPipe': ['',0,1, [],[]],
'nmrView': ['',1,0, [],[]]},
[['FileButton','fileName','Processing parameters file to import:','Select file',None],
['SelectionListWithNone','experiment','Use experiment:','project.currentNmrProject.experiments',None],
['StringEntry','expName','Name for experiment:','',None],
['CheckButton','minimalPrompts','Minimal interaction:',0,None]],
[['SelectionList','freqDataSource','Select FREQ data source to export:',"project.currentNmrProject.experiments.findAllDataSources(dataType = 'processed')",None],
['FileButton','fileName','Name of export processing parameters file:','Select export file',None],
['CheckButton','minimalPrompts','Minimal interaction:',0,None]],
["AcqProcParsEditPopup(self.guiParent, experiment = addKeywds['freqDataSource'].experiment, newFidDataSources = ('nmrPipe','azara'))",
'return'],
None],
['processingScript',
'readProcScript',
'writeProcScript',
{'azara': ['',0,1, [],[]],
'nmrPipe': ['',0,1, [],[]]},
[],
[['SelectionList','freqDataSource','Select FREQ data source to export:',"project.currentNmrProject.experiments.findAllDataSources(dataType = 'processed')",None],
['FileButton','fileName','Name of export processing script file:','Select export file',None],
['CheckButton','minimalPrompts','Minimal interaction:',0,None]],
["AcqProcParsEditPopup(self.guiParent, experiment = addKeywds['freqDataSource'].experiment, newFidDataSources = ('nmrPipe','azara'))",
'return'],
None],
['peopleAndCitations',
'readPeopleAndCitations',
'',
{'pdb': ['code.pdb',1,0, [],[]]},
[['FileButton','fileName','File with people/citation information to import:','Select file',None],
['CheckButton','useExistingPersons','Match to Persons already in project:',1,None],
['CheckButton','minimalPrompts','Minimal interaction:',0,None]],
[],
None,
None],
['project',
'readProject',
'writeProject',
{'ansig': ['ansig.ctr',1,0, [['FileButton','peakFile','Select associated peak file:',"Select peak file",{'component': 'peaks'}]],
[]],
'autoAssign': ['table.aat',1,1, [],
[['SelectionList','chain','Select chain to analyze:',"project.molSystems.chains",None]]],
'nmrStar': ['bmrb.str',1,1, [],
[['SelectionList','entry','Select entry to export:',"project.currentNmrEntryStore.entries",None],
['CheckButton','useOriginalData','Use original data:',0,None]]],
'nmrView': ['nmrView.str',1,0, [],[]],
'sparky': ['sparky.proj',1,1, [],
[['SelectionList','entry','Select entry to export:',"project.currentNmrEntryStore.entries",None],
['SelectionList','molSystem','Select molecular system to export:',"project.molSystems",None],
['CheckButton','useOriginalResNames','Use original resonance names:',0,None],
['CheckButton','useOriginalNumbers','Use original peak numbers:',1,None]]],
'talos': ['project.tab',1,1, [],
[['SelectionList','chain','Select chain to export:',"project.molSystems.chains",None],
['SelectionList','shiftList','Select shift list to export:',"project.currentNmrProject.findAllMeasurementLists(className = 'ShiftList')",None],
['CheckButton','useOriginalData','Use original data:',0,None]]]},
[['FileButton','fileName','Project file to import:','Select file',None],
['CheckButton','minimalPrompts','Minimal interaction:',0,None]],
[['FileButton','fileName','Name of export project file:','Select export file',None],
['CheckButton','minimalPrompts','Minimal interaction:',0,None]],
None,
None],
#
# Combined reading/writing
#
['shiftsAndPeaks',
'readShiftsAndPeaks',
'',
{'nmrView': ['',1,0, [],[]],
'pronto': ['',1,0, [],[]],
'sparky': ['',1,0, [],[]],
'xeasy': ['',1,0, [['CheckButton','cyanaFormat','Read as CYANA format:',0,None],
['FileButton','peakAssignmentFile','Peak assignment file to import:','Select file',{'component': 'peakAssignments'}]],
[]]},
[['FileButton','shiftFile','Chemical shift file to import:','Select file',{'component': 'shifts'}],
['FileButton','peakFile','Peak file to import:','Select file',{'component': 'peaks'}],
['SelectionListWithNone','dataSource','Use existing dataSource:','project.currentNmrProject.experiments.dataSources',None],
['CheckButton','resonanceMatching','Match existing resonances:',1,None],
['CheckButton','minimalPrompts','Minimal interaction:',0,None]],
[],
None,
None],
]
##############
# File types #
##############
fileTypeDict = {
'sequence': {'generic': ['*.seq*','*.pdb','*.m*l*'],
'ansig': ['*.seq'],
'auremol': ['*.seq'],
'autoAssign': ['*.aat'],
'charmm': ['*.crd'],
'cns': ['*.pdb'],
'csi': ['data.*'],
'dyana': ['*.seq'],
'cyana': ['*.seq'],
'fasta': ['*.seq'],
'mol2': ['*.mol2','*.ml2'],
'molmol': ['*.pdb'],
'monte': ['*.seq'],
'nmrStar': ['*.str'],
'nmrView': ['*.seq'],
'pdb': ['*.pdb'],
'pistachio': ['*.csa'],
'pronto': ['*.report'],
'pseudoPdb': ['*.pdb'],
'sparky': ['*.seq'],
'talos': ['*.tab'],
'xeasy': ['*.seq']},
'chemComps': {'generic': ['*.pdb','*.m*l*'],
'auremol': ['*.comp'],
'mol': ['*.mol'],
'mol2': ['*.mol2','*.ml2'],
'pdb': ['*.pdb']},
'coordinates':{'generic': ['*.pdb'],
'auremol': ['*.pdb'],
'charmm': ['*.crd'],
'cns': ['*.pdb'],
'dyana': ['*.cor'],
'cyana': ['*.cor'],
'molmol': ['*.pdb'],
'pdb': ['*.pdb'],
'pseudoPdb': ['*.pdb']},
'shifts': {'generic': ['*.ppm','*.prot'],
'auremol': ['*.meta'],
'autoAssign': ['*.out'],
'cns': ['*.ppm'],
'csi': ['data.*'],
'monte': ['*.cs'],
'nmrStar': ['*.str'],
'nmrView': ['*.out'],
'pipp': ['*.shifts'],
'pistachio': ['*.csa'],
'pronto': ['*.report'],
'sparky': ['*.ppm'],
'talos': ['*.tab'],
'xeasy': ['*.prot']},
'peaks': {'generic': ['*.xpk','*.peaks','*.tbl','*.tab'],
'ansig': ['*.xpk','*.export'],
'autoAssign': ['*.pks'],
'felix': ['*.txt'],
'nmrDraw': ['*.tbl','*.tab'],
'nmrView': ['*.xpk'],
'pipp': ['*.pck','*.PCK'],
'pronto': ['*.xpk'],
'sparky': ['*.peaks'],
'xeasy': ['*.peaks']},
'peakAssignments': {
'xeasy': ['*.assign']},
'distanceConstraints': {
'generic': ['*.tbl','*.restr','*.upl','*.lol'],
'cns': ['*.tbl'],
'concoord':['*.restr'],
'discover':['*.restr'],
'dyana': ['*.upl','*.lol'],
'cyana': ['*.upl','*.lol'],
'nmrStar': ['*.str']},
'hBondConstraints': {
'generic': ['*.tbl','*.upl','*.lol'],
'cns': ['*.tbl'],
'discover':['*.restr'],
'dyana': ['*.upl','*.lol'],
'cyana': ['*.upl','*.lol'],
'nmrStar': ['*.str']},
'dihedralConstraints': {
'generic': ['*.tbl','*dihed*'],
'cns': ['*.tbl'],
'discover':['*.restr'],
'dyana': ['*.aco'],
'cyana': ['*.aco'],
'nmrStar': ['*.str'],
'talos': ['*.tab']},
'rdcConstraints': {
'generic': ['*.tbl','*rdc*'],
'cns': ['*.tbl'],
'dyana': ['*rdc*'],
'cyana': ['*rdc*'],
'nmrStar': ['*.str']},
'rdcConstraints': {
'generic': ['*.tbl','*rdc*'],
'cns': ['*.tbl'],
'dyana': ['*rdc*'],
'cyana': ['*rdc*'],
'module': ['*.mod'],
'nmrStar': ['*.str']},
'acqPars': {'generic': ['acqu*','procpar'],
'bruker': ['acqu*'],
'varian': ['procpar']},
'acqPars': {'generic': ['acqu*','procpar'],
'bruker': ['acqu*'],
'varian': ['procpar']},
'processingPars': {
'azara': ['*.par'],
'bruker': ['proc*'],
'nmrPipe': ['*.com'],
'nmrView': ['*.par']},
'processingScript': {
'azara': ['*.scr'],
'nmrPipe': ['*.com']},
'peopleAndCitations': {'pdb': ['*.pdb']},
'project': {'ansig': ['*.ctr'],
'autoAssign': ['*.aat'],
'ccpn': ['*.xml'],
'nmrStar': ['*.str'],
'nmrView': ['*.str'],
'sparky': ['*.proj'],
'talos': ['*.tab']},
'mapping': {ccpNmr_kw: ['*.map']},
'csdep': {'bmrb': ['*.csdep']},
'FID': {'varian': ['fid'],'bruker': ['ser','fid']},
#'conv': {'nmrPipe': ['*.com']},
'processing': {'nmrPipe': ['*.com'], 'azara': ['*.scr','*.par']},
#'par': {'azara': ['*.par']}
'text': {'generic': ['*.txt','*.text']}
}
##########################################################################
# Conversion from old experiment names to new reference experiment setup #
##########################################################################
oldToNewExpDict = {
#
# 2 dimensional HSQC type experiments
# -----------------------------------
'hsqc_HC.hc': ('H[C]','H[C]'),
'hsqc_HN.hn': ('H[N]','H[N]'),
# Tocsy spectra
# -------------
'tocsy.hh': ('H_H.TOCSY','H_H.TOCSY'),
'tocsy_HcCh.hc': ('HC_CH.TOCSY','hC_cH.TOCSY'),
'tocsy_HCCH.hhc': ('HC_CH.TOCSY','HC_cH.TOCSY'),
'tocsy_CcconH.hc': ('HC_CCONH.TOCSY','hC_cconH.TOCSY'),
'tocsy_CccoNH.hcn': ('HC_CCONH.TOCSY','hC_ccoNH.TOCSY'),
'tocsy_HccoNH.hhn': ('HC_CCONH.TOCSY','Hc_ccoNH.TOCSY'),
'tocsy_CcNH.hcn': ('HC_CNH.TOCSY','hC_cNH.TOCSY'),
'tocsy_HcNH.hhn': ('HC_CNH.TOCSY','Hc_cNH.TOCSY'),
# Cosy spectra
# ------------
'cosy.hh': ('H_H.COSY','H_H.COSY'),
# Backbone (including beta) assignment spectra. Grouped by complement
# SP is info about same or previous residue, P is previous residue only
# ---------------------------------------------------------------------
'HNCO.hcn': ('H[N[CO]]','H[N[CO]]'),
'HnCO.hc': ('H[N[CO]]','H[n[CO]]'),
'HNcoCA.hcn': ('H[N[CO[CA]]]','H[N[co[CA]]]'),
'HncoCA.hc': ('H[N[CO[CA]]]','H[n[co[CA]]]'),
'HNcaCO.hcn': ('H[N[CA[CO]]]','H[N[CA[CO]]] CA splits CO'),
'HncaCO.hc': ('H[N[CA[CO]]]','H_H.COSY'),
'HNCA.hcn': ('H[N[CA]]','H[N[CA]]'),
'HnCA.hc': ('H[N[CA]]','H[n[CA]]'),
'haCANH.hcn': ('HNCAHA','haCANH'),
'HAcaNH.hhn': ('HNCAHA','HAcaNH'),
'haCAcoNH.hcn': ('HCACONH','hCAcoNH'),
'HAcacoNH.hhn': ('HCACONH','HcacoNH'),
'hbCBCAcoNH.hcn': ('H{CA|Cca}CONH','h{CA|Cca}coNH'),
'hbCBCANH.hcn': ('H{CA|Cca}NH','h{CA|Cca}NH'),
'HNcoCACB.hcn': ('H[N[CO[{CA|caC}]]]','H[N[co[{CA|caC}]]]'),
'HncoCACB.hc': ('H[N[CO[{CA|caC}]]]','H[n[co[{CA|caC}]]]'),
'HNcocaCB.hcn': ('H[N[CO[C[C]]]]','H[N[co[c[C]]]]'),
'HncocaCB.hc': ('H[N[CO[C[C]]]]','H[n[co[c[C]]]]'),
'HNcaCB.hcn': ('H[N[CA[CB]]]','H[N[ca[CB]]]'),
'HncaCB.hc': ('H[N[CA[CB]]]','H[n[ca[CB]]]'),
'HNCACB.hcn': ('H[N[{CA|ca[C]}]]','H[N[{CA|ca[C]}]]'),
'HnCACB.hc': ('H[N[{CA|ca[C]}]]','H[n[{CA|ca[C]}]]'),
#trosy_HnCO.hc # SP. Same as above, but TROSY version.
#trosy_HncaCO.hc # P. Same as above, but TROSY version.
#trosy_HncoCA.hc # P. Same as above, but TROSY version.
#trosy_HnCA.hc # SP. Same as above, but TROSY version.
#trosy_HnCACB.hc # SP. Same as above, but TROSY version.
#trosy_HncoCACB.hc # P. Same as above, but TROSY version.
#trosy_HncaCB.hc # SP. Same as above, but TROSY version.
#trosy_HncocaCB.hc # P. Same as above, but TROSY version.
#
# Noesy spectra
#
'noesy.hh': ('H_H.NOESY','H_H.NOESY'),
'noesy_hsqc_HCH.hhc': ('H[C]_H.NOESY','H_H[C].NOESY'),
'noesy_hsqc_HNH.hhn': ('H[N]_H.NOESY','H_H[N].NOESY'),
'noesy_hsqc_HXH.hhx': ('H[{N|C}]_H.NOESY','H_H[{N|C}].NOESY'),
'noesy_hsqc_HCCH.hhcc': ('H[C]_H[C].NOESY','H[C]_H[C].NOESY'),
'noesy_hsqc_HNNH.hhnn': ('H[N]_H[N].NOESY','H[N]_H[N].NOESY'),
'noesy_hsqc_HCNH.hhcn': ('H[N]_H[C].NOESY','H[C]_H[N].NOESY'),
'noesy_hsqc_HNCH.hhnc': ('H[N]_H[C].NOESY','H[N]_H[C].NOESY')
}
########################
# Software definitions #
########################
softwareDefinitions = {
'xeasy': {'version': 'any',
'tasks': ['Spectrum display','Spectrum analysis'],
'methods': {
'Peak integration':
['Denk integration',
'Rectangular integration',
'Elliptical integration',
'Maximum integration',
'Automatic integration'],
'Peak picking':
['Automatic and manual']
}
},
'nmrView':{'version': 'any',
'tasks': ['Spectrum display','Spectrum analysis'],
'methods': {
'Peak integration':
['Volume',
'Intensity'],
'Peak picking':
['Automatic and manual']
}
},
'azara': {'version': 'any',
'tasks': ['Spectrum display','Spectrum analysis'],
'methods': {}
},
'ansig': {'version': 'any',
'tasks': ['Spectrum display','Spectrum analysis'],
'methods': {
'Peak integration':
['Volume'],
'Peak picking':
['Automatic and manual']
}
},
'nmrPipe':{'version': 'any',
'tasks': ['Spectrum processing'],
'methods': {}
},
'pipp': {'version': 'any',
'tasks': ['Spectrum analysis'],
'methods': {
'Peak integration':
['Intensity'],
'Peak picking':
['Automatic and manual']
}
},
'pronto': {'version': 'any',
'tasks': ['Spectrum analysis'],
'methods': {
'Peak integration':
['Intensity'],
'Peak picking':
['Automatic and manual']
}
},
'unknown': {'version': 'any',
'tasks': ['Spectrum analysis'],
'methods': {
'Peak integration':
['Intensity'],
'Peak picking':
['Automatic and manual']
}
},
'sparky': {'version': 'any',
'tasks': ['Spectrum display','Spectrum analysis'],
'methods': {
'Peak integration':
['Volume (Lorentzian)',
'Volume (Gaussian)',
'Volume (Sum over box)',
'Volume (Sum over ellipse)',
'Volume (Unknown method)',
'Intensity (data)',
'Intensity (fitted)'],
'Peak picking':
['Automatic and manual']
}
},
'nmrDraw':{'version': 'any',
'tasks': ['Spectrum display','Spectrum analysis'],
'methods': {
'Peak integration':
['Volume',
'Intensity'],
'Peak picking':
['Automatic and manual']
}
},
'felix':{'version': 'any',
'tasks': ['Spectrum processing','Spectrum display','Spectrum analysis'],
'methods': {
'Peak integration':
['Volume',
'Intensity'],
'Peak picking':
['Automatic and manual']
}
}
}
######################################
# Processing/acquisition definitions #
######################################
varianAcqOrdInfo = {3: [['d3,d2,ph2,ph (normal)','d3,d2,ph,ph2'],
[('dim3','dim2','phase2','phase1'),('dim3','dim2','phase1','phase2')]],
4: [['d4,d3,d2,ph3,ph2,ph (normal)','d4,d3,d2,ph,ph2,ph3'],
[('dim4','dim3','dim2','phase3','phase2','phase1'),('dim4','dim3','dim2','phase1','phase2','phase3')]]
}
"""
xeasySpinSysAtoms = ['N','HN','CA','HA','HA2','CB','HB2','HB3','QB','CG',
'HG2','HG3','QG','CD','HD2','HD3','QD','CE','HE2',
'HE3','QE','H?1','H?2','H?3','H?4','H?5','HA1','C?1',
'C?2','C?3','C?4','N?1','C']
"""
|