def visualize_stacked_features(sample, image_dir, verbose=True): if not os.path.exists(image_dir): os.makedirs(image_dir) feature = sample["feature"] for i, f in enumerate(feature): name = f"{i}.png" fig = vis_hm.protein_distogram_heatmap(f) if verbose: print(f"Saving image: {image_dir}/{name}") fig.write_image(f"{image_dir}/{name}")
def togle_het_atoms(n_clicks, slider_val): triger_id = dash.callback_context.triggered[0]['prop_id'].split('.')[0] if triger_id == "toggle_het_atoms": app_state["show_het_atoms"] = not app_state["show_het_atoms"] df = pdbStructure.get_pandas_structure( test_pdb_file, het_atom=app_state["show_het_atoms"]) heatmap_fig = protein_distogram_heatmap(pdbStructure.get_pairwise_euclidean_atom(df), clip_min=slider_val[0], clip_max=slider_val[1]) print(f"Clicked toggle: {app_state}") print(f"Data shape: {df.shape}") print() return heatmap_fig
def visualize_batch(batch, image_dir, verbose=True): batch_size = len(batch["pdb_path"]) for i in range(batch_size): for k in batch: if k != "pdb_path": name = f"{k}.png" fig = vis_hm.protein_distogram_heatmap(batch[k][i]) dirname = f"{image_dir}/batch_{i}" if not os.path.exists(dirname): os.makedirs(dirname) if verbose: print(f"Saving image: {dirname}/{name}") fig.write_image(f"{dirname}/{name}")
def visualize_features(sample, image_dir, verbose=True): if not os.path.exists(image_dir): os.makedirs(image_dir) print(f"Sample name: {sample['pdb_path']}") for k in sample: if k != "pdb_path": name = f"{k}.png" fig = vis_hm.protein_distogram_heatmap(sample[k]) if verbose: print(f"Saving image: {image_dir}/{name}") fig.write_image(f"{image_dir}/{name}") return True
f"{config.folder_structure_cfg.log_path}/{experiment_root}/nn_vis/0/{sample}/") return layers # image_directory = '/home/erikj/projects/insidrug/py_proj/erikj/loggs/2020_10_30_10_36_18_fullrun/images/' # list_of_images = [os.path.basename(x) # for x in glob.glob(f'{image_directory}*.png')] static_image_route = '/static/' app_state = {"show_het_atoms": False} pdbStructure = PandasMolStructure() df = pdbStructure.get_pandas_structure( test_pdb_file, het_atom=app_state["show_het_atoms"]) heatmap_fig = protein_distogram_heatmap( pdbStructure.get_pairwise_euclidean_atom(df)) app.layout = html.Div(children=[ dcc.Tabs([ dcc.Tab(label='Experiment results', children=[ dcc.Interval( id='interval-component', interval=1*1000, # in milliseconds n_intervals=0 ), html.H3("Filter weight distributions"), html.P("Select experiment"), dcc.Dropdown(id="experiment-dropdown", options=[{"label": f"{x[1]}", "value": f"{x[1]}"} for x in list(map(lambda x: os.path.split(x), logs))]