Example #1
0
def new_random_Methyl(self, S):
    """
    Creates a methylation with random parameters.
        
    Args:
        S: Species to methylate
    Returns:
        [methyl_inter,S_methyl]:returns a Methyl interaction and a methylated species.
    """
    parameters = {}
    if S.isinstance("TF"):
        parameters['TF'] = self.Random.random() * 2
    for tt in S.types:
        if tt not in ["TF", "Methylable", "Input", "Output"]:
            parameters[tt] = [
                mutation.sample_dictionary_ranges('Species.{}'.format(attr),
                                                  self.Random)
                for attr in S.Tags_Species[tt]
            ]

    # Transform to fit phievo list structure
    parameters = [[kk] + val if val else [kk]
                  for kk, val in parameters.items()]
    methyl = mutation.sample_dictionary_ranges('Methyl.methyl', self.Random)
    demethyl = mutation.sample_dictionary_ranges('Methyl.demethyl',
                                                 self.Random)
    return self.new_Methyl(S, methyl, demethyl, parameters)
Example #2
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
Example #3
0
def new_random_KPR_Binding(self, L, R):
    """create random KPR_Binding, and return interaction Node and output complex """

    list = [[
        'Degradable',
        mutation.sample_dictionary_ranges('Species.degradation', self.Random)
    ], ['TF', int(self.Random.random() * 2)], ['Complexable'],
            ['Phosphorylable']]
    a = mutation.sample_dictionary_ranges('KPR_Binding.association',
                                          self.Random)
    conc = mutation.sample_dictionary_ranges('KPR_Binding.dissociation',
                                             self.Random)
    [KPR_Binding, C] = self.new_KPR_Binding(L, R, a, conc, list)
    return [KPR_Binding, C]
Example #4
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
Example #5
0
def new_random_Simple_Dephosphorylation(self, K, Sp, S):
    """ create new random Simple_Dephosphorylation interaction and return interaction."""

    r = mutation.sample_dictionary_ranges('Simple_Dephosphorylation.rate',
                                          self.Random)
    D = self.new_Simple_Dephosphorylation(K, Sp, S, r)
    return D
Example #6
0
def new_Species(self,list,bool_conc = True,manual_conc = 0):
        """Create new Species instance with argument parameters of form [ [], [],.. ], and add to graph """
        S=classes_eds2.Species(list)
        self.add_Node(S)
        if ((S.isinstance('Phosphatase') or S.isinstance('Kinase')) and not S.isinstance('pMHC') ):
            if bool_conc:
                conc = mutation.sample_dictionary_ranges('Initial_Concentration.concentration',self.Random)
            else:
                conc = manual_conc
            self.new_Initial_Concentration(S,conc)
        return S
Example #7
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
Example #8
0
## Create a methylation interaction
from phievo import __silent__, __verbose__
if __verbose__:
    print("Execute Methyl (Interaction Template)")

from phievo.Networks import mutation
from phievo.Networks import deriv2
from phievo.Networks import classes_eds2
import copy

## Define the function that assigns new parameters to a new methylable species
mutation.species_types["Methylable"] = lambda random_generator: [
    ["Methylable"],
    [
        'Diffusible',
        mutation.sample_dictionary_ranges('Species.diffusion', random_generator
                                          )
    ]
]
classes_eds2.Species.Tags_Species["Methylable"] = []

## Define the default dictionary_range
mutation.dictionary_ranges['Methyl.methyl'] = 0.0 / (mutation.C * mutation.T)
mutation.dictionary_ranges['Methyl.demethyl'] = 0.0 / mutation.T


class Methyl(classes_eds2.Interaction):
    """
    Methylation interaction

    Args:
        Methyl.methyl(float): binding rate of a methyl group
Example #9
0
def new_random_Simple_Phosphorylation(self, K, S):
    """ Create new random Simple_Phosphorylation interaction and return interaction and product. Note that the inputs must be given (as opposed to random_Simple_Phosphorylation)."""
    r = mutation.sample_dictionary_ranges('Simple_Phosphorylation.rate',
                                          self.Random)
    [SP, Phospho] = self.new_Simple_Phosphorylation(K, S, r)
    return [SP, Phospho]