Beispiel #1
0
def empty_net():
    import random
    from phievo.Networks import mutation
    seed = int(random.random() * 100000)
    g = random.Random(seed)
    net = mutation.Mutable_Network(g)
    return net
Beispiel #2
0
def init_network():
    seed = int(random.random() * 100000)
    g = random.Random(seed)
    L = mutation.Mutable_Network(g)
    L.remove_output_when_duplicate = False
    parameters = [[
        'Degradable',
        mutation.sample_dictionary_ranges('Species.degradation', random)
    ]]
    parameters.append(['TF', 1])
    parameters.append(['Input', 0])
    TF = L.new_Species(parameters)
    for k in range(5):
        [tm, prom, o1] = L.random_gene('TF')
        o1.add_type(['Output', k])
    L.activator_required = 1
    L.fixed_activity_for_TF = 0
    L.write_id()
    L.random_Interaction('TFHill')
    L.random_Interaction('TFHill')
    L.random_Interaction('TFHill')
    L.write_id()
    for i in L.dict_types['TFHill']:
        i.activity = 1
        i.threshold = min(0.1, i.threshold)
    return L
Beispiel #3
0
def init_network():
    seed = int(random.random() * 100000)
    g = random.Random(seed)
    L = mutation.Mutable_Network(g)
    L.fixed_activity_for_TF = 0

    parameters = [[
        'Degradable',
        mutation.sample_dictionary_ranges('Species.degradation', random)
    ]]
    parameters.append(['Input', 0])
    parameters.append(['Complexable'])
    TF1 = L.new_Species(parameters)

    parameters = [[
        'Degradable',
        mutation.sample_dictionary_ranges('Species.degradation', random)
    ]]
    parameters.append(['Input', 1])
    parameters.append(['Complexable'])
    TF2 = L.new_Species(parameters)

    [tm, prom, o1] = L.random_gene('TF')
    o1.mutable = False
    o1.add_type(['Output', 0])
    o1.clean_type('Complexable')
    L.write_id()

    return L
Beispiel #4
0
def init_network():
    seed = int(random.random() * 100000)
    g = random.Random(seed)
    L = mutation.Mutable_Network(g)
    parameters = [[
        'Degradable',
        mutation.sample_dictionary_ranges('Species.degradation', random)
    ]]
    parameters.append(['TF', 1])
    parameters.append(['Input', 0])
    TF = L.new_Species(parameters)
    for k in range(2):
        [tm, prom, o1] = L.random_gene('TF')
        o1.add_type(['Output', k])
    L.activator_required = 1
    L.fixed_activity_for_TF = 0
    L.write_id()
    return L
Beispiel #5
0
def init_network():
    seed = int(random.random() * 100000)
    g = random.Random(seed)
    net = mutation.Mutable_Network(g)
    ## Input
    parameters = []
    parameters.append(['TF', 1])
    parameters.append(['Input', 0])
    TF = net.new_Species(parameters)

    ## Add one output
    N_output = 1
    for k in range(2):
        [tm, prom, o1] = net.random_gene('TF')
        o1.add_type(['Output', k])
    # for k in range(N_output):
    #     [tm, prom, o1] = net.random_gene(['TF',1])
    #     o1.add_type(['Output',k])
    net.write_id()
    return net
Beispiel #6
0
 def setUp(self):
     seed = 0
     g = random.Random(seed)
     self.net = mutation.Mutable_Network(g)
Beispiel #7
0
def init_network():

    seed=int(random.random()*510)
    g=random.Random(seed)
    L=mutation.Mutable_Network(g)

    conc = 1000.0
    T = 1.0

    # the ligand (the pMHC on the antigen presenting cell)
    parameters=[['Ligand']]
    parameters.append(['Input',0])
    Lig=L.new_Species(parameters)

    # the receptor (on the T cell)
    parameters=[['Receptor']]
    R = L.new_Species(parameters)

    # a kinase.
    parameters=[['Kinase']]
    parameters.append(['Phosphorylable'])
    parameters.append(['Phospho',0])
    K1 = L.new_Species(parameters)

    # a kinase.
    parameters=[['Kinase']]
    parameters.append(['Phosphorylable'])
    parameters.append(['Phospho',0])
    K2 = L.new_Species(parameters)

    # a kinase.
    parameters=[['Kinase']]
    parameters.append(['Phosphorylable'])
    parameters.append(['Phospho',0])
    K3 = L.new_Species(parameters)

    # a phosphatase.
    parameters=[['Phosphatase']]
    parameters.append(['Phosphorylable'])
    parameters.append(['Phospho',0])
    P1 = L.new_Species(parameters)

    # a phosphatase.
    parameters=[['Phosphatase']]
    parameters.append(['Phosphorylable'])
    parameters.append(['Phospho',0])
    P2 = L.new_Species(parameters)

    # a phosphatase.
    parameters=[['Phosphatase']]
    parameters.append(['Phosphorylable'])
    parameters.append(['Phospho',0])
    P3 = L.new_Species(parameters)

    # the complex generated: it is a kinase that is phosphorylable and with the label pMHC to indicate it is in the cascade.
    parameters=[['Kinase']]
    parameters.append(['Phosphorylable'])
    parameters.append(['Phospho',0])
    parameters.append(['pMHC'])

    # the first binding of the receptor and ligand generating the complex.
    kappa = 1E-4
    [Binding, C] = L.new_KPR_Binding(Lig,R,kappa,parameters)
    unbinbing = L.new_KPR_Unbinding(Lig,R,C)

    # the output tag placed on the unphosphorylated complex arising from binding of receptor and ligand.
    C.add_type(['Output',0])
    L.write_id()

    # checks consecutive numbering for IO species.
    L.verify_IO_numbers()
    return L
Beispiel #8
0
## Import the libraries 
from phievo.Networks import mutation,deriv2
import random

### Create an empty network
g = random.Random(20160225) # This define a new random number generator
L = mutation.Mutable_Network(g) # Create an empty network


### Create a new  species _S0_
## S0 is a reference to access quickly to the newly created species latter in the code. Note that one can add attributes to a species by adding elements to a parameter array that is passed to the new_species method.
## ATTENTION: This way of creating a species is not recommanded as it does not handle the interaction between the network's different species (see next section). It is here as to get a feeling on how the intern code works.</font>    

parameters=[['Degradable',0.5]] ## The species is degradable with a rate 0.5
parameters.append(['Input',0]) ## The species cannot serve as an input for the evolution algorithm
parameters.append(['Complexable']) ## The species can be involved in a complex
parameters.append(['Kinase']) ## The specise can phosphorilate another species. 
parameters.append(['TF',1]) ## 1 for activator 0 for repressor
S0 = L.new_Species(parameters)


### Adding a gene  
## A species itself is of no use for the evolution algorithm. The architecture of a networks associates a TModule and a CorePromoter to a a species to build an cluster representing a gene for the program. The TModule is there so that other transcription factors can bind to it and regulate S0.

L = mutation.Mutable_Network(g) ## Clear the network

## Gene 0
parameters=[['Degradable',0.5]]
parameters.append(['TF',1])
parameters.append(['Complexable'])
TM0,prom0,S0 = L.new_gene(0.5,5,parameters) ## Adding a new gene creates a TModule, a CorePromoter and a species