From fa04fa5faa1e81bcc9e5103be35350e899095d80 Mon Sep 17 00:00:00 2001 From: marakeby Date: Tue, 21 Sep 2021 21:51:33 -0400 Subject: [PATCH] add missing packages to environment.yml fix extracted path in figure files --- analysis/extended_figures/figure_ed5_importance.py | 10 +++++----- analysis/extended_figures/figure_ed7_activation.py | 6 +++--- analysis/figure_3/figure_3_sankey.py | 6 ++++-- environment.yml | 5 ++++- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/analysis/extended_figures/figure_ed5_importance.py b/analysis/extended_figures/figure_ed5_importance.py index 92c125e..6de28db 100644 --- a/analysis/extended_figures/figure_ed5_importance.py +++ b/analysis/extended_figures/figure_ed5_importance.py @@ -247,12 +247,12 @@ def plot_high_genes2(ax, layer=1, graph ='hist', direction='h'): else: column = 'coef' - node_importance = pd.read_csv(join(module_path,'./extracted/node_importance_graph_adjusted.csv'), index_col=0) + node_importance = pd.read_csv(join(module_path,'./figure_3/extracted/node_importance_graph_adjusted.csv'), index_col=0) high_nodes = node_importance[node_importance.layer == layer].abs().nlargest(10, columns=[column]) # high_nodes = node_importance[node_importance.layer == layer].abs().nlargest(10, columns=['coef']) features = list(high_nodes.index) - response = pd.read_csv(join(module_path,'./extracted/response.csv'), index_col=0) - df_in = pd.read_csv(join(module_path, './extracted/gradient_importance_detailed_{}.csv').format(layer), index_col=0) + response = pd.read_csv(join(module_path,'./figure_3/extracted/response.csv'), index_col=0) + df_in = pd.read_csv(join(module_path, './figure_3/extracted/gradient_importance_detailed_{}.csv').format(layer), index_col=0) df_in = df_in.copy() df_in = df_in.join(response) df_in['group'] = df_in.response @@ -395,8 +395,8 @@ def shorten_names(name): fontproperties = {'family': 'Arial', 'weight': 'normal', 'size': 6} def plot_axis(axis): - node_importance = pd.read_csv(join(module_path,'extracted/node_importance_graph_adjusted.csv'), index_col=0) - response = pd.read_csv(join(module_path, 'extracted/response.csv'), index_col=0) + node_importance = pd.read_csv(join(module_path,'figure_3/extracted/node_importance_graph_adjusted.csv'), index_col=0) + response = pd.read_csv(join(module_path, 'figure_3/extracted/response.csv'), index_col=0) print response.head() layers = sorted(list(node_importance.layer.unique())) print layers diff --git a/analysis/extended_figures/figure_ed7_activation.py b/analysis/extended_figures/figure_ed7_activation.py index 7a182a7..b4295da 100644 --- a/analysis/extended_figures/figure_ed7_activation.py +++ b/analysis/extended_figures/figure_ed7_activation.py @@ -70,9 +70,9 @@ def corrfunc(x, y, **kws): def plot_activation(ax, column='coef_combined', layer=3, pad=200): - node_activation = pd.read_csv(join(module_path,'extracted/node_importance_graph_adjusted.csv'), index_col=0) - response = pd.read_csv(join(module_path,'extracted/response.csv'), index_col=0) - df = pd.read_csv(join(module_path,'extracted/activation_{}.csv'.format(layer)), index_col=0) + node_activation = pd.read_csv(join(module_path,'figure_3/extracted/node_importance_graph_adjusted.csv'), index_col=0) + response = pd.read_csv(join(module_path,'figure_3/extracted/response.csv'), index_col=0) + df = pd.read_csv(join(module_path,'figure_3/extracted/activation_{}.csv'.format(layer)), index_col=0) df.columns = get_pathway_names(df.columns) if layer==1: column='coef_combined' diff --git a/analysis/figure_3/figure_3_sankey.py b/analysis/figure_3/figure_3_sankey.py index a0c8c30..0a2d32b 100644 --- a/analysis/figure_3/figure_3_sankey.py +++ b/analysis/figure_3/figure_3_sankey.py @@ -1,4 +1,6 @@ from os.path import dirname, realpath + +from config_path import PATHWAY_PATH from setup import saving_dir from analysis.vis_utils import get_reactome_pathway_names @@ -543,8 +545,8 @@ def get_fromated_network(links, high_nodes_df, col_name, remove_others): # shorten names def get_short_names(all_node_labels): - '/Users/haithamelmarakeby/PycharmProjects/pnet2/analysis/figure_3/extracted/pathways_short_names.xlsx' - df = pd.read_excel(join(module_path, './extracted/pathways_short_names.xlsx'), index_col=0) + + df = pd.read_excel(join(PATHWAY_PATH, 'pathways_short_names.xlsx'), index_col=0) mapping_dict = {} for k, v in zip(df['Full name'].values, df['Short name (Eli)'].values): mapping_dict[k] = str(v) diff --git a/environment.yml b/environment.yml index a5208a0..d078b2d 100644 --- a/environment.yml +++ b/environment.yml @@ -6,7 +6,7 @@ dependencies: - pip=18.1 - enum34=1.1.6 - futures=3.3.0 - - h5py=2.9.0 + - h5py=2.9.0l.c - hdf5=1.10.4 - imageio=2.6.1 - keras=2.2.4 @@ -27,9 +27,12 @@ dependencies: - tensorboard=1.12.2 - tensorflow=1.12.0 - yaml=0.1.7 + - plotly-orca=1.3.1 - pip: + - adjusttext==0.7.3 - lifelines==0.19.5 - matplotlib==2.2.4 + - psutil==5.8.0 - networkx==2.2 - pyvis==0.1.7.0 - requests==2.23.0