Ejemplo n.º 1
0
def run_master(out_dir):
    timeseries = test_master()
    volume_ts = timeseries['global']['volume']
    print('growth: {}'.format(volume_ts[-1] / volume_ts[0]))
    expression_plot_settings = {
        'name': 'gene_expression',
        'ports': {
            'transcripts': 'transcripts',
            'molecules': 'metabolites',
            'proteins': 'proteins'
        }
    }
    plot_gene_expression_output(timeseries, expression_plot_settings, out_dir)

    plot_settings = {
        'max_rows':
        20,
        'remove_zeros':
        True,
        'skip_ports': [
            'prior_state', 'null', 'flux_bounds', 'chromosome', 'reactions',
            'exchange'
        ]
    }
    plot_simulation_output(timeseries, plot_settings, out_dir)
Ejemplo n.º 2
0
def run_flagella_compartment(
        compartment,
        initial_state=None,
        out_dir='out'):

    # get flagella data
    flagella_data = FlagellaChromosome()

    # run simulation
    settings = {
        # a cell cycle of 2520 sec is expected to express 8 flagella.
        # 2 flagella expected in approximately 630 seconds.
        'total_time': 2520,
        'emit_step': COMPARTMENT_TIMESTEP,
        'verbose': True,
        'initial_state': initial_state}
    timeseries = simulate_compartment_in_experiment(compartment, settings)

    # save reference timeseries
    save_timeseries(timeseries, out_dir)

    plot_config = {
        'name': 'flagella_expression',
        'ports': {
            'transcripts': 'transcripts',
            'proteins': 'proteins',
            'molecules': 'molecules'}}

    plot_gene_expression_output(
        timeseries,
        plot_config,
        out_dir)

    # just-in-time figure
    plot_config2 = plot_config.copy()
    plot_config2.update({
        'name': 'flagella',
        'plot_ports': {
            'transcripts': list(flagella_data.chromosome_config['genes'].keys()),
            'proteins': flagella_data.complexation_monomer_ids + flagella_data.complexation_complex_ids,
            'molecules': list(nucleotides.values()) + list(amino_acids.values())}})

    plot_timeseries_heatmaps(
        timeseries,
        plot_config2,
        out_dir)

    # make a basic sim output
    plot_settings = {
        'max_rows': 30,
        'remove_zeros': True,
        'skip_ports': ['chromosome', 'ribosomes']}
    plot_simulation_output(
        timeseries,
        plot_settings,
        out_dir)
def run_chemotaxis_master(out_dir):
    total_time = 10

    # make the compartment
    compartment = ChemotaxisMaster({})

    # save the topology network
    settings = {'show_ports': True}
    plot_compartment_topology(compartment, settings, out_dir)

    # run an experinet
    settings = {'timestep': 1, 'total_time': total_time}
    timeseries = simulate_compartment_in_experiment(compartment, settings)

    volume_ts = timeseries['boundary']['volume']
    print('growth: {}'.format(volume_ts[-1] / volume_ts[0]))

    # plots
    # simulation output
    plot_settings = {
        'max_rows': 40,
        'remove_zeros': True,
        'skip_ports': ['reactions', 'prior_state', 'null']
    }
    plot_simulation_output(timeseries, plot_settings, out_dir)

    # gene expression plot
    gene_exp_plot_config = {
        'name': 'flagella_expression',
        'ports': {
            'transcripts': 'transcripts',
            'proteins': 'proteins',
            'molecules': 'internal'
        }
    }
    plot_gene_expression_output(timeseries, gene_exp_plot_config, out_dir)
Ejemplo n.º 4
0
        }
    }

    return GeneExpression(gfp_config)


if __name__ == '__main__':
    out_dir = os.path.join('out', 'tests', 'gfp_expression_composite')
    if not os.path.exists(out_dir):
        os.makedirs(out_dir)

    # load the compartment
    gfp_expression_compartment = generate_gfp_compartment()

    # run simulation
    settings = {
        'total_time': 100,
    }
    timeseries = simulate_compartment(gfp_expression_compartment, settings)

    plot_config = {
        'name': 'gfp_expression',
        'ports': {
            'transcripts': 'transcripts',
            'molecules': 'molecules',
            'proteins': 'proteins'
        }
    }

    plot_gene_expression_output(timeseries, plot_config, out_dir)