Пример #1
0
def graphNumberOfProteinPerGeneration(proteins_per_generation):
    from drawSVGGraph import Graph

    num_proteins_per_generation = [
        len(proteins) for proteins in proteins_per_generation
    ]

    g = Graph()
    g.addData({'proteins': num_proteins_per_generation})
    g.x_gridlines = False
    g.plot()
    g.write('test_graph')
Пример #2
0
def graphNumberOfProteinPerGeneration(proteins_per_generation):
    from drawSVGGraph import Graph

    num_proteins_per_generation = [len(proteins)for proteins in proteins_per_generation]

    g = Graph()
    g.addData({'proteins': num_proteins_per_generation})
    g.x_gridlines = False
    g.plot()
    g.write('test_graph')
Пример #3
0
def plotFitness(fitnesses):

    from drawSVGGraph import Graph

    g = Graph({'height': 200, 'width': 500})
    g.addData({
        'max': [f[0] for f in fitnesses],
        'median': [f[63] for f in fitnesses]
    })

    g.x_gridlines = False
    g.colours = ['#3C9DD0', '#034569', '#0C0874']
    g.addStyle('.gridlines', {'opacity': 0.2})
    g.x_axis_label = "Generations"
    g.y_axis_label = "Concentration of IH"
    g.div_x = 480

    g.plot()
    g.write('Fitness over generations')
Пример #4
0
def plotMetabolites():
    # Get metabolites from file of just metabolites
    filename = os.path.join("Genomes", "Gen 1920 metabolites.txt")
    metabolites_per_generation = []

    with open(filename, 'r') as fin:
        for line in fin:
            d = {}
            for metabolites in line.split(', '):
                m, v = metabolites.split(':')
                d[m] = float(v)
            metabolites_per_generation.append(d)

    # Only look at the first 1000 generations
    metabolites_per_generation = metabolites_per_generation[:1000]

    def getMetabolite(m):
        """ Get list of concentrations over the generations for a given metabolite.
            Return as a percentage of the initial concentration and bin into bins of 5. """

        initial_concentration = metabolites_per_generation[0][m]
        return [
            1000 * (generation[m] - initial_concentration)
            for generation in metabolites_per_generation
        ]

    metabolites_of_interest = ['K', 'F', 'G']
    metabolites_of_interest = ['E', 'H', 'I']
    metabolites_of_interest = ['IL', 'FG', 'FK']
    metabolites_of_interest = ['E', 'H', 'I', 'IL', 'K', 'F', 'G', 'FG', 'FK']
    metabolite_data = {
        metabolite: getMetabolite(metabolite)
        for metabolite in metabolites_of_interest
    }
    for m in metabolites_of_interest:
        print m, metabolite_data[m][-1]

    from drawSVGGraph import Graph

    g = Graph({'height': 300, 'width': 450})
    g.addData(metabolite_data)

    g.x_gridlines = False
    g.colours = ['#3C9DD0', '#034569', '#0C0874']
    g.colours = ['#111'] * 9
    g.addStyle('.gridlines', {'opacity': 0.2})
    g.x_axis_label = "Generations"
    g.y_axis_label = "Change in concentration"
    #g.min_y = 0

    g.plot()
    g.write('Conc of E over generations')
Пример #5
0
def plotFitness(fitnesses):

    from drawSVGGraph import Graph

    g = Graph({'height': 200, 'width': 500})
    g.addData({'max': [f[0] for f in fitnesses], 'median': [f[63] for f in fitnesses]})

    g.x_gridlines = False
    g.colours = ['#3C9DD0', '#034569', '#0C0874']
    g.addStyle('.gridlines', {'opacity':0.2})
    g.x_axis_label = "Generations"
    g.y_axis_label = "Concentration of IH"
    g.div_x = 480

    g.plot()
    g.write('Fitness over generations')
Пример #6
0
def plotMetabolites():
    # Get metabolites from file of just metabolites
    filename = os.path.join("Genomes", "Gen 1920 metabolites.txt")
    metabolites_per_generation = []

    with open(filename, 'r') as fin:
        for line in fin:
            d = {}
            for metabolites in line.split(', '):
                m, v = metabolites.split(':')
                d[m] = float(v)
            metabolites_per_generation.append(d)

    # Only look at the first 1000 generations
    metabolites_per_generation = metabolites_per_generation[:1000]

    def getMetabolite(m):
        """ Get list of concentrations over the generations for a given metabolite.
            Return as a percentage of the initial concentration and bin into bins of 5. """

        initial_concentration = metabolites_per_generation[0][m]
        return [1000 * (generation[m] - initial_concentration) for generation in metabolites_per_generation]
    

    metabolites_of_interest = ['K', 'F', 'G']
    metabolites_of_interest = ['E', 'H', 'I']
    metabolites_of_interest = ['IL', 'FG', 'FK']
    metabolites_of_interest = ['E', 'H', 'I', 'IL', 'K', 'F', 'G', 'FG', 'FK']
    metabolite_data = {metabolite: getMetabolite(metabolite) for metabolite in metabolites_of_interest}
    for m in metabolites_of_interest:
        print m, metabolite_data[m][-1]

    from drawSVGGraph import Graph


    g = Graph({'height': 300, 'width': 450})
    g.addData(metabolite_data)

    g.x_gridlines = False
    g.colours = ['#3C9DD0', '#034569', '#0C0874']
    g.colours = ['#111'] * 9
    g.addStyle('.gridlines', {'opacity':0.2})
    g.x_axis_label = "Generations"
    g.y_axis_label = "Change in concentration"
    #g.min_y = 0

    g.plot()
    g.write('Conc of E over generations')