Exemplo n.º 1
0
def take_snapshot(self, c, loop_nb, times, loops_done):
    # make the dataframe
    #todo: init a class that allows for different saving of data depending on run.
    n = names()
    self.original_seq.to_pickle(path=make_file_name(
        c=c, file_description=make_sequence_filename(loop_nb=loop_nb + 1)))
    times.to_pickle(path=make_file_name(c, file_description=n.times_fn))
    to_pickle(c=c, data=self.nb_mutations, data_name=n.nb_mutation_fn)
    to_pickle(c=c, data=self.min_yield, data_name=n.min_yield_fn)
    to_pickle(c=c, data=loops_done, data_name=n.loops_done_fn)
    # self.rng_times.to_pickle(path=make_file_name(c=c,file_description=n.random_fn))
    to_pickle(c=c, data=self.percent_pos, data_name=n.pp_fn)
Exemplo n.º 2
0
import matplotlib as mpl
from PIL import Image
mpl.use('Agg')
import matplotlib.pyplot as plt
import pandas as pd
import os
import ns_sampling_modules as sm
import ns_plot_modules as pm
import ns_data_modules as dm
from input_deck import inputs
import numpy as np
from input_deck import names, inputs
fn = names()
import glob


def violin_loop_plots(c, loops_2_show=None, nb_strings=None):
    '''
    make violin plots of distribution of yield for sequences
    :param c: inputs() object
    :param loops_2_show: ndarray of loops that were saved in run specified by 'c'
    :param nb_strings: number of strings to have in the violin plot  [default: 6]
    :return: saves the violin plot
    '''
    print('making violin plots')
    if loops_2_show is None:
        loops_done = dm.read_pickle(c=c, file_description=fn.loops_done_fn)
        loops_2_show = sm.convert2numpy(df=loops_done,
                                        field=fn.loops_done_fn) + 1
        #of the loops completed only show half of them.
        if nb_strings is None: