Пример #1
0
 def loadEntry(self,
               index,
               group1=None,
               group2=None,
               group3=None,
               group4=None,
               kinetics=None,
               degeneracy=1,
               label='',
               duplicate=False,
               reversible=True,
               reference=None,
               referenceType='',
               shortDesc='',
               longDesc='',
               rank=None,
               history=None
               ):
     
     reactants = []
     
     if group1[0:3].upper() == 'OR{' or group1[0:4].upper() == 'AND{' or group1[0:7].upper() == 'NOT OR{' or group1[0:8].upper() == 'NOT AND{':
         reactants.append(makeLogicNode(group1))
     else:
         reactants.append(Group().fromAdjacencyList(group1))
     if group2 is not None: 
         if group2[0:3].upper() == 'OR{' or group2[0:4].upper() == 'AND{' or group2[0:7].upper() == 'NOT OR{' or group2[0:8].upper() == 'NOT AND{':
             reactants.append(makeLogicNode(group2))
         else:
             reactants.append(Group().fromAdjacencyList(group2))
     if group3 is not None: 
         if group3[0:3].upper() == 'OR{' or group3[0:4].upper() == 'AND{' or group3[0:7].upper() == 'NOT OR{' or group3[0:8].upper() == 'NOT AND{':
             reactants.append(makeLogicNode(group3))
         else:
             reactants.append(Group().fromAdjacencyList(group3))
     if group4 is not None: 
         if group4[0:3].upper() == 'OR{' or group4[0:4].upper() == 'AND{' or group4[0:7].upper() == 'NOT OR{' or group4[0:8].upper() == 'NOT AND{':
             reactants.append(makeLogicNode(group4))
         else:
             reactants.append(Group().fromAdjacencyList(group4))
     
     reaction = Reaction(reactants=reactants, products=[])
         
     entry = Entry(
         index = index,
         label = label,
         item = reaction,
         data = kinetics,
         reference = reference,
         referenceType = referenceType,
         shortDesc = shortDesc,
         longDesc = longDesc.strip(),
         rank = rank,
         history = history or [],
     )
     try:
         self.entries[label].append(entry)
     except KeyError:
         self.entries[label] = [entry]
     return entry
Пример #2
0
    def loadEntry(self,
                  index,
                  label,
                  group,
                  kinetics,
                  reference=None,
                  referenceType='',
                  shortDesc='',
                  longDesc='',
                  nodalDistance=None):
        """
        nodalDistance is the distance between a given entry and its parent specified by a float
        """
        if group[0:3].upper() == 'OR{' or group[0:4].upper(
        ) == 'AND{' or group[0:7].upper() == 'NOT OR{' or group[0:8].upper(
        ) == 'NOT AND{':
            item = makeLogicNode(group)
        else:
            item = Group().fromAdjacencyList(group)

        if label in self.entries:
            raise DatabaseError(
                "Duplicate group name {label} found in kinetics groups for {family} family."
                .format(label=label, family=self.label))
        self.entries[label] = Entry(index=index,
                                    label=label,
                                    item=item,
                                    data=kinetics,
                                    reference=reference,
                                    referenceType=referenceType,
                                    shortDesc=shortDesc,
                                    longDesc=longDesc.strip(),
                                    nodalDistance=nodalDistance)
Пример #3
0
 def loadEntry(self,
               index,
               label,
               group,
               distances,
               reference=None,
               referenceType='',
               shortDesc='',
               longDesc=''):
     if group[0:3].upper() == 'OR{' or group[0:4].upper(
     ) == 'AND{' or group[0:7].upper() == 'NOT OR{' or group[0:8].upper(
     ) == 'NOT AND{':
         item = makeLogicNode(group)
     else:
         item = Group().fromAdjacencyList(group)
     self.entries[label] = Entry(
         index=index,
         label=label,
         item=item,
         data=distances,
         reference=reference,
         referenceType=referenceType,
         shortDesc=shortDesc,
         longDesc=longDesc.strip(),
     )
Пример #4
0
 def loadEntry(self, index, label, group, kinetics, reference=None, referenceType='', shortDesc='', longDesc=''):
     if group[0:3].upper() == 'OR{' or group[0:4].upper() == 'AND{' or group[0:7].upper() == 'NOT OR{' or group[0:8].upper() == 'NOT AND{':
         item = makeLogicNode(group)
     else:
         item = Group().fromAdjacencyList(group)
         
     if label in self.entries:
         raise DatabaseError("Duplicate group name {label} found in kinetics groups for {family} family.".format(label=label,family=self.label))
     self.entries[label] = Entry(
         index = index,
         label = label,
         item = item,
         data = kinetics,
         reference = reference,
         referenceType = referenceType,
         shortDesc = shortDesc,
         longDesc = longDesc.strip(),
     )
Пример #5
0
def loadGroup(index, label, group, kinetics, reference=None, referenceType='', shortDesc='', longDesc=''):
    	if group[0:3].upper() == 'OR{' or group[0:4].upper() == 'AND{' or group[0:7].upper() == 'NOT OR{' or group[0:8].upper() == 'NOT AND{':
    		item = makeLogicNode(group)
    	else:
    		item = Group().fromAdjacencyList(group)
    		
    	entry = Entry(
    		index = index,
    		label = label,
    		item = item,
    		data = kinetics,
    		reference = reference,
    		referenceType = referenceType,
    		shortDesc = shortDesc,
    		longDesc = longDesc.strip(),
    		)
    		
    	entries.append(entry)
Пример #6
0
    def loadEntry(
        self,
        index,
        group1=None,
        group2=None,
        group3=None,
        group4=None,
        kinetics=None,
        degeneracy=1,
        label='',
        duplicate=False,
        reversible=True,
        reference=None,
        referenceType='',
        shortDesc='',
        longDesc='',
        rank=None,
    ):

        reactants = []

        if group1[0:3].upper() == 'OR{' or group1[0:4].upper(
        ) == 'AND{' or group1[0:7].upper() == 'NOT OR{' or group1[0:8].upper(
        ) == 'NOT AND{':
            reactants.append(makeLogicNode(group1))
        else:
            reactants.append(Group().fromAdjacencyList(group1))
        if group2 is not None:
            if group2[0:3].upper() == 'OR{' or group2[0:4].upper(
            ) == 'AND{' or group2[0:7].upper(
            ) == 'NOT OR{' or group2[0:8].upper() == 'NOT AND{':
                reactants.append(makeLogicNode(group2))
            else:
                reactants.append(Group().fromAdjacencyList(group2))
        if group3 is not None:
            if group3[0:3].upper() == 'OR{' or group3[0:4].upper(
            ) == 'AND{' or group3[0:7].upper(
            ) == 'NOT OR{' or group3[0:8].upper() == 'NOT AND{':
                reactants.append(makeLogicNode(group3))
            else:
                reactants.append(Group().fromAdjacencyList(group3))
        if group4 is not None:
            if group4[0:3].upper() == 'OR{' or group4[0:4].upper(
            ) == 'AND{' or group4[0:7].upper(
            ) == 'NOT OR{' or group4[0:8].upper() == 'NOT AND{':
                reactants.append(makeLogicNode(group4))
            else:
                reactants.append(Group().fromAdjacencyList(group4))

        reaction = Reaction(reactants=reactants, products=[])

        entry = Entry(
            index=index,
            label=label,
            item=reaction,
            data=kinetics,
            reference=reference,
            referenceType=referenceType,
            shortDesc=shortDesc,
            longDesc=longDesc.strip(),
            rank=rank,
        )
        try:
            self.entries[label].append(entry)
        except KeyError:
            self.entries[label] = [entry]
        return entry