Example #1
0
    def readParsHelpFile(self):

        self.tags = {}

        fileLocation = os.path.join(getTopDirectory(), 'data', 'ccp', 'varian',
                                    'parhelp.txt')

        fin = open(fileLocation, 'rU')
        line = fin.readline()

        while line:

            if not (self.patt['emptyline'].search(line)
                    or self.patt['hash'].search(line)):
                cols = line.split()
                if len(cols) < 3 or cols[1] != '=':

                    print "Error parsing following line:" + self.newline + line + self.newline

                else:
                    # Sort out tag
                    tag = cols[0]

                    # Sort out value (remove ' and rejoin with single spaces)
                    value = joinUnquote(cols[2:], "'")

                    self.tags[tag] = value

            line = fin.readline()
Example #2
0
def determineHelpUrl(clazz=None, name=None):

    assert clazz or name

    topDir = getTopDirectory()

    #dir = splitPath(__file__)[0]
    #if (dir):
    #  dir = dir + '/'

    if (not name):
        name = clazz.__name__
    help_url = 'file:' + topDir + LOCAL_HELP_DOC_DIR + 'popups/' + name + '.html'

    return help_url
Example #3
0
    def readParsHelpFile(self):

        self.tags = {}

        fileLocation = os.path.join(getTopDirectory(), 'data', 'ccp', 'bruker',
                                    'parhelp.txt')

        fin = open(fileLocation, 'rU')
        line = fin.readline()

        while line:

            if not (self.patt['emptyline'].search(line)
                    or self.patt['hash'].search(line)):
                cols = line.split()
                if len(cols) < 3 or cols[1] != '=':
                    print "Error parsing following line:" + self.newline + line + self.newline
                else:
                    # Sort out tag
                    tag = cols[0]

                    # Sort out value (remove ' and rejoin with single spaces)
                    value = joinUnquote(cols[2:], "'")

                    # Check if multivalue line (eg. SFO1, SFO2, ...)
                    searchobj = self.patt[self.format +
                                          'BracketMultiValue'].search(tag)
                    if searchobj:
                        for i in range(int(searchobj.group(1)),
                                       int(searchobj.group(2)) + 1):
                            curTag = self.patt[self.format +
                                               'BracketMultiValue'].sub(
                                                   str(i), tag)
                            curValue = self.patt[self.format +
                                                 'BracketMultiValue'].sub(
                                                     str(i), value)
                            self.tags[curTag] = curValue
                    else:
                        self.tags[tag] = value

            line = fin.readline()
Example #4
0
    def setIconSize(self, iconSize, redraw=True):

        size = ICON_SIZE_DICT.get(iconSize, 22)
        if size != self.rowHeight:
            self.rowHeight = size + 1
            self.font = 'Helvetica %d' % (size / 2)

            ccpnDir = getTopDirectory()
            iconDir = '%dx%d' % (size, size)
            imageDir = path.join(ccpnDir, 'python', 'memops', 'gui',
                                 'graphics', iconDir)

            files = [f for f in listdir(imageDir) if f.endswith('.gif')]

            for file in files:
                imageFile = path.join(imageDir, file)
                self.icons[file[:-4]] = PhotoImage(file=imageFile)

            if redraw:
                self._changeSize()

        return size
Example #5
0
  
    self.atomSerial = returnInt(atomSerial,default=None,verbose=verbose)
    self.value = returnFloat(value,default=None,verbose=verbose)
    self.valueError = returnFloat(valueError,default=None,verbose=verbose)
    self.atomName = atomName
    (self.seqCode,self.seqInsertCode) = getSeqAndInsertCode(seqCode)
    self.molCode = parent.defaultMolCode

###################
# Main of program #
###################

if __name__ == "__main__":  
                                                                                                            
  files = [['../reference/xeasy/3d.1.chemShifts','local/cs.test1']
          ]

  for (inFile,outFile) in files:
    
    chemShiftFile = XEasyChemShiftFile(os.path.join(getTopDirectory(),inFile))

    chemShiftFile.read(verbose = 1)

    for chemShift in chemShiftFile.chemShifts:
      print chemShift.seqCode, chemShift.atomName, chemShift.value


    chemShiftFile.name = outFile

    chemShiftFile.write(verbose = 1)
Example #6
0
    def __init__(self,
                 parent,
                 widgetClass,
                 options=None,
                 values=None,
                 callback=None,
                 minRows=3,
                 maxRows=None,
                 useImages=True,
                 *args,
                 **kw):

        Frame.__init__(self, parent, **kw)

        if not values:
            values = []
        if not options:
            options = []

        # Widget types currently: Entries, Pulldown, Checkbutton

        if useImages:
            gfxDir = path.join(getTopDirectory(), 'python', 'memops', 'gui',
                               'graphics')
            self.crossImage = Tkinter.PhotoImage(
                file=path.join(gfxDir, 'cross.gif'))
            self.tickImage = Tkinter.PhotoImage(
                file=path.join(gfxDir, 'tick.gif'))
            self.plusImage = Tkinter.PhotoImage(
                file=path.join(gfxDir, 'plus.gif'))
            self.minusImage = Tkinter.PhotoImage(
                file=path.join(gfxDir, 'minus.gif'))
        else:
            self.crossImage = None
            self.tickImage = None
            self.plusImage = None
            self.minusImage = None

        module = widgetClass.__module__
        self.widgetType = module.split('.')[-1]
        self.widgetClass = widgetClass
        self.callback = callback

        self.numRows = 0
        self.values = values
        self.options = options
        self.minRows = minRows
        self.maxRows = maxRows
        self.widgets = []
        self.labels = []
        self.grid_columnconfigure(1, weight=1)

        self.topFrame = Frame(self)
        self.topFrame.grid(row=0, column=0, columnspan=4, sticky=Tkinter.NSEW)
        self.topFrame.grid_columnconfigure(1, weight=1)
        self.topFrame.grid_rowconfigure(0, weight=1)

        self.addButton = None
        self.removeButton = None
        self.commitButton = None
        self.cancelButton = None

        self.set(self.values, self.options)

        self.updateButtons()

        self.bind('<KeyPress-Return>', self.commit)
        self.bind('<KeyPress-Escape>', self.cancel)
Example #7
0

###################
# Main of program #
###################

if __name__ == "__main__":

    files = [
        '../../reference/nmrView/Brucd44_new2.str',
        #'python/ccpnmr/format/examples/data/withass20010817.str'
    ]

    for inFile in files:

        nmrViewStarFile = NmrViewStarFile(
            os.path.join(getTopDirectory(), inFile))

        nmrViewStarFile.read(verbose=1)

        for peakFile in nmrViewStarFile.peakFiles:
            print peakFile.specNames
            print peakFile.numDims
            print peakFile.peaks[0].ppm
            print peakFile.peaks[-1].ppm

        for sequence in nmrViewStarFile.sequenceFile.sequences:
            for seqEl in sequence.elements:

                print seqEl.seqCode, seqEl.code3Letter
Example #8
0
import os
from memops.universal.Io import getTopDirectory

# TODO: make these local-settable as well?

try:
    from localConstants import dataDir
except:
    dataDir = os.path.join(getTopDirectory(), 'data')

try:
    from localConstants import tmpDataDir
except:
    tmpDataDir = os.path.join(dataDir, 'tmp')

try:
    from localConstants import archivesDataDir
except:
    archivesDataDir = os.path.join(dataDir, 'archives')

generalReferenceDir = os.path.join(archivesDataDir, 'reference')
alignMatrixDir = os.path.join(dataDir, 'alignMatrices')

try:
    from localConstants import customArchivesDataDir
except:
    customArchivesDataDir = os.path.join(archivesDataDir, 'custom')

# TODO THIS ONE MIGHT GO!
try:
    from localConstants import archivesCcpnDataDir
Example #9
0
            self.assign.append(None)


###################
# Main of program #
###################

if __name__ == "__main__":

    files = [
        '../reference/autoassign/hncacb.pks',
        '../reference/autoassign/hnca.pks',
        '../reference/autoassign/hncocacb.pks',
        '../reference/autoassign/hncoca.pks',
        '../reference/autoassign/hnco.pks',
        '../reference/autoassign/hsqc.pks',
    ]

    for inFile in files:

        peakFile = AutoAssignPeakFile(os.path.join(getTopDirectory(), inFile))

        peakFile.read(verbose=1)

        for rawPeak in peakFile.peaks:
            print rawPeak.intensity

        (path, fileName) = os.path.split(peakFile.name)
        peakFile.name = os.path.join('local', fileName)
        peakFile.write()
Example #10
0
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 os import path, mkdir, system, environ

from memops.universal.Io import getTopDirectory

rootDir = path.split(getTopDirectory())[0]

defaultDir = path.join(rootDir,'other','shiftx')

SHIFTX_DIR = environ.get('SHIFTX_DIR', defaultDir)


def testShiftxMacro(argServer):

  structure = argServer.getStructure()
  
  shiftList = shiftx(structure)


def shiftx(structure, atomType=None):
Example #11
0
        self.ppm = []

        for i in range(0, len(ppm)):
            self.ppm.append(returnFloat(ppm[i]))


###################
# Main of program #
###################

if __name__ == "__main__":

    files = [
        '../../reference/ccpNmr/michaelNewYork/050309/fhsqc_stapp.PCK',
        '../../reference/pipp/3d.1.peaks',
        '../../reference/pipp/3d.2.peaks',
        '../../reference/ccpNmr/michaelNewYork/050323/n15noehsqc.PCK',
        '../../reference/ccpNmr/michaelNewYork/050425/motafl6dipsisecryo.PCK',
        '../../reference/ccpNmr/michaelNewYork/050425/motafl6hbhaconhsecryophos.PCK',
    ]

    for inFile in files:

        peakFile = PippPeakFile(os.path.join(getTopDirectory(), inFile))

        peakFile.read(verbose=1)

        for rawPeak in peakFile.peaks:
            print rawPeak.num, rawPeak.assign, rawPeak.intensity
Example #12
0
testChemCompDir = os.path.join(workChemCompDir,'test')
testChemCompDataDir = os.path.join(testChemCompDir,'ChemComp')
testChemCompCoordDataDir = os.path.join(testChemCompDir,'ChemCompCoord')

obsoleteChemCompDir = os.path.join(workChemCompDir,'obsolete')
obsoleteChemCompDataDir = os.path.join(obsoleteChemCompDir,'ChemComp')
obsoleteChemCompCoordDataDir = os.path.join(obsoleteChemCompDir,'ChemCompCoord')

#
# ChemComp directory for editing, in ccpn-chemcomp repository directly
#

try:
  from localConstants import editChemCompDir
except:
  editChemCompDir = joinPath(getTopDirectory(),'..','ccpn-chemcomp','data','pdbe','chemComp','archive')

editChemCompDataDir = joinPath(editChemCompDir,'ChemComp')
editChemCompCoordDataDir = joinPath(editChemCompDir,'ChemCompCoord')

editLinkedChemCompDir = os.path.join(workChemCompDir,'archive')
editLinkedChemCompDataDir = os.path.join(editLinkedChemCompDir,'ChemComp')
editLinkedChemCompCoordDataDir = os.path.join(editLinkedChemCompDir,'ChemCompCoord')


#
# Repository for standard residues, in ccpn sourceforge repository directly
#

try:
  from localConstants import standardRepChemCompDataDir
Example #13
0
        self.atomSerial2 = parent.atoms.index(atom2) + 1

        self.bondType = 'single'  # TODO: can we do better here?


###################
# Main of program #
###################

if __name__ == "__main__":

    files = ['../../reference/pdb/cyclic.pdb', '../../reference/pdb/mcys.pdb']

    for inFile in files:

        pdbFile = PdbChemCompFile(os.path.join(getTopDirectory(), inFile))

        pdbFile.read(verbose=1)

        for chemComp in pdbFile.chemComps:
            for atom in chemComp.atoms:
                print atom.atomType,
            print
            for bond in chemComp.bonds:
                print bond.bondType

        #(path,baseName) = os.path.split(inFile)

        #pdbFile.name = ("local/%s" % baseName)

        #pdbFile.write(verbose = 1)
Example #14
0
"""

###################
# Main of program #
###################

if __name__ == "__main__":

    files = [
        '../../reference/mol/example.mol', '../../reference/mol/cyclic.mol',
        '../../reference/mol/mcys.mol'
    ]

    for inFile in files:

        molFile = MolChemCompFile(os.path.join(getTopDirectory(), inFile))

        molFile.read(verbose=1)

        for chemComp in molFile.chemComps:
            for atom in chemComp.atoms:
                print atom.atomType,
            print
            for bond in chemComp.bonds:
                print bond.bondType

        #(path,baseName) = os.path.split(inFile)

        #molFile.name = ("local/%s" % baseName)

        #molFile.write(verbose = 1)
Example #15
0
################################################################################
if __name__ == '__main__':
    if 1:
        # 0 is only errors, 1 is warnings as well, 2 is normal and 9 is debug
        STAR.verbosity = 2
        strf = File(verbosity=STAR.verbosity)

        if os.name == 'posix':
            pathname = '.'
        else:
            pathname = r'C:\Temp'

##        filename = 'local/test_nopound.txt'
##        filename = 'local/block_21921.txt'

        topDir = getTopDirectory()
        #filename = os.path.join(topDir, '../rawdata/8/1/1/info.general/bmr5106.str')
        filename = os.path.join(topDir, '../reference/nmrStar/1b4c.restraints')
        #filename = os.path.join(topDir, '../rawdata/2/2/1/info.general/bmr5307.str')

        strf.filename = filename

        ##        def myfunc():
        if strf.read():
            print "ERROR: In read. Exiting program"

        # strf.filename
        # strf.formatNMRSTAR: REFORMATS FILE! Don't use!!
        # strf.attrnames:     bulk output of everything in file
        # strf.flavor:        mmCIF, ... (in principle only nmrStar works?)
        # strf.title:         pdb code?
Example #16
0
    def body(self, guiParent):

        self.geometry('700x600')

        # Ensure that the first row and column in popup expand
        guiParent.grid_rowconfigure(0, weight=1)
        guiParent.grid_columnconfigure(0, weight=1, minsize=200)
        frame = Frame(guiParent)  # Body widgets can be put in this frame
        frame.grid()

        # this is going to set up the options on the tabs. Really we need
        # stronger bookeeping between the options and the frames.  it
        # might make sense to define a master dictionary with option_name
        # => index. We can use this dictionary to build up the software
        # options and can also use it to define any refreshes etc (although
        # these would be better done through notifiers)

        softwareOpts = [
            'Repository', 'Project', 'Process', 'Client Tasks', 'Server Tasks',
            'Data Exchange', 'Workflow', 'Protocols', 'User'
        ]

        # FIXME JMCI

        # we should have a tidier tabbed frame. ned to discuss rules with
        # tjs but it would seem to make sense to have the tabs stretch
        # across the entire top of the frame. Check the existing options
        # first, though

        self.tabbedFrame = TabbedFrame(guiParent,
                                       options=softwareOpts,
                                       toggleOff=False,
                                       selected=0)
        self.tabbedFrame.grid(row=0, column=0, sticky='nsew')

        frames = self.tabbedFrame.frames

        # Logos
        ccpnDir = getTopDirectory()
        imageDir = os.path.join(ccpnDir, 'python', 'extendNmr', 'images')
        imageFile = os.path.join(imageDir, 'CcpnLogo.gif')
        self.ccpnLogo = Tkinter.PhotoImage(file=imageFile)

        # Dictionary to store popups opened by this application - e.g. need to close upon quit
        self.popups = {}

        # Default font
        self.font = 'Helvetica 10'

        # Closing the window from the desktop environment calls the proper quit
        self.protocol('WM_DELETE_WINDOW', self.quit)

        # jmci we are going to have to change these drastically
        self.mainMenu = Menu(self)
        self.userMenu = self.makeUserMenu()
        self.repositoryMenu = self.makeRepositoryMenu()
        self.otherMenu = self.makeOtherMenu()

        # Put the top level menu
        self.config(menu=self.mainMenu)
        self.initRepository(frames[0])
        self.initProjectFrame(frames[1])
        self.initWms(frames[2])
        self.initTasks(frames[3])
        self.initDataExch(frames[5])
        self.initWorkflow(frames[6])
        self.initProtocol(frames[7])
        self.initUserFrame(frames[8])

        self.initProject()

        if not self.project:
            for button in self.projButtons:
                button.disable()

        # the main client side daemon. This is going to run in the background
        # and control the task processing
        self.taskDaemon = TaskManager(self)
        self.taskDaemon.active = False
        self.taskDaemon.start()
Example #17
0
    self.x = returnFloat(x,default=None,verbose=verbose)
    self.y = returnFloat(y,default=None,verbose=verbose)
    self.z = returnFloat(z,default=None,verbose=verbose)
    self.insertionCode = insertionCode

    self.chainId = self.segId = string.strip(segId)
    if not self.chainId:
      self.chainId = defaultMolCode

###################
# Main of program #
###################

if __name__ == "__main__":  

  file = os.path.join(getTopDirectory(),'../../reference/charmm/ref03_min.crd')
  charmmFile = CharmmCoordinateFile(file)
  
  charmmFile.read(maxNum = 1)

  for mc in charmmFile.modelCoordinates:
  
    for coo in charmmFile.modelCoordinates[mc]:
      print coo.serial, coo.resName, coo.chainId
      
  for chain in charmmFile.chains:
    print chain, chain.chainId

  charmmFile.name = 'local/test.coord'  
  charmmFile.write()
  
Example #18
0
    def __init__(self, num, assign, ppm, intensity, status):

        self.num = returnInt(num)
        self.intensity = returnFloat(intensity)
        self.status = status

        self.assign = []
        self.ppm = []

        for i in range(0, len(assign)):
            self.ppm.append(returnFloat(ppm[i]))
            self.assign.append(assign[i])


###################
# Main of program #
###################

if __name__ == "__main__":

    files = ['../reference/pronto/cp40', '../reference/pronto/cp150']

    for inFile in files:

        peakFile = ProntoPeakFile(os.path.join(getTopDirectory(), inFile))

        peakFile.read(verbose=1)

        for rawPeak in peakFile.peaks:
            print rawPeak.intensity
Example #19
0
    def getInstallRoot(self):

        self.installRoot = getTopDirectory()
Example #20
0
===========================REFERENCE END===============================
"""
import sys, os
import types

import Tkinter

from memops.gui.Base import getPopup
from memops.gui.Button import Button
from memops.gui.ButtonList import ButtonList
from memops.gui.WebBrowser import WebBrowser
import memops.gui.HelpPopup

from memops.universal.Io import getTopDirectory

gfxDir = os.path.join(getTopDirectory(),'python','memops','gui','graphics')

# creates quit button

def createQuitButton(parent, text=''):

  if not text:
    text = ''

  b = Button(parent, text=text, command=sys.exit)
  
  if not text:
    b.cancelIcon = Tkinter.PhotoImage(file=os.path.join(gfxDir,'cancel.gif'))
    b.config(image=b.cancelIcon, activebackground=b.cget('bg'))

  return b
Example #21
0
    def __init__(self, guiParent, basePopup, project=None):
        # Base popup required to handle notification of data model changes
        # e.g. new peak lists, so that the GUI can update to the latest
        # state
        self.basePopup = basePopup
        self.guiParent = guiParent

        # FIXME JMCI
        # need to work through this far more carefully
        self.project = project

        # shortcuts to this layer
        self.basePopup.frameShortcuts['Task'] = self

        # shortcuts to layer below. We should set these in the
        # initMethod methods
        self.frameShortcuts = {}

        # TODO understand what these are doing
        self.registerNotify = basePopup.registerNotify
        self.unregisterNotify = basePopup.unregisterNotify

        Frame.__init__(self, guiParent)

        self.grid_rowconfigure(1, weight=1)
        self.grid_columnconfigure(0, weight=1)

        # Logos. Code nicked from ExtendNMR GUI
        ccpnDir = getTopDirectory()

        imageDir = os.path.join(ccpnDir, 'python', 'extendNmr', 'images')

        # basically nicked from Extend-NMR
        softwareOpts = [
            'Test1Task', 'ARIA 2', 'Auremol', 'CING', ' ECI ', 'HADDOCK',
            ' ISD ', 'PRODECOMP'
        ]

        self.tabbedFrame = TabbedFrame(guiParent,
                                       options=softwareOpts,
                                       toggleOff=False,
                                       selected=0)
        self.tabbedFrame.grid(row=1, column=0, sticky='nsew')

        frames = self.tabbedFrame.frames

        # Logos
        ccpnDir = getTopDirectory()

        imageDir = os.path.join(ccpnDir, 'python', 'extendNmr', 'images')

        imageFile = os.path.join(imageDir, 'Fp6Logo.gif')
        self.fp6Logo = Tkinter.PhotoImage(file=imageFile)
        imageFile = os.path.join(imageDir, 'CingLogo.gif')
        self.cingLogo = Tkinter.PhotoImage(file=imageFile)
        imageFile = os.path.join(imageDir, 'AriaLogo.gif')
        self.ariaLogo = Tkinter.PhotoImage(file=imageFile)
        imageFile = os.path.join(imageDir, 'IsdLogo.gif')
        self.isdLogo = Tkinter.PhotoImage(file=imageFile)
        imageFile = os.path.join(imageDir, 'HaddockLogo.gif')
        self.haddockLogo = Tkinter.PhotoImage(file=imageFile)
        imageFile = os.path.join(imageDir, 'AuremolLogo.gif')
        self.auremolLogo = Tkinter.PhotoImage(file=imageFile)
        imageFile = os.path.join(imageDir, 'CcpnLogo.gif')
        self.ccpnLogo = Tkinter.PhotoImage(file=imageFile)
        imageFile = os.path.join(imageDir, 'ProdecompLogo.gif')
        self.prodecompLogo = Tkinter.PhotoImage(file=imageFile)
        imageFile = os.path.join(imageDir, 'MddLogo.gif')
        self.mddLogo = Tkinter.PhotoImage(file=imageFile)
        imageFile = os.path.join(imageDir, 'BrukerLogo.gif')
        self.brukerLogo = Tkinter.PhotoImage(file=imageFile)
        imageFile = os.path.join(imageDir, 'MsdLogo.gif')
        self.msdLogo = Tkinter.PhotoImage(file=imageFile)

        # don't know what this does
        self.updateFuncs = []
        self.projButtons = []

        # basically nicked from Extend-NMR
        self.initTest1(frames[0])
        self.initAria(frames[1])
        self.initAuremol(frames[2])
        self.initCing(frames[3])
        #self.initEci(frames[4])
        #self.initHaddock(frames[5])
        self.initIsd(frames[6])
        self.initProdecomp(frames[7])
Example #22
0
def getDataDirectory():

    directory = joinPath(getTopDirectory(), 'data')

    return directory
Example #23
0

###################
# Main of program #
###################

if __name__ == "__main__":

    files = [  #['../../reference/nmrView/2d.1.peaks','local/xpk1.test'],
        #['../../reference/nmrView/3d.1.peaks','local/xpk2.test'],
        #['../../reference/nmrView/2d.2.peaks','local/xpk3.test']
        [
            '../../reference/ccpNmr/moniqueUtrecht/noeN15hsqc_test.xpk',
            'local/monique.test'
        ]
    ]

    for (inFile, outFile) in files:

        peakFile = NmrViewPeakFile(os.path.join(getTopDirectory(), inFile),
                                   assignTagSep=' ')

        peakFile.read(verbose=1)
        print peakFile.specNames
        print peakFile.numDims
        print peakFile.hasAssignItems
        for rawPeak in peakFile.peaks:
            print rawPeak.intensity, rawPeak.assign

        # Tested writing v3 18/11/2002: seems OK!
Example #24
0
  #
  
  projectName = 'test'
  projectDir = os.path.join(os.getcwd(),'local',projectName)

  ccpnProject = loadProject(projectDir,projectName)

  #
  # Because the original project was saved in a different directory structure,
  # the paths have to be reset first... here I am resetting everything 'hardcoded'
  # based on the examples and/or data directory.
  #

  localDataPaths = {}
  localDataPaths['examples'] = os.path.abspath('.')
  localDataPaths['data'] = joinPath(getTopDirectory(),'data')

  for repository in ccpnProject.repositories:
    for findName in ('examples','data'):
      findNameIndex = repository.url.path.find(findName)
      if  findNameIndex>= 0:
        repository.url = Implementation.Url(path = uniIo.joinPath(localDataPaths[findName],repository.url.path[findNameIndex + len(findName) + 1:]))
        break

  #
  # Print out some objects from this project
  #
  
  print "Project object:", ccpnProject
  print "Project name:", ccpnProject.name
  
Example #25
0
    def __init__(self,
                 parent,
                 callback=None,
                 rightCallback=None,
                 width=420,
                 height=440,
                 bgColor='#FFFFFF',
                 showCoords=True,
                 xTicks=True,
                 yTicks=True,
                 xLabel=u'\u03A6',
                 yLabel=u'\u03A8',
                 titleText='',
                 nullColor='#FFFFFF',
                 enterCallback=None,
                 leaveCallback=None,
                 defaultPlot=True,
                 *args,
                 **kw):

        self.parent = parent
        ScrolledCanvas.__init__(self,
                                parent,
                                resizeCallback=self.drawCanvas,
                                width=width,
                                height=height)

        self.bitmapDir = joinPath(getTopDirectory(), 'data', 'ccpnmr',
                                  'ramachandranPlot')
        self.canvas.config(bg=bgColor)
        self.rightCallback = rightCallback  # handle for change of chosen quadrant
        self.callback = callback  # handle for estimation selection
        self.enterCallback = enterCallback  # handle for mouse enter an estimation
        self.leaveCallback = leaveCallback  # handle for mouse leave an estimation
        self.defaultPlot = defaultPlot

        self.showCoords = showCoords
        self.xTicks = xTicks
        self.yTicks = yTicks
        self.xLabel = xLabel
        self.yLabel = yLabel

        self.matrix = []  # bin matrix forming the plot
        self.canvasDict = {}  # aaType : a list of color distribution
        self.intensityDict = {}  # aaType : a list of color distribution
        self.currentObjDict = {}  # object : estimation circle on plot
        self.currentCirDict = {}  # circle on plot : object
        self.residueLabels = {}
        self.currentObjects = []
        self.selectedObjects = []  # a list of selected objects

        self.binSize = 10  # 10 degree for each bin
        self.cirTag = "est"  # arbitrary tag of estimation circles
        self.maxInt = 255  # max number of color used
        self.selectColor = "#00C000"  # color of a selected estimation
        self.unselectColor = "#000000"  # color of a unselected estimation
        self.nullColor = nullColor
        self.objectColors = []
        self.titleText = titleText
        self.title = None
        self.phi = None
        self.psi = None
        self.sd1 = None
        self.sd2 = None
        self.phiPsiList = []
        self.labels = []
        self.crosshair = []
        self.plotCoords = []

        self.aminoAcid = None

        self.binWidth = 10  # Arbitrary deafult - reset dynamically
        self.binHeight = 10  # Arbitrary deafult - reset dynamically
        self.cirRadius = 4
        self.axisObjects = []
        self.zoom = 1.0

        # add handle function to mouse events on estimation objects
        self.canvas.bind("<Button-1>", self.circleClick)

        #if self.enterCallback:
        #  self.canvas.tag_bind(self.cirTag, "<Enter>", self.circleEnter, "+")

        #if self.leaveCallback:
        #  self.canvas.tag_bind(self.cirTag, "<Leave>", self.circleLeave, "+")

        self.canvas.bind('<B2-Motion>', self.mouseMotion)
        self.canvas.bind('<Button-4>', self.zoomIn)
        self.canvas.bind('<Button-5>', self.zoomOut)
        self.canvas.bind('<Motion>', self.mouseEnter)
        self.canvas.bind('<Enter>', self.mouseEnter)
        self.canvas.bind('<Leave>', self.mouseLeave)

        # add handle function to double mouse click on Rama plot
        #self.canvas.bind("<Button-3>", self.rightClick)

        self.drawCanvas()
Example #26
0
  def __init__(self,seqCode,seqInsertCode,atomName):
    
    self.chainCode = defaultMolCode
    self.seqCode = seqCode
    self.seqInsertCode = seqInsertCode
    self.atomName = atomName

###################
# Main of program #
###################

if __name__ == "__main__":  
                                                      
  files = ['../reference/talos/marlies.talosout.tab',
           '../reference/talos/list.table']
  
  for inFile in files:
    
    constraintFile = TalosDihedralConstraintFile(os.path.join(getTopDirectory(),inFile))

    constraintFile.read(verbose = 1)
    
    for constraint in constraintFile.constraints:
      print constraint.Id, constraint.seqCode, constraint.name
      print constraint.upperAngle, constraint.lowerAngle
      for constraintItem in constraint.items:
        for constraintMember in constraintItem.members:
          print constraintMember.atomName,
        print
Example #27
0
        pass


###################
# Main of program #
###################

if __name__ == "__main__":

    # NO REAL EXAMPLE FILE AVAILABLE!
    files = ['../reference/aria/ambig.restraints']

    for file in files:

        file = os.path.join(getTopDirectory(), file)

        constraintFile = CnsHBondConstraintFile(file)

        constraintFile.read(verbose=1)

        for constraint in constraintFile.constraints:
            print constraint.Id, constraint.origId,

            print constraint.targetDist, constraint.minusDist, constraint.plusDist,

            for item in constraint.items:
                for member in item.members:
                    print member.seqCode, member.atomName,
                print "|",
Example #28
0
            if not self.chainId:
                self.chainId = defaultMolCode
        else:
            self.chainId = chainId


###################
# Main of program #
###################

if __name__ == "__main__":

    #file = os.path.join(getTopDirectory(),'../../reference/xplor/neuhaus.pdb')
    #file = os.path.join(getTopDirectory(),'../../reference/ccpNmr/davidLMB/041029/complex_01.pdb')
    file = os.path.join(
        getTopDirectory(),
        '../../reference/ccpNmr/aartUtrecht/041118/1a7f/coord_reprotonated/1a7f_1.pdb'
    )
    cnsFile = CnsCoordinateFile(file)

    cnsFile.read(maxNum=1)

    for mc in cnsFile.modelCoordinates:

        for coo in cnsFile.modelCoordinates[mc]:
            print coo.serial, coo.resName, coo.chainId

    for chain in cnsFile.chains:
        print chain, chain.chainId

    cnsFile.name = 'local/test.coord'
Example #29
0
===========================REFERENCE END===============================
"""
import types, os
import Tkinter

from memops.gui.BasePopup import BasePopup
from memops.gui.Button import Button
from memops.gui.Frame import Frame
from memops.gui.MessageReporter import showInfo
from memops.gui.Spacer import Spacer
from memops.gui.Base import getPopup
from memops.gui.WebBrowser import WebBrowser

from memops.universal.Io import getTopDirectory

GFX_DIR = os.path.join(getTopDirectory(), 'python', 'memops', 'gui',
                       'graphics')

STRING_TYPE = type('')
UNICODE_TYPE = type(u'')
HORIZONTAL = Tkinter.HORIZONTAL
VERTICAL = Tkinter.VERTICAL


def notYetImplemented(text=''):

    if (text):
        text = '"' + text + '" '

    showInfo('Not Yet Implemented', text + 'not yet implemented')
Example #30
0
  def setFormat(self):

    self.format = getFormat()
    
class CyanaChain(DyanaChain):

  pass
    
class CyanaCoordinate(DyanaCoordinate):

  pass
    
if __name__ == "__main__":  

  file = os.path.join(getTopDirectory(),'../reference/diana/example.cor')
  cyanaFile = CyanaCoordinateFile(file)
  
  cyanaFile.read(maxNum = 1)

  for mc in cyanaFile.modelCoordinates:
  
    for coo in cyanaFile.modelCoordinates[mc]:
      print coo.serial, coo.resName, coo.x, coo.y, coo.z
      
  for chain in cyanaFile.chains:
    print chain.chainId

  cyanaFile.name = 'local/test.coord'  
  cyanaFile.write()