Exemplo n.º 1
0
    def __init__(self, parent, *args, **kw):

        helpUrl = kw.get('help_url')
        if not helpUrl:
            helpUrl = determineHelpUrl(self.__class__)

        self.help_url = helpUrl

        project = kw.get('project')
        parentPopup = getPopup(parent)
        if not project and hasattr(parentPopup, 'project'):
            project = parentPopup.project

        self.project = project

        if project:
            self.nmrProject = project.currentNmrProject
            self.analysisProject = project.currentAnalysisProject
            self.analysisProfile = project.currentAnalysisProfile
        else:
            self.nmrProject = None
            self.analysisProject = None
            self.analysisProfile = None

        application = kw.get('application')
        if not application:
            if hasattr(self, 'application'):
                application = self.application
            elif hasattr(parent, 'application'):
                application = parent.application

        self.project = project
        self.application = application

        memops.editor.BasePopup.BasePopup.__init__(self, parent, *args, **kw)
Exemplo n.º 2
0
    def showMainInstructions(self):

        popup = getPopup(self)

        message = """Use this tab to import the chemical shifts and the coordinate and/or sequence information for your molecular chains.
    
The imported chemical shift file should contain information for only *one* molecular chain to make it easier to connect the molecule information to the chemical shift information. You therefore have to select a single chain for each shift list from the dropdown menu that will appear after you imported a coordinate or sequence file.
    
For example, when using sequence files for a dimer, import the information for the chemical shifts for each chain separately:
    
  1. Import the sequence for the first molecular chain.
  2. Import a chemical shift file with shifts only for this molecular chain.  
  3. Reset using the 'Import new sequence' button
  4. Import the sequence for the second molecular chain
  5. Import a chemical shift file with shifts only for this second chain
  
Alternatively, it is possible to read in the molecule information from a full coordinate file:

  1. Import a coordinate file with all molecular information, including coordinates.
  2. Select a molecular chain.
  3. Import a chemical shift file with shifts only for the selected molecular chain.
  4. Go back to step 2. if necessary.
  
You can also import multiple sets of chemical shifts (e.g. for the sample in different conditions). In this case, you have to import all chemical shift information that belongs together for all molecular chains, then press the 'Import new set of shifts' button.

Notes:

1. This application always creates a new CCPN project. It is not possible to import files into existing projects.
2. If your chemical shift file contains information for multiple chains, you have to edit it manually to split up the information per chain.
    """

        showHelpText(self, message, popup=popup)
Exemplo n.º 3
0
def createDismissHelpButtonList(parent, texts = None, commands = None,
                          direction=Tkinter.HORIZONTAL,
                          dismiss_text = '', help_text = '',
                          help_msg = '', help_url = '',
                          buttonBorderwidth=True, expands=True, 
                          dismiss_cmd = None,
                          webBrowser = None,
                          *args, **kw):
  if (texts is None):
    texts = []

  if (commands is None):
    commands = []

  if (not dismiss_text):
    dismiss_text = ''
 
  if (not help_text):
    help_text = ''

  texts = list(texts) + [dismiss_text, help_text]

  popup = getPopup(parent)

  if not webBrowser:
    webBrowser = WebBrowser(popup.top, popup=popup)

  if (not dismiss_cmd):
    dismiss_cmd = popup.close

  if (help_url):
    help_cmd   = lambda url=help_url: webBrowser.open(url)
  else:
    help_cmd = lambda top=popup.top, message=help_msg: memops.gui.HelpPopup.showHelpText(top, message, popup=popup)

  if (type(commands) is types.DictType):
    commands = commands.copy()
    commands[dismiss_text] = dismiss_cmd
    commands[help_text] = help_cmd
  else:
    commands = list(commands) + [dismiss_cmd, help_cmd]

  button_list = ButtonList(parent, texts=texts, commands=commands, buttonBorderwidth=buttonBorderwidth,
                           expands=expands, direction=direction, *args, **kw)
  
  
  if not dismiss_text:
    button_list.cancelIcon = Tkinter.PhotoImage(file=os.path.join(gfxDir,'cancel.gif'))
    button_list.buttons[-2].config(image=button_list.cancelIcon, activebackground=button_list.cget('bg'))
  
  if not help_text:
    button_list.helpIcon   = Tkinter.PhotoImage(file=os.path.join(gfxDir,'help.gif'))
    button_list.buttons[-1].config(image=button_list.helpIcon, activebackground=button_list.cget('bg'))
    

  return button_list
Exemplo n.º 4
0
    def __init__(self,
                 parent,
                 webBrowser=None,
                 helpUrl=None,
                 helpMsg=None,
                 doClone=True,
                 doHelp=True,
                 doClose=True,
                 cloneText=None,
                 helpText=None,
                 closeText=None,
                 cloneCmd=None,
                 helpCmd=None,
                 closeCmd=None,
                 *args,
                 **kw):

        self.helpUrl = helpUrl
        self.helpMsg = helpMsg
        self.popup = getPopup(parent)

        if not isinstance(self.popup, BasePopup):
            self.popup = None

        if self.popup and not webBrowser:

            webBrowser = WebBrowser(self.popup.parent, popup=self.popup)

        self.webBrowser = webBrowser

        _commands = []
        _texts = []
        _images = []

        _doActions = [
            (doClone, cloneCmd, self.clonePopup, cloneText, 'twoWindows.gif'),
            (doHelp, helpCmd, self.launchHelp, helpText, 'help.gif'),
            (doClose, closeCmd, self.closePopup, closeText, 'cancel.gif')
        ]

        for doAction, userCmd, defaultCmd, text, imageFile in _doActions:
            if doAction:
                _commands.append(userCmd or defaultCmd)

                if text:
                    _texts.append(text)
                    _images.append(None)
                else:
                    icon = Tkinter.PhotoImage(
                        file=os.path.join(GFX_DIR, imageFile))
                    _texts.append('')
                    _images.append(icon)

        # Needed for photoimage reference count/persistence
        self.icons = [img for img in _images if img]

        images = kw.get('images')
        if images:
            kw['images'] = images + _images
        else:
            kw['images'] = [None] * len(kw.get('texts', [])) + _images

        kw['commands'] = kw.get('commands', []) + _commands
        kw['texts'] = kw.get('texts', []) + _texts

        ButtonList.__init__(self, parent, *args, **kw)
Exemplo n.º 5
0
    def __init__(self,
                 parent,
                 webBrowser=None,
                 helpUrl=None,
                 helpMsg=None,
                 doClone=True,
                 doHelp=True,
                 doClose=True,
                 cloneText=None,
                 helpText=None,
                 closeText=None,
                 cloneCmd=None,
                 helpCmd=None,
                 closeCmd=None,
                 cloneTip=None,
                 helpTip=None,
                 closeTip=None,
                 *args,
                 **kw):

        self.helpUrl = helpUrl
        self.helpMsg = helpMsg
        self.popup = getPopup(parent)

        cloneTip = cloneTip or Doc.cloneDoc.documentation
        helpTip = helpTip or Doc.helpDoc.documentation

        if not closeTip:  # a bit of a hack, this
            if closeText == 'Cancel':
                closeTip = Doc.cancelDoc.documentation
            else:
                closeTip = Doc.closeDoc.documentation

        cloneKey = cloneText or Doc.cloneDoc.name
        helpKey = helpText or Doc.helpDoc.name
        closeKey = closeText or Doc.closeDoc.name

        if not isinstance(self.popup, BasePopup):
            self.popup = None

        if self.popup and not webBrowser:

            webBrowser = WebBrowser(self.popup.parent, popup=self.popup)

        self.webBrowser = webBrowser

        _commands = []
        _texts = []
        _images = []
        _docKeys = []
        _tipTexts = []

        _doActions = [
            (doClone, cloneCmd, self.clonePopup, cloneText, 'twoWindows.gif',
             cloneTip, cloneKey),
            (doHelp, helpCmd, self.launchHelp, helpText, 'help.gif', helpTip,
             helpKey),
            (doClose, closeCmd, self.closePopup, closeText, 'cancel.gif',
             closeTip, closeKey),
        ]

        for doAction, userCmd, defaultCmd, text, imageFile, tipText, docKey in _doActions:
            if doAction:
                _commands.append(userCmd or defaultCmd)
                _docKeys.append(docKey)
                _tipTexts.append(tipText)

                if text:
                    _texts.append(text)
                    _images.append(None)
                else:
                    icon = Tkinter.PhotoImage(
                        file=os.path.join(GFX_DIR, imageFile))
                    _texts.append('')
                    _images.append(icon)

        # Needed for photoimage reference count/persistence
        self.icons = [img for img in _images if img]

        images = kw.get('images')
        if images:
            kw['images'] = images + _images
        else:
            kw['images'] = [None] * len(kw.get('texts', [])) + _images

        texts = kw.get('texts', [])
        commands = kw.get('commands', [])
        docKeys = kw.get('docKeys') or [None] * max(
            [len(texts), len(commands)])
        tipTexts = kw.get('tipTexts') or [None] * max(
            [len(texts), len(commands)])

        kw['docKeys'] = docKeys + _docKeys
        kw['tipTexts'] = tipTexts + _tipTexts
        kw['commands'] = commands + _commands
        kw['texts'] = texts + _texts

        ButtonList.__init__(self, parent, *args, **kw)
Exemplo n.º 6
0
    def __init__(self, parent, project, utilityButtons=False, *args, **kw):

        self.project = project
        self.waiting = False
        self.dataStore = None
        Frame.__init__(self, parent, *args, **kw)

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

        tipTexts = [
            'Row number',
            'Location of the absolute path directory, that may contain multiple spectrum files',
            'Location of spectrum file relative to its absolute path directory',
            'Identity of the spectrum as experiment:spectrum'
        ]

        headingList = [
            '#', 'Absolute Path', 'Relative Path\nand File',
            'Spectrum / FID / Image'
        ]
        editWidgets = [None, None, None, None]
        editGetCallbacks = [None, self.getDataUrl, self.getDataPath, None]
        editSetCallbacks = [None, None, None, None]

        self.dataStoreTable = ScrolledMatrix(
            self,
            headingList=headingList,
            tipTexts=tipTexts,
            callback=self.selectDataStore,
            editWidgets=editWidgets,
            multiSelect=True,
            editGetCallbacks=editGetCallbacks,
            editSetCallbacks=editSetCallbacks,
            ###deleteFunc=self.deleteDataStores,
            grid=(0, 0))

        texts = [
            'Propagate\nAbsolute Path', 'Shift Directory\nTo Absolute Path',
            'Shift Directory\nTo Relative Path'
        ]
        tipTexts = [
            'Copy absolute path from last row selected to other selected spectra',
            'Shift the top directory from the relative path to the absolute path',
            'Shift the bottom directory from the absolute path to the relative path'
        ]
        commands = [
            self.propagatePath, self.moveDirToAbsolute, self.moveDirToRelative
        ]

        isModal = False
        popup = getPopup(parent)
        if popup:
            isModal = popup.modal

        if utilityButtons:
            if isModal:
                texts = [
                    'All Done!',
                ] + texts
                tipTexts = ['Close the popup, satisfied that paths are OK'
                            ] + tipTexts
                commands = [
                    popup.close,
                ] + commands
            self.buttonList = UtilityButtonList(self,
                                                texts=texts,
                                                commands=commands,
                                                tipTexts=tipTexts,
                                                doClone=False,
                                                grid=(1, 0))
            if isModal:
                self.buttonList.buttons[0].config(bg='#B0FFB0')
        else:
            self.buttonList = ButtonList(self,
                                         texts=texts,
                                         commands=commands,
                                         grid=(1, 0),
                                         tipTexts=tipTexts)

        self.updateAfter()
Exemplo n.º 7
0
    def showFormats(self):

        popup = getPopup(self)

        message = """For chemical shifts, the following formats are recognised:

*** Auremol ***

section_sequenzdefinition
_Residue_seq_code
_Atom_num_code
_Residue_label
_Atom_name
_Atom_type
_Atom_alias
_Atom_equivalent
_Atom_CSA
  1   1 MET   HN H   -      -            8.95
  1   2 MET    N N   -      -          157.00
  1   3 MET   CA C   -      -           40.00


*** Autoassign ***

AA        HN    N15    CO-1   CA-1   CB-1   HA-1          CO     CA     CB     HA

A31      8.14  121.4                                            51.3   19.6                 (GS178 115.HSQC)
D32      8.88  122.9          51.3   19.5                       55.4   39.6                 (GS271 22.HSQC)


*** CNS ***

do ( store1 = 53.13218 ) ( resid 78 and name CA )
do ( store1 = 0.7356673 ) ( resid 15 and name HD1# )
do ( store1 = 120.5381 ) ( resid 8 and name N )
do ( store1 = 121.1414 ) ( resid 78 and name N )


*** Cosmos ***

CS_VALUES 3
C_ALA 176.6
CA_ALA 51.66
CB_ALA 17.26
END


*** CSI ***

#     A       HA       CA       CO       CB       Consensus
#
1     MET       0 C      0 C      NA       0 C         0 C 
2     GLY       0 C      0 C      NA       0 C         0 C 


*** MARS ***

            H         N         CO-1      CA        CA-1   
PR_2        8.900   123.220   170.540    55.080    54.450  
PR_4        8.320   115.340   175.920      -       55.080  


*** MONTE ***

         1            102.544      8.211     45.853     54.925      0.000     18.069    180.112 
         2            103.276      8.580     45.334     54.154      0.000     35.650    175.087 
         3            103.997      7.407     45.165      0.000      0.000      0.000      0.000 


*** NMR-STAR ***

data_test

save_shifts1
   _Saveframe_category               assigned_chemical_shifts

   loop_
      _Atom_shift_assign_ID
      _Residue_seq_code
      _Residue_label
      _Atom_name
      _Atom_type
      _Chem_shift_value
      _Chem_shift_value_error
      _Chem_shift_ambiguity_code

          1     1   ASP  CA    C   52.000  0.02  1  
          2     1   ASP  HA    H    4.220  0.02  1  

   stop_

save_


*** NMRVIEW ***

  2.CG1     18.549 0
  2.CG2     18.844 0
  2.HG1#     0.800 0
  2.HG2#     0.723 0
  3.HG2      2.298 0
  3.HG1      2.298 0


*** PIPP ***

RES_ID          1
RES_TYPE        MET
SPIN_SYSTEM_ID  1
    CA        55.9920
    CB        33.1470
    HA         4.1141
    HB#        2.0492
    HG#        2.4250
END_RES_DEF


*** PISTACHIO ***

   1    1  GLY    C     C  172.621  1.000  0 
   2    1  GLY   CA     C   44.308  1.000  0 
   3    2  SER    N     N  122.241  1.000  0 


*** PRONTO ***

Spin system   HN          HA      Other:

1: Val-1                  3.76    HB: 1.945, HG1: 0.770, HG2: 0.608
2: Ile-2      8.80        4.26    HB: 1.526, HG1: 1.278, HG2: 0.728, HD: 0.918


*** SHIFTX ***

  NUM RES   HA     H       N        CA      CB       C
--- --- ------ ------ -------- ------- ------- --------
 2     T  4.4161 8.1749 111.0443 61.8324 70.3867 172.5362
 3     Y  4.9022 9.0239 120.2106 56.0493 41.4218 173.0761

 NUM RES  H    HA   HB   HB2  HB3  HD1  HD2  HD21 HD22 HD3  HE   HE1 HE2  HE21 HE22 HE3  HG   HG1  HG12 HG13 HG2  HG3  HZ
 2     T  8.17 4.42 4.24 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 1.21 0.00 0.00
 3     Y  9.02 4.90 0.00 2.22 2.20 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00


*** SPARKY ***

 Group   Atom  Nuc    Shift   SDev  Assignments

     R2     CA  13C   56.539  0.003      3
     R2     CB  13C   30.808  0.009      3


*** TALOS ***

VARS   RESID RESNAME PHI PSI DPHI DPSI DIST COUNT CLASS
FORMAT %4d %s %8.3f %8.3f %8.3f %8.3f %8.3f %2d %s

   1 Q 9999.000 9999.000    0.000    0.000    0.000  0 None
   2 N  -85.000  124.000   23.000   28.000   85.920 10 Good


***XEASY/CYANA:

   1 117.803 0.000 N       1
   2   8.208 0.002 HN      1
   3  56.508 0.055 CA      1
   4 999.000 0.000 HA      1
   5  29.451 0.004 CB      1
    
    """

        showHelpText(self, message, popup=popup)