diff --git a/analysis/top_ranking_pairs_network_visualization.py b/analysis/top_ranking_pairs_network_visualization.py index 01b051b..d697b5f 100644 --- a/analysis/top_ranking_pairs_network_visualization.py +++ b/analysis/top_ranking_pairs_network_visualization.py @@ -61,16 +61,19 @@ def build_argument_parser(): subtypes = os.listdir(args.results_dir) for subtype in subtypes: results_fn = os.path.join(args.results_dir, subtype, "complete_pairwise_ixn_results.csv") + cnt_mtx_fn = os.path.join(args.results_dir, subtype, "count_matrix.csv") decoy_genes_fn = os.path.join(args.decoy_genes_dir, f"{subtype}_decoy_genes.txt") if not os.path.exists(results_fn) or not os.path.exists(decoy_genes_fn): logging.info(f"Skipping {subtype} since input files not found") continue results_df = pd.read_csv(results_fn) decoy_genes = set(pd.read_csv(decoy_genes_fn, header=None, names=["Gene"])["Gene"]) + num_samples = pd.read_csv(cnt_mtx_fn, index_col=0).shape[0] draw_network_gridplot_across_methods( args.top_k, subtype, driver_genes, decoy_genes, results_df, + num_samples, ) diff --git a/src/dialect/utils/plotting.py b/src/dialect/utils/plotting.py index 6352f7a..b581ecb 100644 --- a/src/dialect/utils/plotting.py +++ b/src/dialect/utils/plotting.py @@ -34,7 +34,7 @@ DECOY_GENE_COLOR = "#FFB3B3" # Pastel red for decoy genes DRIVER_GENE_COLOR = "#A3C1DA" # Blue-gray for driver genes EDGE_COLOR = "black" -EPSILON_MUTATION_COUNT = 20 # minimum count of mutations +EPSILON_MUTATION_COUNT = 10 # minimum count of mutations PVALUE_THRESHOLD = 1 @@ -144,6 +144,7 @@ def draw_network_gridplot_across_methods( driver_genes, decoy_genes, results_df, + num_samples, ): # TODO: move this to shared location to use across this and decoy gene plot methods = { @@ -154,8 +155,6 @@ def draw_network_gridplot_across_methods( "WeSME": "WeSME P-Val", } - num_samples = results_df.shape[0] - fig, axes = plt.subplots(2, 3, figsize=(24, 16)) fig.suptitle(f"Top 10 Ranked ME Pairs in {subtype}", fontsize=42, y=0.999) for idx, (method, col) in enumerate(methods.items()):