Example #1
0
    def execute( self, notification ) :
        proxy = self.facade.retrieveProxy( RunningStateProxy.NAME )
        settings = proxy.getData()[ PairwiseSelectorVO.VONAME ]
        data = proxy.getData()[ DataSelectorVO.VONAME ]
        matrix = proxy.getData()[ MatrixFileVO.VONAME ].matrix

        if settings.analysisBoxValue == 'Affine':
            try :
                openGap = int( settings.openGapValue )
            except ValueError :
                openGap = StaticStateProxy.DEFAULT_OPEN_PENALTY

            try :
                extendGap = int( settings.extendedGapValue )
            except ValueError :
                extendGap = StaticStateProxy.DEFAULT_EXT_PENALTY
                
            result = Sequencing.affineSequence( 1, openGap, extendGap, matrix, data.sequenceOne, data.sequenceTwo )
        else :
            try :
                gapPenalty = int( settings.gapPenaltyValue )
            except ValueError :
                gapPenalty = StaticStateProxy.DEFAULT_GAP_PENALTY

            if settings.analysisBoxValue == 'Global':
                useGlobal = 1
            else :
                useGlobal = 0

            result = Sequencing.linearSequence( useGlobal, gapPenalty, matrix, data.sequenceOne, data.sequenceTwo )
            
        self.sendNotification( Messages.SHOW_RESULTS, result )
        self.sendNotification( Messages.UPDATE_STATUS_TEXT, 'Sequences successfully aligned.' )
Example #2
0
    def execute( self, notification ) :
        proxy = self.facade.retrieveProxy( RunningStateProxy.NAME )
        state = proxy.getData()[PairwiseSelectorVO.VONAME]
        matrix = MatrixFileVO()

        if notification.getName() == Messages.GET_CUSTOM_SUB_MATRIX :
            matrixFile = state.matrixFileValue
        else :
            fileName = self.facade.retrieveProxy( StaticStateProxy.NAME )
            matrixFile = fileName.getData()[state.matrixBoxValue]
            
        if matrixFile is not None :
            try :
                matrix.matrix = Sequencing.loadSubstitutionMatrix( matrixFile )
                # TODO determine what other kinds of errors could be thrown by the matrix file creation.
            except IOError:
                if matrixFile != None :
                    message = "Unable to open the file: " + matrixFile + " please try another."
                else :
                    message = "Unable to open a null file."
                title = 'Data Not Set Error'
                self.sendNotification( Messages.SHOW_INFO, ( title, message ) )
            else :
                #TODO determine if there is clean up code required to be handled.
                pass
        proxy.setData( matrix )
Example #3
0
    def execute(self, notification):
        proxy = self.facade.retrieveProxy(RunningStateProxy.NAME)
        state = proxy.getData()[PairwiseSelectorVO.VONAME]
        matrix = MatrixFileVO()

        if notification.getName() == Messages.GET_CUSTOM_SUB_MATRIX:
            matrixFile = state.matrixFileValue
        else:
            fileName = self.facade.retrieveProxy(StaticStateProxy.NAME)
            matrixFile = fileName.getData()[state.matrixBoxValue]

        if matrixFile is not None:
            try:
                matrix.matrix = Sequencing.loadSubstitutionMatrix(matrixFile)
                # TODO determine what other kinds of errors could be thrown by the matrix file creation.
            except IOError:
                if matrixFile != None:
                    message = "Unable to open the file: " + matrixFile + " please try another."
                else:
                    message = "Unable to open a null file."
                title = 'Data Not Set Error'
                self.sendNotification(Messages.SHOW_INFO, (title, message))
            else:
                #TODO determine if there is clean up code required to be handled.
                pass
        proxy.setData(matrix)
Example #4
0
    def execute( self, notification ) :
        proxy = self.facade.retrieveProxy( RunningStateProxy.NAME )
        scoreMatrix = proxy.getData()[ ScoreMatrixResultVO.VONAME ]
        settings = proxy.getData()[ PairwiseSelectorVO.VONAME ]
        scores = scoreMatrix.result
        names = scoreMatrix.names
        
        result = Sequencing.constructNewickTree( scores, names )

        self.sendNotification( Messages.SHOW_RESULTS, result )
        if settings.useForester :
            self.sendNotification( Messages.SHOW_TREE_GRAPHICALLY, result )
Example #5
0
    def execute(self, notification):
        proxy = self.facade.retrieveProxy(RunningStateProxy.NAME)
        scoreMatrix = proxy.getData()[ScoreMatrixResultVO.VONAME]
        settings = proxy.getData()[PairwiseSelectorVO.VONAME]
        scores = scoreMatrix.result
        names = scoreMatrix.names

        result = Sequencing.constructNewickTree(scores, names)

        self.sendNotification(Messages.SHOW_RESULTS, result)
        if settings.useForester:
            self.sendNotification(Messages.SHOW_TREE_GRAPHICALLY, result)
Example #6
0
    def execute(self, notification):
        proxy = self.facade.retrieveProxy(RunningStateProxy.NAME)
        settings = proxy.getData()[PairwiseSelectorVO.VONAME]
        data = proxy.getData()[DataSelectorVO.VONAME]
        matrix = proxy.getData()[MatrixFileVO.VONAME].matrix

        if settings.analysisBoxValue == 'Affine':
            try:
                openGap = int(settings.openGapValue)
            except ValueError:
                openGap = StaticStateProxy.DEFAULT_OPEN_PENALTY

            try:
                extendGap = int(settings.extendedGapValue)
            except ValueError:
                extendGap = StaticStateProxy.DEFAULT_EXT_PENALTY

            result = Sequencing.affineSequence(1, openGap, extendGap, matrix,
                                               data.sequenceOne,
                                               data.sequenceTwo)
        else:
            try:
                gapPenalty = int(settings.gapPenaltyValue)
            except ValueError:
                gapPenalty = StaticStateProxy.DEFAULT_GAP_PENALTY

            if settings.analysisBoxValue == 'Global':
                useGlobal = 1
            else:
                useGlobal = 0

            result = Sequencing.linearSequence(useGlobal, gapPenalty, matrix,
                                               data.sequenceOne,
                                               data.sequenceTwo)

        self.sendNotification(Messages.SHOW_RESULTS, result)
        self.sendNotification(Messages.UPDATE_STATUS_TEXT,
                              'Sequences successfully aligned.')
Example #7
0
def doAffinePairwise(openGap, extendGap, matrix, sequenceOne, sequenceTwo):
    # elements 0 and 1 of the return value of the affine sequence are the strings ith gaps inserted.
    score = Sequencing.affineSequence(1, openGap, extendGap, matrix,
                                      sequenceOne, sequenceTwo)[2]
    return score
Example #8
0
def doLinearPairwise(useGlobal, gapPenalty, matrix, sequenceOne, sequenceTwo):
    # elements 0 and 1 of the return value of the linear sequence are the strings ith gaps inserted.
    score = Sequencing.linearSequence(useGlobal, gapPenalty, matrix,
                                      sequenceOne, sequenceTwo)[2]
    return score
Example #9
0
def doAffinePairwise( openGap, extendGap, matrix, sequenceOne, sequenceTwo ) :
    # elements 0 and 1 of the return value of the affine sequence are the strings ith gaps inserted.
    score = Sequencing.affineSequence( 1, openGap, extendGap, matrix, sequenceOne, sequenceTwo )[ 2 ]
    return score
Example #10
0
def doLinearPairwise( useGlobal, gapPenalty, matrix, sequenceOne, sequenceTwo ) :
    # elements 0 and 1 of the return value of the linear sequence are the strings ith gaps inserted.
    score = Sequencing.linearSequence( useGlobal, gapPenalty, matrix, sequenceOne, sequenceTwo )[ 2 ]
    return score