Пример #1
0
    def __init__(self,
                 paper,
                 type="normal",
                 points=[],
                 shape=(8, 10, 3),
                 pin=1,
                 spline=0,
                 package=None,
                 fill="#000"):
        meta_enabled.__init__(self, standard=paper.standard)
        drawable.__init__(self)
        with_line.__init__(self)
        line_colored.__init__(self)

        self.paper = paper

        self.type = type
        self.points = []
        self.spline = spline
        self.paper = paper
        self.shape = shape
        self.items = []
        self.pin = 1
        if points:
            for p in points:
                pnt = point(self.paper, xy=p, arrow=self)
                self.points.append(pnt)
        self.reaction = reaction()
        self.reaction.arrows.append(self)
        if package:
            self.read_package(package)
Пример #2
0
 def read_text( self, text):
   # reaction support
   if ">" in text:
     if text.count(">") != 2:
       raise oasa_exceptions.oasa_smiles_error( "Only two '>' characters are supported in SMILES reactions. %d present" % text.count(">"))
     parts = text.split( ">")
     res = []
     for part in parts:
       res.append( self._read_string( part))
       if not self.last_status == self.STATUS_OK:
         res = []
         break
     if not res:
       self.result = []
       return []
     else:
       react = reaction.reaction()
       for p in res[0]:
         react.reactants.append( reaction.reaction_component( p))
       for p in res[2]:
         react.products.append( reaction.reaction_component( p))
       for p in res[1]:
         react.reagents.append( reaction.reaction_component( p))
       self.result = [react]
       return self.result
   else:
     return self._read_string( text)
Пример #3
0
  def __init__( self, paper, type="normal", points=[], shape=(8,10,3), pin=1, spline=0, package=None, fill="#000"):
    meta_enabled.__init__( self, standard=paper.standard)
    drawable.__init__( self)
    with_line.__init__( self)
    line_colored.__init__( self)

    self.paper = paper

    self.type = type
    self.points = []
    self.spline = spline
    self.paper = paper
    self.shape = shape
    self.items = []
    self.pin = 1
    if points:
      for p in points:
        pnt = point( self.paper, xy=p, arrow=self)
        self.points.append( pnt)
    self.reaction = reaction()
    self.reaction.arrows.append( self)
    if package:
      self.read_package( package)
Пример #4
0
from reaction import reaction
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import os
import sys
if sys.platform != 'win32':
    os.chdir(os.path.dirname(sys.argv[0]))

r = reaction()

# equ. 1
r.add_equation('fs+e->f1f2s+e', 'k0')
r.add_equation('fps+e->f1pf2ps+e', 'k0')
# equ. 2
r.add_equation('f1f2s+i->if2s+f1', 'k1')
r.add_equation('f1pf2ps+i->if2ps+f1p', 'k1')
# equ. 3
r.add_equation('if2s+f->fs+i+f2', 'k2')
r.add_equation('if2ps+f->fs+i+f2p', 'k2')

# reverse reaction of equ. 2
r.add_equation('if2s+f1->f1f2s+i', 'kr')
r.add_equation('if2ps+f1p->f1pf2ps+i', 'kr')

# additional equ.
r.add_equation('f1p+if2s->f1pf2s+i', 'kr')
r.add_equation('f1+if2ps->f1f2ps+i', 'kr')

# the forward reaction of additional equ.
#r.add_equation('f1pf2s+i->f1p+if2s', 'k1')
Пример #5
0
def test_reaction_parameters1():
    try:
        reaction.reaction([10],[1,2,1],[[1,2,0],[0,0,2]],[[0,0,1],[1,2,0]])
    except ValueError as err:
        assert(type(err) == ValueError)
Пример #6
0
def test_reaction_result():
    assert reaction.reaction([10,10],[1,2,1],[[1,2,0],[0,0,2]],[[0,0,1],[1,2,0]]) == [-30, -60, 20]