Ejemplo n.º 1
0
def storeMenuItem(menuItem, resetLabel=False, ignoreDensity=False):
    """Store the "Rotamerize existing structure..." and "Rotamerize without density..." menu entries so that we can later change them to "Cancel current rotamerize..."
    
    ARGUMENTS:
        menuItem   - the gtk MenuItem to store
    OPTIONAL ARGUMENTS:
        resetLabel    - whether we should reset the menu label to "Rotamerize existing structure..."
                        (and also clear all pending atom picks in Coot)
                        This is intended for use when we're reloading RCrane
                        Defaults to False
        ignoreDensity - whether this is the menu entry for "Rotamerize without density..."
    RETURNS:
        None
    EFFECTS:
        stores menuItem in the module-level variable __menuItem
    """

    if ignoreDensity:
        global __menuItemNoDensity
        __menuItemNoDensity = menuItem
    else:
        global __menuItem
        __menuItem = menuItem

    #if we're being called during an RCrane reload, then reset everything back to the appropriate starting position
    global waitingForClicks
    if resetLabel:
        waitingForClicks = False  #this is redundant with module initialization, but can't hurt to do
        #in case this function is called in an unexpected way
        __setMenuToRotamerize()
        clear_pending_picks()
Ejemplo n.º 2
0
def storeMenuItem(menuItem, resetLabel = False, ignoreDensity = False):
    """Store the "Rotamerize existing structure..." and "Rotamerize without density..." menu entries so that we can later change them to "Cancel current rotamerize..."
    
    ARGUMENTS:
        menuItem   - the gtk MenuItem to store
    OPTIONAL ARGUMENTS:
        resetLabel    - whether we should reset the menu label to "Rotamerize existing structure..."
                        (and also clear all pending atom picks in Coot)
                        This is intended for use when we're reloading RCrane
                        Defaults to False
        ignoreDensity - whether this is the menu entry for "Rotamerize without density..."
    RETURNS:
        None
    EFFECTS:
        stores menuItem in the module-level variable __menuItem
    """
    
    if ignoreDensity:
        global __menuItemNoDensity
        __menuItemNoDensity = menuItem
    else:
        global __menuItem
        __menuItem = menuItem
    
    #if we're being called during an RCrane reload, then reset everything back to the appropriate starting position
    global waitingForClicks
    if resetLabel:
        waitingForClicks = False #this is redundant with module initialization, but can't hurt to do
                                 #in case this function is called in an unexpected way
        __setMenuToRotamerize()
        clear_pending_picks()
Ejemplo n.º 3
0
def pickAtoms(ignoreDensity=False):
    """Prompt the user to pick two atoms to rotamerize a stretch of nucleotides.  Alternatively, if
    we're already waiting for the user to pick atoms, then cancel the pending picks.
    
    ARGUMENTS:
        None
    OPTIONAL ARGUMENTS:
        ignoreDensity - ignore the density when performing the minimization
                        defaults to False
    RETURNS:
        None
    """

    #create the citation pop-up if necessary
    createCitationPopup()

    global waitingForClicks

    #make sure that we're not waiting on a pending extendChain call
    extendChain.clearPendingExtendChain()

    if waitingForClicks:
        #if we're already in the middle of a rotamerize call, then cancel the pending rotamerize
        print "Rotamerize cancelled"
        add_status_bar_text("Rotamerize cancelled")
        clear_pending_picks(
        )  #tell Coot to stop waiting for the user to click on atoms
        __setMenuToRotamerize()
        waitingForClicks = False

    else:
        #if we're not in the middle of a rotamerize call, then start one

        #make sure that there is a refinement map set
        if not ignoreDensity and imol_refinement_map() == -1:
            print "No refinement map set for RCrane rotamerize"
            selectMapDialog(pickAtoms)
            return

        print "Click on 2 atoms (in the same molecule)"
        add_status_bar_text(
            "Pick 2 atoms [Ctrl Left-mouse rotates the view]...")
        __setMenuToCancel()
        waitingForClicks = True
        user_defined_click(
            2, lambda atomSpec1, atomSpec2: rotamerizeFromAtomSpecs(
                atomSpec1, atomSpec2, ignoreDensity))
Ejemplo n.º 4
0
def pickAtoms(ignoreDensity = False):
    """Prompt the user to pick two atoms to rotamerize a stretch of nucleotides.  Alternatively, if
    we're already waiting for the user to pick atoms, then cancel the pending picks.
    
    ARGUMENTS:
        None
    OPTIONAL ARGUMENTS:
        ignoreDensity - ignore the density when performing the minimization
                        defaults to False
    RETURNS:
        None
    """
    
    #create the citation pop-up if necessary
    createCitationPopup()
    
    global waitingForClicks
    
    #make sure that we're not waiting on a pending extendChain call
    extendChain.clearPendingExtendChain()
    
    if waitingForClicks:
        #if we're already in the middle of a rotamerize call, then cancel the pending rotamerize
        print "Rotamerize cancelled"
        add_status_bar_text("Rotamerize cancelled")
        clear_pending_picks() #tell Coot to stop waiting for the user to click on atoms
        __setMenuToRotamerize()
        waitingForClicks = False
    
    else:
        #if we're not in the middle of a rotamerize call, then start one
        
        #make sure that there is a refinement map set
        if not ignoreDensity and imol_refinement_map() == -1:
            print "No refinement map set for RCrane rotamerize"
            selectMapDialog(pickAtoms)
            return
        
        print "Click on 2 atoms (in the same molecule)"
        add_status_bar_text("Pick 2 atoms [Ctrl Left-mouse rotates the view]...")
        __setMenuToCancel()
        waitingForClicks = True
        user_defined_click(2, lambda atomSpec1, atomSpec2: rotamerizeFromAtomSpecs(atomSpec1, atomSpec2, ignoreDensity))
Ejemplo n.º 5
0
def pickAtoms():
    """Prompt the user to pick an atoms to extend a stretch of nucleotides.  Alternatively, if
    we're already waiting for the user to pick an atom, then cancel the pending pick.
    
    ARGUMENTS:
        None
    RETURNS:
        None
    """

    #create the citation pop-up if necessary
    createCitationPopup()

    #make sure that we're not waiting on a pending rotamerize call
    rotamerize.clearPendingRotamerize()

    global waitingForClicks

    if waitingForClicks:
        #if we're already in the middle of an extend chain call, then cancel the pending call
        print "Rotamerize cancelled"
        add_status_bar_text("Extend chain cancelled")
        clear_pending_picks(
        )  #tell Coot to stop waiting for the user to click on atoms
        __setMenuToExtendChain()
        waitingForClicks = False

    else:
        #if we're not in the middle of a extend chain call, then start one

        #make sure that there is a refinement map set
        if imol_refinement_map() == -1:
            print "No refinement map set for RCrane extend chain"
            selectMapDialog(pickAtoms)
            return

        print "Click on a nucleotide to extend"
        add_status_bar_text(
            "Pick a nucleotide [Ctrl Left-mouse rotates the view]...")
        __setMenuToCancel()
        waitingForClicks = True
        user_defined_click(1, extendChainFromAtomSpec)
Ejemplo n.º 6
0
def clearPendingExtendChain():
    """Cancel any pending extend chain call (intended to be called by rotamerize)
    
    ARGUMENTS:
        None
    RETURNS:
        True if there was a pending extend chain call
        False otherwise
    """
    
    global waitingForClicks
    
    if waitingForClicks:
        #if we're already in the middle of a extend chain call, then cancel the pending extend chain
        print "Extend chain cancelled"
        clear_pending_picks() #tell Coot to stop waiting for the user to click on atoms
        __setMenuToExtendChain()
        waitingForClicks = False
        return True
    else:
        return False
Ejemplo n.º 7
0
def pickAtoms():
    """Prompt the user to pick an atoms to extend a stretch of nucleotides.  Alternatively, if
    we're already waiting for the user to pick an atom, then cancel the pending pick.
    
    ARGUMENTS:
        None
    RETURNS:
        None
    """
    
    #create the citation pop-up if necessary
    createCitationPopup()
    
    #make sure that we're not waiting on a pending rotamerize call
    rotamerize.clearPendingRotamerize()
    
    global waitingForClicks
    
    if waitingForClicks:
        #if we're already in the middle of an extend chain call, then cancel the pending call
        print "Rotamerize cancelled"
        add_status_bar_text("Extend chain cancelled")
        clear_pending_picks() #tell Coot to stop waiting for the user to click on atoms
        __setMenuToExtendChain()
        waitingForClicks = False
    
    else:
        #if we're not in the middle of a extend chain call, then start one
        
        #make sure that there is a refinement map set
        if imol_refinement_map() == -1:
            print "No refinement map set for RCrane extend chain"
            selectMapDialog(pickAtoms)
            return
        
        print "Click on a nucleotide to extend"
        add_status_bar_text("Pick a nucleotide [Ctrl Left-mouse rotates the view]...")
        __setMenuToCancel()
        waitingForClicks = True
        user_defined_click(1, extendChainFromAtomSpec)
Ejemplo n.º 8
0
def clearPendingRotamerize():
    """Cancel any pending rotamerize call (intended to be called by extendChain)
    
    ARGUMENTS:
        None
    RETURNS:
        True if there was a pending rotamerize call
        False otherwise
    """

    global waitingForClicks

    if waitingForClicks:
        #if we're already in the middle of a rotamerize call, then cancel the pending rotamerize
        print "Rotamerize cancelled"
        clear_pending_picks(
        )  #tell Coot to stop waiting for the user to click on atoms
        __setMenuToRotamerize()
        waitingForClicks = False
        return True
    else:
        return False
Ejemplo n.º 9
0
def storeMenuItem(menuItem, resetLabel = False):
    """ARGUMENTS:
        menuItem   - the gtk MenuItem to store
    OPTIONAL ARGUMENTS:
        resetLabel    - whether we should reset the menu label to "Extend chain..."
                        (and also clear all pending atom picks in Coot)
                        This is intended for use when we're reloading RCrane
                        Defaults to False
    RETURNS:
        None
    EFFECTS:
        stores menuItem in the module-level variable __menuItem
    """
    
    global __menuItem
    __menuItem = menuItem
    
    #if we're being called during an RCrane reload, then reset everything back to the appropriate starting position
    global waitingForClicks
    if resetLabel:
        waitingForClicks = False #this is redundant with module initialization, but can't hurt to do
                                 #in case this function is called in an unexpected way
        __setMenuToExtendChain()
        clear_pending_picks()
Ejemplo n.º 10
0
def storeMenuItem(menuItem, resetLabel=False):
    """ARGUMENTS:
        menuItem   - the gtk MenuItem to store
    OPTIONAL ARGUMENTS:
        resetLabel    - whether we should reset the menu label to "Extend chain..."
                        (and also clear all pending atom picks in Coot)
                        This is intended for use when we're reloading RCrane
                        Defaults to False
    RETURNS:
        None
    EFFECTS:
        stores menuItem in the module-level variable __menuItem
    """

    global __menuItem
    __menuItem = menuItem

    #if we're being called during an RCrane reload, then reset everything back to the appropriate starting position
    global waitingForClicks
    if resetLabel:
        waitingForClicks = False  #this is redundant with module initialization, but can't hurt to do
        #in case this function is called in an unexpected way
        __setMenuToExtendChain()
        clear_pending_picks()