Ejemplo n.º 1
0
# object
rs = m.ReleaseSite(name='test',
                   complex=m.Complex('A'),
                   shape=m.Shape.SPHERICAL,
                   location=(1, 2, 3),
                   number_to_release=1000)

rs2 = copy.copy(rs)
rs2.complex = m.Complex('B')

assert rs.complex.to_bngl_str() == 'A'
assert rs2.complex.to_bngl_str() == 'B'

# vector
ct = m.ComponentType('u', states=['0'])

ct2 = copy.copy(ct)
ct2.states = ['X', 'Y']

assert ct.states == ['0']
assert ct2.states == ['X', 'Y']

# vector2
ct3 = m.ComponentType('u', states=['0', '1'])

ct4 = copy.copy(ct3)
ct4.states[0] = 'X'

assert ct3.states == ['0', '1']
assert ct4.states == ['X', '1']
Ejemplo n.º 2
0
import sys
import os

MCELL_PATH = os.environ.get('MCELL_PATH', '')
if MCELL_PATH:
    sys.path.append(os.path.join(MCELL_PATH, 'lib'))
else:
    print(
        "Error: variable MCELL_PATH that is used to find the mcell library was not set."
    )
    sys.exit(1)

import mcell as m

# checking that .append and other modifications works
ct_u = m.ComponentType('u', states=['0'])

#print(type(ct_u.states))
assert len(ct_u.states) == 1
ct_u.states.append('1')
assert len(ct_u.states) == 2

ct_u.states[1] = '2'
assert ct_u.states[1] == '2'

rs = m.ReleaseSite(name='test',
                   complex=m.Complex('A'),
                   shape=m.Shape.SPHERICAL,
                   location=(1, 2, 3),
                   number_to_release=1000)
Ejemplo n.º 3
0
assert c.red == 1
assert c2.red == 0.5

# object - first level copy
rs = m.ReleaseSite(name='test',
                   complex=m.Complex('A'),
                   shape=m.Shape.SPHERICAL,
                   location=(1, 2, 3),
                   number_to_release=1000)

rs2 = copy.deepcopy(rs)
rs2.complex.name = 'B'

assert rs.complex.name == 'A'
assert rs2.complex.name == 'B'

# object in vector
cplx = m.Complex('X(a~0!1).Y(b~Q!1)')

ct = m.ComponentType('z', ['E', 'R'])

cplx2 = copy.deepcopy(cplx)

cplx2.elementary_molecules[0].elementary_molecule_type.components[0] = ct
cplx2.elementary_molecules[0].components[0] = ct.inst('E', 1)

assert cplx.elementary_molecules[0].elementary_molecule_type.components[
    0].name == 'a'
assert cplx.to_bngl_str() == 'X(a~0!1).Y(b~Q!1)'
assert cplx2.to_bngl_str() == 'X(z~E!1).Y(b~Q!1)'
Ejemplo n.º 4
0
def convert_species_file(file_name):
    # read the .species file and parse complexes to the internal MCell
    # representation
    complex_counts = species_reader.read_species_file(file_name)

    # prepare the component type that we will append to the CaMKII molecules
    # the new component means 'upper' and has a boolean state
    ct_u = m.ComponentType('u', ['0', '1'])

    # process the data by adding component 'u' to the CaMKII elementary molecules
    for (complex, count) in complex_counts:

        # if this a CaMKII dodecamer?
        camkiis = []
        for em in complex.elementary_molecules:
            em_name = em.elementary_molecule_type.name
            if em_name == 'CaMKII':
                camkiis.append(em)

        if len(camkiis) != 12:
            # output it directly
            print(complex.to_bngl_str() + " " + str(count))
            continue

        # ok, we have the holoenzyme, how can we figure out which
        # of the CaMKIIs belong to the upper and the lower
        # ring?

        # let's say that the first one is in the upper ring,
        # go along the 'r'
        upper_first = camkiis[0]
        upper_ring = [upper_first]
        curr = upper_first
        for i in range(1, 6):
            curr = get_bound_em(complex, curr, 'r')
            upper_ring.append(curr)

        assert upper_first is get_bound_em(complex, curr,
                                           'r'), "A ring must be formed"

        # then go down along 'c' and go again along 'r' to get molecules of the lower ring
        lower_first = get_bound_em(complex, camkiis[0], 'c')
        lower_ring = [lower_first]
        curr = lower_first
        for i in range(1, 6):
            curr = get_bound_em(complex, curr, 'r')
            lower_ring.append(curr)

        assert lower_first is get_bound_em(complex, curr,
                                           'r'), "A ring must be formed"

        # now the modifications - add components by instatiating the component type 'u'
        # the way how the complexes were is parsed was that each complex has its own instance
        # of the elementary molecule type for CaMKII so lets change one of them
        upper_first.elementary_molecule_type.components.append(ct_u)

        for em in upper_ring:
            em.components.append(ct_u.inst('1'))

        for em in lower_ring:
            em.components.append(ct_u.inst('0'))

        print(complex.to_bngl_str() + " " + str(count))
Ejemplo n.º 5
0
MCELL_PATH = os.environ.get('MCELL_PATH', '')
if MCELL_PATH:
    sys.path.append(os.path.join(MCELL_PATH, 'lib'))
else:
    print(
        "Error: variable MCELL_PATH that is used to find the mcell library was not set."
    )
    sys.exit(1)

import mcell as m

subsystem = m.Subsystem()
model = m.Model()

d = m.ComponentType('d', ['X', 'Y'])
e = m.ComponentType('e', ['0', '1'])

for o, c in [(subsystem, 's'), (model, 'm')]:
    mt1 = m.ElementaryMoleculeType('A' + c, [e, d], diffusion_constant_3d=1e-6)
    o.add_elementary_molecule_type(mt1)

    # must be siletnly ignored
    mt2 = m.ElementaryMoleculeType('A' + c, [d, e], diffusion_constant_3d=1e-6)
    o.add_elementary_molecule_type(mt2)
    assert len(o.elementary_molecule_types) == 1

    try:
        o.add_elementary_molecule_type(
            m.ElementaryMoleculeType('A' + c, [e, d],
                                     diffusion_constant_3d=1e-5))
Ejemplo n.º 6
0
# WARNING: This is an automatically generated file and will be overwritten
#          by CellBlender on the next model export.

import mcell as m

from parameters import *

Syk_a = m.ComponentType(name='a', states=['Y', 'pY'])

Syk_l = m.ComponentType(name='l', states=['Y', 'pY'])

Syk_tSH2 = m.ComponentType(name='tSH2')

Syk = m.ElementaryMoleculeType(name='Syk',
                               components=[Syk_a, Syk_l, Syk_tSH2],
                               diffusion_constant_3d=8.50999999999999984e-07)

# ---- create subsystem object and add components ----

subsystem = m.Subsystem()
subsystem.add_elementary_molecule_type(Syk)
Ejemplo n.º 7
0
import sys
import os

MCELL_PATH = os.environ.get('MCELL_PATH', '')
if MCELL_PATH:
    sys.path.append(os.path.join(MCELL_PATH, 'lib'))
else:
    print(
        "Error: variable MCELL_PATH that is used to find the mcell library was not set."
    )
    sys.exit(1)

import mcell as m

c1_1 = m.ComponentType('C', ['0', '1', 'Z'])
c1_2 = m.ComponentType('C', ['1', '0', 'Z'])
b1 = m.ComponentType('B', ['0', '1', 'Q'])

mt1_1 = m.ElementaryMoleculeType('M', [c1_1, b1], diffusion_constant_3d=1e-6)
mt1_2 = m.ElementaryMoleculeType('M', [b1, c1_2])
mt2 = m.ElementaryMoleculeType('M', [b1, c1_2], diffusion_constant_3d=1e-5)

mt4 = m.ElementaryMoleculeType('N', [b1, b1, c1_1])
mt5 = m.ElementaryMoleculeType('O', [b1, c1_2])

s1_1 = m.Species(
    elementary_molecules=[mt1_1.inst([c1_1.inst('0'),
                                      b1.inst('Q')])])
s1_2 = m.Species(
    elementary_molecules=[mt1_1.inst([b1.inst('Q'),
Ejemplo n.º 8
0
import sys
import os

MCELL_PATH = os.environ.get('MCELL_PATH', '')
if MCELL_PATH:
    sys.path.append(os.path.join(MCELL_PATH, 'lib'))
else:
    print(
        "Error: variable MCELL_PATH that is used to find the mcell library was not set."
    )
    sys.exit(1)

import mcell as m

C = m.ComponentType('C', ['0', '1', 'Z'])
N = m.ComponentType('N')
assert C.to_bngl_str() == 'C~0~1~Z'
assert N.to_bngl_str() == 'N'

C_inst = C.inst('1', 2)
C_inst2 = C.inst(1)
assert C_inst.to_bngl_str() == 'C~1!2'
assert C_inst2.to_bngl_str() == 'C~1'

CaM = m.ElementaryMoleculeType('CaM', [C, N], diffusion_constant_3d=1e-6)
assert CaM.to_bngl_str() == 'CaM(C~0~1~Z,N)'

CaM_inst = CaM.inst([C.inst(0), N.inst(1)])
assert CaM_inst.to_bngl_str() == 'CaM(C~0,N~1)'

cplx_inst = m.Complex(elementary_molecules=[