コード例 #1
0
    def setProcessList( self, processList ):
        '''
        set and detect a pathway
        processList: (list) a list of process full ID
        '''

        # check the existence of processes,
        # and create relatedVariableList
        self.__processList = []
        self.__variableList = []

        for processFullID in processList:
            
#            if not self.theEmlSupport.isEntityExist( processFullID ):
#                continue

            self.__processList.append( processFullID )
            
            try:
                aVariableReferenceList = self.theEmlSupport.getEntityProperty( processFullID + ':VariableReferenceList' )

            except AttributeError, e:
                continue
            
            for aVariableReference in aVariableReferenceList:
                fullID = createVariableReferenceFullID( aVariableReference[ 1 ], processFullID )
                fullIDString = ecell.ecssupport.createFullIDString( fullID )

                if self.__variableList.count( fullIDString ) == 0:
                    self.__variableList.append( fullIDString )
コード例 #2
0
    def addVariable( self, variableFullID ):
        '''
        recover a removed variable to the pathway
        variableFullID: (str) a variable full ID
        '''

        if not self.__variableList.count( variableFullID ) == 0:
            return 1
#        elif not ecell.eml.Eml.isEntityExist( variableFullID ):
#            return 0

        for processFullID in self.__processList:

            try:
                aVariableReferenceList = self.theEmlSupport.getEntityProperty( processFullID + ':VariableReferenceList' )

            except AttributeError, e:
                continue
            
            for aVariableReference in aVariableReferenceList:
                fullID = createVariableReferenceFullID( aVariableReference[ 1 ], processFullID )
                fullIDString = fullID[ 1 ] + ':' + fullID[ 2 ]

                if fullIDString == variableFullID:
                    self.__variableList.append( variableFullID )
                    self.__variableList.sort()
                    return 1
コード例 #3
0
    def getStoichiometryMatrix( self ):
        '''
        create the stoichiometry matrix (array)
        return stoichiometryMatrix
        '''

        stoichiometryMatrix = numpy.zeros( ( len( self.__variableList ), len( self.__processList ) ), float )

        for j in range( len( self.__processList ) ):

            processFullID = self.__processList[ j ]

            try:
                aVariableReferenceList = self.theEmlSupport.getEntityProperty( processFullID + ':VariableReferenceList' )

            except AttributeError, e:
                continue
            
            for aVariableReference in aVariableReferenceList:
                fullID = createVariableReferenceFullID( aVariableReference[ 1 ], processFullID )
                fullIDString = ecell.ecssupport.createFullIDString( fullID )

                try:
                    i = self.__variableList.index( fullIDString )
                except ValueError:
                    # should some warning message be showed?
                    continue

                if len( aVariableReference ) > 2:
                    coeff = int( aVariableReference[ 2 ] )
                    if coeff != 0:
                        stoichiometryMatrix[ i ][ j ] += coeff
コード例 #4
0
ファイル: PathwayProxy.py プロジェクト: ecell/ecell3
    def setProcessList( self, processList ):
        '''
        set and detect a pathway
        processList: (list) a list of process full ID
        '''

        # check the existence of processes,
        # and create relatedVariableList
        self.__processList = []
        self.__variableList = []

        for processFullID in processList:
            
#            if not self.theEmlSupport.isEntityExist( processFullID ):
#                continue

            self.__processList.append( processFullID )
            
            try:
                aVariableReferenceList = self.theEmlSupport.getEntityProperty( processFullID + ':VariableReferenceList' )

            except AttributeError, e:
                continue
            
            for aVariableReference in aVariableReferenceList:
                fullID = createVariableReferenceFullID( aVariableReference[ 1 ], processFullID )
                fullIDString = ecell.ecssupport.createFullIDString( fullID )

                if self.__variableList.count( fullIDString ) == 0:
                    self.__variableList.append( fullIDString )
コード例 #5
0
    def removeProcess( self, processIndexList ):
        '''
        remove processes from the pathway
        processIndexList: (list) a list of indices of processes
        '''

        indexList = copy.copy( processIndexList )
        indexList.sort()
        indexList.reverse()

        removedProcessList = []
        for i in indexList:
            if len( self.__processList ) > i:
                removedProcessList.append( self.__processList.pop( i ) )

        removedVariableList = []
        for processFullID in removedProcessList:

#            if not ecell.eml.Eml.isEntityExist( self.theEmlSupport, processFullID ):
#                continue
            
            try:
                aVariableReferenceList = self.theEmlSupport.getEntityProperty( processFullID + ':VariableReferenceList' )

            except AttributeError, e:
                continue
            
            for aVariableReference in aVariableReferenceList:
                fullID = createVariableReferenceFullID( aVariableReference[ 1 ], processFullID )
                fullIDString = ecell.ecssupport.createFullIDString( fullID )

                if removedVariableList.count( fullIDString ) == 0:
                    removedVariableList.append( fullIDString )
コード例 #6
0
ファイル: PathwayProxy.py プロジェクト: ecell/ecell3
    def getStoichiometryMatrix( self ):
        '''
        create the stoichiometry matrix (array)
        return stoichiometryMatrix
        '''

        stoichiometryMatrix = numpy.zeros( ( len( self.__variableList ), len( self.__processList ) ), float )

        for j in range( len( self.__processList ) ):

            processFullID = self.__processList[ j ]

            try:
                aVariableReferenceList = self.theEmlSupport.getEntityProperty( processFullID + ':VariableReferenceList' )

            except AttributeError, e:
                continue
            
            for aVariableReference in aVariableReferenceList:
                fullID = createVariableReferenceFullID( aVariableReference[ 1 ], processFullID )
                fullIDString = ecell.ecssupport.createFullIDString( fullID )

                try:
                    i = self.__variableList.index( fullIDString )
                except ValueError:
                    # should some warning message be showed?
                    continue

                if len( aVariableReference ) > 2:
                    coeff = int( aVariableReference[ 2 ] )
                    if coeff != 0:
                        stoichiometryMatrix[ i ][ j ] += coeff
コード例 #7
0
ファイル: PathwayProxy.py プロジェクト: ecell/ecell3
    def addVariable( self, variableFullID ):
        '''
        recover a removed variable to the pathway
        variableFullID: (str) a variable full ID
        '''

        if not self.__variableList.count( variableFullID ) == 0:
            return 1
#        elif not ecell.eml.Eml.isEntityExist( variableFullID ):
#            return 0

        for processFullID in self.__processList:

            try:
                aVariableReferenceList = self.theEmlSupport.getEntityProperty( processFullID + ':VariableReferenceList' )

            except AttributeError, e:
                continue
            
            for aVariableReference in aVariableReferenceList:
                fullID = createVariableReferenceFullID( aVariableReference[ 1 ], processFullID )
                fullIDString = fullID[ 1 ] + ':' + fullID[ 2 ]

                if fullIDString == variableFullID:
                    self.__variableList.append( variableFullID )
                    self.__variableList.sort()
                    return 1
コード例 #8
0
ファイル: PathwayProxy.py プロジェクト: ecell/ecell3
    def removeProcess( self, processIndexList ):
        '''
        remove processes from the pathway
        processIndexList: (list) a list of indices of processes
        '''

        indexList = copy.copy( processIndexList )
        indexList.sort()
        indexList.reverse()

        removedProcessList = []
        for i in indexList:
            if len( self.__processList ) > i:
                removedProcessList.append( self.__processList.pop( i ) )

        removedVariableList = []
        for processFullID in removedProcessList:

#            if not ecell.eml.Eml.isEntityExist( self.theEmlSupport, processFullID ):
#                continue
            
            try:
                aVariableReferenceList = self.theEmlSupport.getEntityProperty( processFullID + ':VariableReferenceList' )

            except AttributeError, e:
                continue
            
            for aVariableReference in aVariableReferenceList:
                fullID = createVariableReferenceFullID( aVariableReference[ 1 ], processFullID )
                fullIDString = ecell.ecssupport.createFullIDString( fullID )

                if removedVariableList.count( fullIDString ) == 0:
                    removedVariableList.append( fullIDString )
コード例 #9
0
ファイル: PathwayProxy.py プロジェクト: ktnyt/ecell3
    def getIncidentMatrix(self, mode=0):
        '''
        create the incident matrix (array)
        mode: (0 or 1) 0 means that only the \'write\' variables are checked. 0 is set as default.
        return incidentMatrix
        '''

        incidentMatrix = numpy.zeros(
            (len(self.__variableList), len(self.__processList)))

        for j in range(len(self.__processList)):

            processFullID = self.__processList[j]

            try:
                aVariableReferenceList = self.theEmlSupport.getEntityProperty(
                    processFullID + ':VariableReferenceList')

            except AttributeError, e:
                continue

            for aVariableReference in aVariableReferenceList:
                fullID = createVariableReferenceFullID(aVariableReference[1],
                                                       processFullID)
                fullIDString = ecell.ecssupport.createFullIDString(fullID)

                try:
                    i = self.__variableList.index(fullIDString)
                except ValueError:
                    # should some warning message be showed?
                    continue

                if mode:
                    if len(aVariableReference) > 2:
                        coeff = int(aVariableReference[2])
                        if coeff != 0:
                            incidentMatrix[i][j] = 1
                else:
                    incidentMatrix[i][j] = 1
コード例 #10
0
ファイル: PathwayProxy.py プロジェクト: ecell/ecell3
    def getIncidentMatrix( self, mode=0 ):
        '''
        create the incident matrix (array)
        mode: (0 or 1) 0 means that only the \'write\' variables are checked. 0 is set as default.
        return incidentMatrix
        '''

        incidentMatrix = numpy.zeros( ( len( self.__variableList ), len( self.__processList ) ) )

        for j in range( len( self.__processList ) ):

            processFullID = self.__processList[ j ]

            try:
                aVariableReferenceList = self.theEmlSupport.getEntityProperty( processFullID + ':VariableReferenceList' )

            except AttributeError, e:
                continue
                
            for aVariableReference in aVariableReferenceList:
                fullID = createVariableReferenceFullID( aVariableReference[ 1 ], processFullID )
                fullIDString = ecell.ecssupport.createFullIDString( fullID )

                try:
                    i = self.__variableList.index( fullIDString )
                except ValueError:
                    # should some warning message be showed?
                    continue

                if mode:
                    if len( aVariableReference ) > 2:
                        coeff = int( aVariableReference[ 2 ] )
                        if coeff != 0:
                            incidentMatrix[ i ][ j ] = 1
                else:
                    incidentMatrix[ i ][ j ] = 1
コード例 #11
0
#        elif not ecell.eml.Eml.isEntityExist( processFullID ):
#            return

        # add process
        self.__processList.append( processFullID )
        self.__processList.sort()

        # update the related variable list
        try:
            aVariableReferenceList = self.theEmlSupport.getEntityProperty( processFullID + ':VariableReferenceList' )

        except AttributeError, e:
            return
        
        for aVariableReference in aVariableReferenceList:
            fullID = createVariableReferenceFullID( aVariableReference[ 1 ], processFullID )
            fullIDString = ecell.ecssupport.createFullIDString( fullID )

            if self.__variableList.count( fullIDString ) == 0:
                self.__variableList.append( fullIDString )

        self.__variableList.sort()

    # end of addProcess

    
    def removeProcess( self, processIndexList ):
        '''
        remove processes from the pathway
        processIndexList: (list) a list of indices of processes
        '''
コード例 #12
0
ファイル: PathwayProxy.py プロジェクト: ecell/ecell3
#        elif not ecell.eml.Eml.isEntityExist( processFullID ):
#            return

        # add process
        self.__processList.append( processFullID )
        self.__processList.sort()

        # update the related variable list
        try:
            aVariableReferenceList = self.theEmlSupport.getEntityProperty( processFullID + ':VariableReferenceList' )

        except AttributeError, e:
            return
        
        for aVariableReference in aVariableReferenceList:
            fullID = createVariableReferenceFullID( aVariableReference[ 1 ], processFullID )
            fullIDString = ecell.ecssupport.createFullIDString( fullID )

            if self.__variableList.count( fullIDString ) == 0:
                self.__variableList.append( fullIDString )

        self.__variableList.sort()

    # end of addProcess

    
    def removeProcess( self, processIndexList ):
        '''
        remove processes from the pathway
        processIndexList: (list) a list of indices of processes
        '''