def main(): args = parse_args() system_file = files.JSONStructInpFile(args.system_filename) fileformatter = construct_fileformatter() all_conditions = construct_conditions(args, fileformatter, system_file) inp_filebase = create_input_filepathbase(args) sim_collections = outputs.create_sim_collections(inp_filebase, all_conditions, args.reps) decor_outs = decorrelate.DecorrelatedOutputs(sim_collections, all_conditions) decor_outs.read_decors_from_files() mbarw = mbar_wrapper.MBARWrapper(decor_outs) mbarw.perform_mbar() out_filebase = create_output_filepathbase(args) tag_pairs = parse_tag_pairs(args.tag_pairs) for tag_pair in tag_pairs: mbarw.calc_2d_lfes(tag_pair[0], tag_pair[1], all_conditions, out_filebase) mbarw.calc_all_expectations(out_filebase) mbarw.calc_1d_lfes(all_conditions, out_filebase, xtag='bias') # Hacky shit all_tags = decor_outs.all_series_tags for tag in all_tags: if 'staplestates' in tag: mbarw.calc_2d_lfes(tag, 'numfullyboundstaples', all_conditions, out_filebase) if 'adj-d' in tag: mbarw.calc_2d_lfes(tag, 'dist-sum', all_conditions, out_filebase)
def main(): args = parse_args() fileformatter = construct_fileformatter() all_conditions = construct_conditions(args, fileformatter) inp_filebase = create_input_filepathbase(args) sim_collections = outputs.create_sim_collections(inp_filebase, all_conditions, args.reps) decor_outs = decorrelate.DecorrelatedOutputs(sim_collections, all_conditions) decor_outs.perform_decorrelation(args.skip) decor_outs.apply_masks() decor_outs.write_decors_to_files()
def main(): args = parse_args() fileformatter = construct_fileformatter() all_conditions = construct_conditions(args, fileformatter) inp_filebase = create_input_filepathbase(args) sim_collections = outputs.create_sim_collections(inp_filebase, all_conditions, args.reps) decor_outs = decorrelate.DecorrelatedOutputs(sim_collections, all_conditions) decor_outs.read_decors_from_files() mbarw = mbar_wrapper.MBARWrapper(decor_outs) mbarw.perform_mbar() out_filebase = create_output_filepathbase(args) mbarw.calc_all_expectations(out_filebase) mbarw.calc_1d_lfes(all_conditions, out_filebase) mbarw.calc_specified_2d_lfes(parse_tag_pairs(args.tag_pairs), all_conditions, out_filebase)
def main(): args = parse_args() system_file = files.JSONStructInpFile(args.system_filename) fileformatter = construct_fileformatter() all_conditions = construct_conditions(args, fileformatter, system_file) inp_filebase = create_input_filepathbase(args) sim_collections = outputs.create_sim_collections(inp_filebase, all_conditions, args.reps) decor_outs = decorrelate.DecorrelatedOutputs( sim_collections, all_conditions) decor_outs.read_decors_from_files() mbarw = mbar_wrapper.MBARWrapper(decor_outs) mbarw.perform_mbar() out_filebase = create_output_filepathbase(args) mbarw.calc_all_expectations(out_filebase) for smult in args.stack_mults: reduced_conditions = construct_variable_temp_conditions( args, smult, fileformatter, system_file) reduced_out_filebase = '{}-{}'.format(out_filebase, smult) mbarw.calc_1d_lfes(reduced_conditions, reduced_out_filebase)
def main(): args = parse_args() system_file = files.JSONStructInpFile(args.system_filename) fileformatter = construct_fileformatter() all_conditions = construct_conditions(args, fileformatter, system_file) staple_lengths = all_conditions._staple_lengths inp_filebase = create_input_filepathbase(args) mbarws = [] all_decor_outs = [] sampled_ops = [] for i in range(1, args.assembled_op + 1): sim_collections = outputs.create_sim_collections( inp_filebase, all_conditions, args.reps) decor_outs = decorrelate.DecorrelatedOutputs(sim_collections, all_conditions) decor_outs.read_decors_from_files(data_only=True) filtered_count = decor_outs.filter_collections(args.tag, i) if filtered_count == 0: continue sampled_ops.append(i) all_decor_outs.append(decor_outs) mbarw = mbar_wrapper.MBARWrapper(decor_outs) mbarw.perform_mbar() mbarws.append(mbarw) out_filebase = create_output_filepathbase(args) # Calculate expectations across selected order parameter conds = conditions.SimConditions( { 'temp': args.temp, 'staple_m': args.staple_m, 'bias': biases.NoBias() }, fileformatter, staple_lengths) all_tags = [] for i in range(1, args.staple_types + 1): all_tags.append('staples{}'.format(i)) all_tags.append('staplestates{}'.format(i)) for i in range(args.scaffold_domains): all_tags.append('domainstate{}'.format(i)) aves, stds = calc_reduced_expectations(conds, mbarws, all_decor_outs, all_tags) aves = np.concatenate([[sampled_ops], np.array(aves).T]) aves_file = files.TagOutFile('{}-{}.aves'.format(out_filebase, args.tag)) aves_file.write([args.tag] + all_tags, aves.T) stds = np.concatenate([[sampled_ops], np.array(stds).T]) stds_file = files.TagOutFile('{}-{}.stds'.format(out_filebase, args.tag)) stds_file.write([args.tag] + all_tags, stds.T) # Hacky calculation for plotting a melting temperature LFE curve sim_collections = outputs.create_sim_collections(inp_filebase, all_conditions, args.reps) decor_outs = decorrelate.DecorrelatedOutputs(sim_collections, all_conditions) decor_outs.read_decors_from_files() mbarw = mbar_wrapper.MBARWrapper(decor_outs) mbarw.perform_mbar() values = decor_outs.get_concatenated_series(args.tag) decor_enes = decor_outs.get_concatenated_datatype('enes') decor_ops = decor_outs.get_concatenated_datatype('ops') decor_staples = decor_outs.get_concatenated_datatype('staples') bins = list(set(values)) bins.sort() value_to_bin = {value: i for i, value in enumerate(bins)} bin_index_series = [value_to_bin[i] for i in values] bin_index_series = np.array(bin_index_series) conds = conditions.SimConditions( { 'temp': args.temp, 'staple_m': args.staple_m, 'bias': biases.NoBias() }, fileformatter, staple_lengths) lfes, lfe_stds = calc_lfes(mbarw, conds, bins, bin_index_series, decor_enes, decor_ops, decor_staples) header = np.array(['ops', args.temp]) lfes_filebase = '{}_{}-lfes-melting'.format(out_filebase, args.tag) lfes_file = files.TagOutFile('{}.aves'.format(lfes_filebase)) lfes = np.concatenate([[bins], [lfes]]).T lfes_file.write(header, lfes) stds_file = files.TagOutFile('{}.stds'.format(lfes_filebase)) lfe_stds = np.concatenate([[bins], [lfe_stds]]).T stds_file.write(header, lfe_stds)
def main(): args = parse_args() system_file = files.JSONStructInpFile(args.system_filename) fileformatter = construct_fileformatter() all_conditions = construct_conditions(args, fileformatter, system_file) staple_lengths = all_conditions._staple_lengths inp_filebase = create_input_filepathbase(args) sim_collections = outputs.create_sim_collections(inp_filebase, all_conditions, args.reps) decor_outs = decorrelate.DecorrelatedOutputs( sim_collections, all_conditions) decor_outs.read_decors_from_files() mbarw = mbar_wrapper.MBARWrapper(decor_outs) mbarw.perform_mbar() out_filebase = create_output_filepathbase(args) values = decor_outs.get_concatenated_series(args.tag) decor_enes = decor_outs.get_concatenated_datatype('enes') decor_ops = decor_outs.get_concatenated_datatype('ops') decor_staples = decor_outs.get_concatenated_datatype('staples') bins = list(set(values)) bins.sort() value_to_bin = {value: i for i, value in enumerate(bins)} bin_index_series = [value_to_bin[i] for i in values] bin_index_series = np.array(bin_index_series) conds = conditions.SimConditions({'temp': args.guess_temp, 'staple_m': args.staple_m, 'bias': biases.NoBias()}, fileformatter, staple_lengths) melting_temp = minimize(squared_barrier_diff, args.guess_temp, args=(mbarw, values, bins, bin_index_series, decor_enes, decor_ops, decor_staples, conds)).x[0] lfes, lfe_stds = calc_lfes(mbarw, conds, bins, bin_index_series, decor_enes, decor_ops, decor_staples) barrier_height = np.around(calc_forward_barrier_height(lfes), decimals=3) barrier_i = find_barrier(lfes) melting_temp = '{:.3f}'.format(np.around(melting_temp, decimals=3)) print('Estimated melting temperature: {} K'.format(melting_temp)) print('Barrier height: {:.3f} kT'.format(barrier_height)) print('Barrier peak: {:.3f}'.format(bins[barrier_i])) header = np.array(['ops', melting_temp]) lfes_filebase = '{}_{}-lfes-melting'.format(out_filebase, args.tag) lfes_file = files.TagOutFile('{}.aves'.format(lfes_filebase)) lfes = np.concatenate([[bins], [lfes]]).T lfes_file.write(header, lfes) stds_file = files.TagOutFile('{}.stds'.format(lfes_filebase)) lfe_stds = np.concatenate([[bins], [lfe_stds]]).T stds_file.write(header, lfe_stds) # Calculated 2D LFEs tag2 = 'numfulldomains' decor_op_pairs = list(zip(decor_outs.get_concatenated_series(args.tag), decor_outs.get_concatenated_series(tag2))) bins = list(set(decor_op_pairs)) value_to_bin = {value: i for i, value in enumerate(bins)} bin_index_series = [value_to_bin[i] for i in decor_op_pairs] bin_index_series = np.array(bin_index_series) lfes, lfe_stds = calc_lfes(mbarw, conds, bins, bin_index_series, decor_enes, decor_ops, decor_staples) header = np.array([args.tag, tag2, melting_temp]) lfes_filebase = '{}_{}-{}-lfes-melting'.format( out_filebase, args.tag, tag2) bins = np.array(bins).reshape(len(bins), 2) lfes = np.concatenate([bins, np.array(lfes, ndmin=2).T], axis=1) lfes_file = files.TagOutFile('{}.aves'.format(lfes_filebase)) lfes_file.write(header, lfes) lfe_stds = np.concatenate([bins, np.array(lfe_stds, ndmin=2).T], axis=1) stds_file = files.TagOutFile('{}.stds'.format(lfes_filebase)) stds_file.write(header, lfe_stds) # Calculate expectations along the selected OP mbarws = [] all_decor_outs = [] sampled_ops = [] for i in range(1, args.assembled_op + 1): sim_collections = outputs.create_sim_collections(inp_filebase, all_conditions, args.reps) decor_outs = decorrelate.DecorrelatedOutputs( sim_collections, all_conditions) decor_outs.read_decors_from_files(data_only=True) filtered_count = decor_outs.filter_collections(args.tag, i) if filtered_count == 0: continue sampled_ops.append(i) all_decor_outs.append(decor_outs) mbarw = mbar_wrapper.MBARWrapper(decor_outs) mbarw.perform_mbar() mbarws.append(mbarw) out_filebase = create_output_filepathbase(args) # Calculate expectations across selected order parameter all_tags = [] for i in range(1, args.staple_types + 1): all_tags.append('staples{}'.format(i)) all_tags.append('staplestates{}'.format(i)) for i in range(args.scaffold_domains): all_tags.append('domainstate{}'.format(i)) aves, stds = calc_reduced_expectations( conds, mbarws, all_decor_outs, all_tags) aves = np.concatenate([[sampled_ops], np.array(aves).T]) aves_file = files.TagOutFile('{}-{}.aves'.format(out_filebase, args.tag)) aves_file.write([args.tag] + all_tags, aves.T) stds = np.concatenate([[sampled_ops], np.array(stds).T]) stds_file = files.TagOutFile('{}-{}.stds'.format(out_filebase, args.tag)) stds_file.write([args.tag] + all_tags, stds.T)